summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/Resolver.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-22 02:16:29 +0200
committerDavid A. Madore <david+git@madore.org>2010-04-22 02:16:29 +0200
commitf2745aadc7d0eb02002f667cd72d8536e4f1daf1 (patch)
treeab03ed4bed1c1cbe9568b3a9f24db15639e41b8d /org/madore/damlengine/Resolver.java
parent88ef0fa3b0f0ec58cff7d819f9447064be9b6fad (diff)
downloaddamlengine-f2745aadc7d0eb02002f667cd72d8536e4f1daf1.tar.gz
damlengine-f2745aadc7d0eb02002f667cd72d8536e4f1daf1.tar.bz2
damlengine-f2745aadc7d0eb02002f667cd72d8536e4f1daf1.zip
Various "stylistic" improvements suggested by Joshua Bloch's book.
Use @Override annotation. Limit accessibility of fields. Make final what can be. Use complex enums. Don't ignore exceptions. Some more changes on exceptions thrown.
Diffstat (limited to 'org/madore/damlengine/Resolver.java')
-rw-r--r--org/madore/damlengine/Resolver.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/org/madore/damlengine/Resolver.java b/org/madore/damlengine/Resolver.java
index 103659c..e04d1b2 100644
--- a/org/madore/damlengine/Resolver.java
+++ b/org/madore/damlengine/Resolver.java
@@ -29,6 +29,7 @@ public final class Resolver
public static final class BootstrapResolver
extends org.apache.xml.resolver.helpers.BootstrapResolver {
+ @Override
public InputSource resolveEntity(String publicId, String systemId) {
String resolved = null;
if ( publicId.equals("-//GlobalTransCorp//DTD XML Catalogs "
@@ -65,7 +66,9 @@ public final class Resolver
try {
catalog.parseCatalog(f);
} catch (MalformedURLException e) {
+ throw new RuntimeException(e);
} catch (IOException e) {
+ throw new RuntimeException(e);
}
}
}
@@ -74,9 +77,9 @@ public final class Resolver
try {
return catalog.resolvePublic(publicId, systemId);
} catch (MalformedURLException e) {
- return null;
+ throw new RuntimeException(e);
} catch (IOException e) {
- return null;
+ throw new RuntimeException(e);
}
}
@@ -84,9 +87,9 @@ public final class Resolver
try {
return catalog.resolveSystem(systemId);
} catch (MalformedURLException e) {
- return null;
+ throw new RuntimeException(e);
} catch (IOException e) {
- return null;
+ throw new RuntimeException(e);
}
}
@@ -107,6 +110,7 @@ public final class Resolver
URI v = u.resolve(systemId);
return v.toString();
} catch ( URISyntaxException e ) {
+ // Fail and continue to next return.
}
}
return systemId;