diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java b/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java index 75b304c..4123f80 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java @@ -122,7 +122,7 @@ void populate() throws OlapException { */ // TODO: log doc to logfile throw OlapExceptionHelper.createException( - "XMLA provider gave exception: " + + "XMLA provider gave exception: " + XmlaOlap4jUtil.prettyPrint(fault)); } Element executeResponse = diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java index 322f503..a5632b8 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java @@ -660,7 +660,7 @@ Element xxx(String request) throws OlapException { */ // TODO: log doc to logfile throw OlapExceptionHelper.createException( - "XMLA provider gave exception: " + + "XMLA provider gave exception: " + XmlaOlap4jUtil.prettyPrint(fault) + "\n Request was: \n" + request); } diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jUtil.java b/src/org/olap4j/driver/xmla/XmlaOlap4jUtil.java index 36f04f8..136c7d9 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jUtil.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jUtil.java @@ -172,7 +172,7 @@ private static void prettyPrintLoop( } private static void prettyPrintLoop( - Node node, + Node node, StringBuilder string, String indentation) { @@ -183,74 +183,69 @@ private static void prettyPrintLoop( int type = node.getNodeType(); switch (type) { - case Node.DOCUMENT_NODE: { - string.append("\n"); - prettyPrintLoop(node.getChildNodes(), string, indentation+"\t"); - break; - } - case Node.ELEMENT_NODE: { - string.append(indentation); - string.append("<"); - string.append(node.getNodeName()); - - int length = (node.getAttributes() != null) ? - node.getAttributes().getLength() : 0; - Attr attributes[] = new Attr[length]; - for (int loopIndex = 0; loopIndex < length; loopIndex++) { - attributes[loopIndex] = - (Attr)node.getAttributes().item(loopIndex); - } - - for (int loopIndex = 0; loopIndex < attributes.length; - loopIndex++) - { - Attr attribute = attributes[loopIndex]; - string.append(" "); - string.append(attribute.getNodeName()); - string.append("=\""); - string.append(attribute.getNodeValue()); - string.append("\""); - } - - string.append(">\n"); - - prettyPrintLoop(node.getChildNodes(), string, indentation+"\t"); - - string.append(indentation); - string.append("\n"); - - break; + case Node.DOCUMENT_NODE: + string.append("\n"); + prettyPrintLoop(node.getChildNodes(), string, indentation + "\t"); + break; + + case Node.ELEMENT_NODE: + string.append(indentation); + string.append("<"); + string.append(node.getNodeName()); + + int length = (node.getAttributes() != null) ? + node.getAttributes().getLength() : 0; + Attr attributes[] = new Attr[length]; + for (int loopIndex = 0; loopIndex < length; loopIndex++) { + attributes[loopIndex] = + (Attr)node.getAttributes().item(loopIndex); } - case Node.TEXT_NODE: { - string.append(indentation); - string.append(node.getNodeValue().trim()+"\n"); - //prettyPrintLoop(node, string, indentation+"\t"); - break; + for (int loopIndex = 0; loopIndex < attributes.length; + loopIndex++) + { + Attr attribute = attributes[loopIndex]; + string.append(" "); + string.append(attribute.getNodeName()); + string.append("=\""); + string.append(attribute.getNodeValue()); + string.append("\""); } - case Node.PROCESSING_INSTRUCTION_NODE: { - string.append(indentation); - string.append(" 0) { - string.append(text); - } - string.append("?>\n"); - break; - } + string.append(">\n"); - case Node.CDATA_SECTION_NODE: { - string.append(indentation); - string.append(""); - break; - } + prettyPrintLoop(node.getChildNodes(), string, indentation + "\t"); + + string.append(indentation); + string.append("\n"); + + break; + + case Node.TEXT_NODE: + string.append(indentation); + string.append(node.getNodeValue().trim() + "\n"); + break; + + case Node.PROCESSING_INSTRUCTION_NODE: + string.append(indentation); + string.append(" 0) { + string.append(text); + } + string.append("?>\n"); + break; + + case Node.CDATA_SECTION_NODE: + string.append(indentation); + string.append(""); + break; } } diff --git a/testsrc/org/olap4j/XmlaConnectionTest.java b/testsrc/org/olap4j/XmlaConnectionTest.java index 8aa7d57..cdd17b8 100644 --- a/testsrc/org/olap4j/XmlaConnectionTest.java +++ b/testsrc/org/olap4j/XmlaConnectionTest.java @@ -65,19 +65,17 @@ private void checkup(String request) { public void testNoNonTrivalCallsOnConnect() throws Exception { String cookie = XmlaOlap4jDriver.nextCookie(); try { - XmlaOlap4jDriver.PROXY_MAP.put(cookie, new XmlaOlap4jProxyMock()); - try { - Class.forName(DRIVER_CLASS_NAME); - } catch (ClassNotFoundException e) { - throw new RuntimeException("oops", e); - } - Properties info = new Properties(); - info.setProperty( - XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); - DriverManager.getConnection( - "jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + cookie, + Class.forName(DRIVER_CLASS_NAME); + } catch (ClassNotFoundException e) { + throw new RuntimeException("oops", e); + } + Properties info = new Properties(); + info.setProperty( + XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); + DriverManager.getConnection( + "jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + cookie, info); } catch (Throwable t) { t.printStackTrace(); @@ -85,6 +83,16 @@ public void testNoNonTrivalCallsOnConnect() throws Exception { } } + /** + * If the same request + * is sent twice, an exception gets triggered. The only + * exception to this is the MDSCHEMA_CUBES query that is used to + * populate both the catalogs and the schemas associated to a + * given catalog. This was due to a flaw in SSAS; it doesn't + * return a SCHEMA_NAME column when asked to. We fixed it this + * way in some other revision. + * @throws Exception If the test fails. + */ public void testNoDoubleQuerySubmission() throws Exception { String oldValue = XmlaTester.getProxyClassName(); XmlaTester.setProxyClassName(