Collapse identical catch branches.

Also take advantage of Java's try-with-resources feature.

Resolves #1248.
This commit is contained in:
hdulme
2022-04-30 14:46:25 +02:00
committed by Greg L. Turnquist
parent 3c04f23ba8
commit bde18f52af
18 changed files with 36 additions and 98 deletions

View File

@@ -55,10 +55,7 @@ public abstract class SaxUtils {
public static String getSystemId(Resource resource) {
try {
return new URI(resource.getURL().toExternalForm()).toString();
} catch (IOException ex) {
logger.debug("Could not get System ID from [" + resource + "], ex");
return null;
} catch (URISyntaxException e) {
} catch (IOException | URISyntaxException ex) {
logger.debug("Could not get System ID from [" + resource + "], ex");
return null;
}

View File

@@ -98,9 +98,7 @@ public class CommonsXsdSchema implements XsdSchema {
}
Document[] serializedSchemas = serializer.serializeSchema(schema, false);
return new DOMSource(serializedSchemas[0]);
} catch (BeanInstantiationException ex) {
// ignore
} catch (XmlSchemaSerializer.XmlSchemaSerializerException ex) {
} catch (BeanInstantiationException | XmlSchemaSerializer.XmlSchemaSerializerException ex) {
// ignore
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();