diff --git a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jCache.java b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jCache.java index d94d3be..b1e32ea 100644 --- a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jCache.java +++ b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jCache.java @@ -12,6 +12,8 @@ import java.net.URL; import java.util.Map; +import org.olap4j.OlapException; + /** * XMLA driver cache. Implementations will have to declare those methods. * @@ -37,9 +39,9 @@ public interface XmlaOlap4jCache { * @param url The URL where the SOAP message was sent. * @param request The SOAP complete message. * - * @throws XmlaOlap4jInvalidStateException when - * operations to the cache are performed but it hasn't been initialized. - * Make sure you call the setParameters method. + * @throws OlapException when operations to the cache are + * performed but it hasn't been initialized. Make sure you + * call the setParameters(Map, Map) method. * * @return The SOAP response, null if there are no corresponding * response in the cache. @@ -48,7 +50,7 @@ public byte[] get( String id, URL url, byte[] request) - throws XmlaOlap4jInvalidStateException; + throws OlapException; /** * Adds a SOAP response to the cache. It has to be relative to the @@ -60,16 +62,16 @@ public byte[] get( * response. * @param response The response to cache. * - * @throws XmlaOlap4jInvalidStateException when - * operations to the cache are performed but it hasn't been initialized. - * Make sure you call the setParameters method. + * @throws OlapException when operations to the cache are + * performed but it hasn't been initialized. Make sure you + * call the setParameters(Map, Map) method. */ public void put( String id, URL url, byte[] request, byte[] response) - throws XmlaOlap4jInvalidStateException; + throws OlapException; /** * Tells the cache to flush all cached entries. @@ -82,9 +84,9 @@ public void put( *

The XMLA driver takes cache properties as * "Cache.[property name]=[value]" in its JDBC url. All those * properties should be striped of their "Cache." prefix and - * sent to this method as the properties parameter. + * sent to this method as the props parameter. * - *

Also, the complete config map of the current connection + *

Also, the complete map of the current connection * should be passed as the config parameter. * * @param config The complete configuration parameters which were used to diff --git a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jInvalidStateException.java b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jInvalidStateException.java index 83921d3..80d7d61 100644 --- a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jInvalidStateException.java +++ b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jInvalidStateException.java @@ -9,18 +9,16 @@ */ package org.olap4j.driver.xmla.cache; +import org.olap4j.OlapException; + /** *

Internal exception which gets thrown when operations to the cache * are performed but it hasn't been initialized. * - *

It extends RuntimeException so it cannot be catched by the - * regular catch(Exception) mechanism. Those exceptions should get right - * to the system level since it's a programming error. - * * @author Luc Boudreau * @version $Id$ */ -class XmlaOlap4jInvalidStateException extends RuntimeException { +public class XmlaOlap4jInvalidStateException extends OlapException { private static final long serialVersionUID = 7265273715459263740L; } diff --git a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java index 079a384..d4f2513 100644 --- a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java +++ b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jAbstractHttpProxy.java @@ -9,14 +9,14 @@ */ package org.olap4j.driver.xmla.proxy; -import java.io.*; -import java.net.*; -import java.util.*; -import java.util.concurrent.*; +import java.net.URL; +import java.net.URLConnection; +import java.util.Map; +import java.util.concurrent.Future; import org.olap4j.OlapException; -import org.olap4j.driver.xmla.XmlaOlap4jDriver; import org.olap4j.driver.xmla.XmlaHelper; +import org.olap4j.driver.xmla.XmlaOlap4jDriver; import org.olap4j.driver.xmla.cache.XmlaOlap4jCache; /** @@ -159,7 +159,7 @@ public byte[] get(URL url, String request) throws XmlaOlap4jProxyException { if (response != null) { return response; } - } catch (IOException e) { + } catch (Exception e) { throw new XmlaOlap4jProxyException( "An exception was encountered while browsing the proxy cache.", e); @@ -176,7 +176,7 @@ public byte[] get(URL url, String request) throws XmlaOlap4jProxyException { response); // Returns result return response; - } catch (IOException e) { + } catch (Exception e) { throw new XmlaOlap4jProxyException( "An exception was encountered while saving a response in the proxy cache.", e); @@ -194,7 +194,9 @@ public byte[] get(URL url, String request) throws XmlaOlap4jProxyException { * @return either a response in a byte array or null * if the response is not in cache */ - private byte[] getFromCache(final URL url, final byte[] request) { + private byte[] getFromCache(final URL url, final byte[] request) + throws OlapException + { return (this.cache != null) ? this.cache.get(this.cacheId, url, request) : null; @@ -207,7 +209,9 @@ private byte[] getFromCache(final URL url, final byte[] request) { * @param request The SOAP request to cache * @param response The SOAP response to cache */ - private void addToCache(URL url, byte[] request, byte[] response) { + private void addToCache(URL url, byte[] request, byte[] response) + throws OlapException + { if (this.cache != null) { this.cache.put(this.cacheId, url, request, response); }