From f2745aadc7d0eb02002f667cd72d8536e4f1daf1 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Thu, 22 Apr 2010 02:16:29 +0200 Subject: 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. --- org/madore/damlengine/Resolver.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'org/madore/damlengine/Resolver.java') 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; -- cgit v1.2.3