From: <mar...@us...> - 2010-10-14 08:54:25
|
Revision: 3794 http://bigdata.svn.sourceforge.net/bigdata/?rev=3794&view=rev Author: martyncutcher Date: 2010-10-14 08:54:19 +0000 (Thu, 14 Oct 2010) Log Message: ----------- Fix second reference to unencoded URI Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/rules/TestDatabaseAtOnceClosure.java Modified: branches/JOURNAL_HA_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/rules/TestDatabaseAtOnceClosure.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/rules/TestDatabaseAtOnceClosure.java 2010-10-13 21:27:06 UTC (rev 3793) +++ branches/JOURNAL_HA_BRANCH/bigdata-rdf/src/test/com/bigdata/rdf/rules/TestDatabaseAtOnceClosure.java 2010-10-14 08:54:19 UTC (rev 3794) @@ -721,9 +721,29 @@ } catch (FileNotFoundException ex) { is = getClass().getResourceAsStream(resource); - baseURI = getClass().getResource(resource).toURI() - .toString(); + java.net.URL resourceUrl = + getClass().getResource(resource); + //if the resource couldn't be found in the file system + //and couldn't be found by searching from this class' + //package (com.bigdata.rdf.rules) as root, then use + //the class loader to try searching from the root of + //the JAR itself + if (resourceUrl == null) { + is = getClass().getClassLoader().getResourceAsStream(resource); + resourceUrl = + getClass().getClassLoader().getResource(resource); + } + + if (resourceUrl == null) { + log.warn("resource not found ["+resource+"]"); + throw new Exception("FAILURE: resource not found ["+resource+"]"); + } + + //must encode spaces in URL before new URI + String encodedUrlStr = resourceUrl.toString().replaceAll(" ", "%20"); + java.net.URI resourceUri = new java.net.URI(encodedUrlStr); + baseURI = resourceUri.toString(); } if (is == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |