From aff327d0cce69f863209a011d1858eb98e45d12a Mon Sep 17 00:00:00 2001 From: Luc Boudreau Date: Wed, 13 May 2009 14:56:05 +0000 Subject: [PATCH] Fixed an issue where there are no available catalogs. There was an IndexOutOfBoundsException, which is a no-no. git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@238 c6a108a4-781c-0410-a6c6-c2d559e19af0 --- src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java index 5ca3f25..de525e6 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java @@ -386,7 +386,13 @@ public String getCatalog() throws OlapException { if (this.catalogName == null) { // This means that no particular catalog name // was specified by the user. - this.catalogName = this.getCatalogs().get(0).getName(); + List catalogs = this.getCatalogs(); + if (catalogs.size() == 0) { + throw new OlapException("There is no catalog " + + "available to query against."); + } else { + this.catalogName = catalogs.get(0).getName(); + } } else { // We must verify that the requested catalog name // exists in the metadata.