[Mulgara-svn] r1386 - trunk/src/jar/resolver/java/org/mulgara/resolver

pag at mulgara.org pag at mulgara.org
Tue Dec 2 01:13:14 UTC 2008


Author: pag
Date: 2008-12-01 17:13:13 -0800 (Mon, 01 Dec 2008)
New Revision: 1386

Modified:
   trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
Log:
Fixed a bug where wrapped graph URIs were being ignored because they don't contain a fragment

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2008-12-02 01:12:12 UTC (rev 1385)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2008-12-02 01:13:13 UTC (rev 1386)
@@ -649,10 +649,10 @@
       String scheme = uri.getScheme();
       String fragment = uri.getFragment();
 
-      if (scheme != null && scheme.equals(databaseURI.getScheme()) && fragment != null ) {
+      if (scheme != null && scheme.equals(databaseURI.getScheme())) {
         if (databaseURI.isOpaque()) {
           // databaseURI is opaque.
-          if (uri.isOpaque()) {
+          if (fragment != null && uri.isOpaque()) {
             // Get the query string.
             // We have to do it this way for opaque URIs.
             String ssp = uri.getSchemeSpecificPart();
@@ -699,11 +699,18 @@
             SPObjectFactory spObjectFactory = persistentStringPool.getSPObjectFactory();
             QueryParams query = QueryParams.decode(uri);
             String gName = query.get(GRAPH);
-            try {
-              if (gName != null) spObject = spObjectFactory.newSPURI(new URI(gName));
-              else spObject = spObjectFactory.newSPURI(new URI(null, null, null, uri.getQuery(), fragment));
-            } catch (URISyntaxException ex) {
-              logger.warn("Cannot create relative URI with fragment:\"" + fragment + "\"", ex);
+            if (gName != null) {
+              try {
+                spObject = spObjectFactory.newSPURI(new URI(gName));
+              } catch (URISyntaxException ex) {
+                logger.warn("Cannot extract a valid URI from:\"" + gName + "\"", ex);
+              }
+            } else if (fragment != null) {
+              try {
+                spObject = spObjectFactory.newSPURI(new URI(null, null, null, uri.getQuery(), fragment));
+              } catch (URISyntaxException ex) {
+                logger.warn("Cannot create relative URI with fragment:\"" + fragment + "\"", ex);
+              }
             }
           }
         }




More information about the Mulgara-svn mailing list