[Mulgara-svn] r1522 - trunk/src/jar/resolver/java/org/mulgara/resolver
alexhall at mulgara.org
alexhall at mulgara.org
Tue Feb 17 22:46:59 UTC 2009
Author: alexhall
Date: 2009-02-17 14:46:59 -0800 (Tue, 17 Feb 2009)
New Revision: 1522
Modified:
trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
Log:
Fix a bug that causes an infinite recursion when referring to a non-existent graph absolute URI that is relative to the server URI. This will account for the fact that the canonical server URI may contain uppercase characters but the hostname aliases are stored in lowercase.
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2009-02-17 22:27:03 UTC (rev 1521)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2009-02-17 22:46:59 UTC (rev 1522)
@@ -553,7 +553,11 @@
metadata.getHostnameAliases().contains(addr.getCanonicalHostName()) ||
metadata.getHostnameAliases().contains(addr.getHostAddress())) {
// change the host name to one that is recognised
- return getLocalURI(graphURI);
+ // Make sure that it doesn't canonicalize to the original URI; this could cause an infinite loop.
+ URI newGraphURI = getLocalURI(graphURI);
+ if (!graphURI.equals(newGraphURI)) {
+ return new URIReferenceImpl(graphURI);
+ }
}
// not found, so return nothing
@@ -568,7 +572,7 @@
* @return The URIReference representing the same URI as the parameter, with the host name updated.
* @throws QueryException When the uri cannot be manipulated.
*/
- private Node getLocalURI(URI uri) throws QueryException {
+ private URI getLocalURI(URI uri) throws QueryException {
// use the system graph to find the local host name
String newHost = metadata.getSystemModelURI().getHost();
// update the URI
@@ -577,7 +581,7 @@
uri.getPath(), uri.getQuery(), uri.getFragment());
logger.debug("Changing graph URI from " + uri + " to " + newGraphURI);
- return new URIReferenceImpl(newGraphURI);
+ return newGraphURI;
} catch (URISyntaxException e) {
throw new QueryException("Internal error. Graph URI cannot be manipulated.");
}
More information about the Mulgara-svn
mailing list