From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Mon, 22 Mar 2021 18:40:26 +0100
Subject: change to EGIZ codestyle
---
.../moaspss/util/MOAEntityResolver.java | 55 ++++++++++++----------
1 file changed, 29 insertions(+), 26 deletions(-)
(limited to 'moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java')
diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java
index 7f529ca..d7c6a5b 100644
--- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java
+++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAEntityResolver.java
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moaspss.util;
import java.io.InputStream;
@@ -35,18 +34,20 @@ import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
/**
- * An EntityResolver
that looks up entities stored as
- * local resources.
- *
- *
The following DTDs are mapped to local resources:
+ * An EntityResolver
that looks up entities stored as local
+ * resources.
+ *
+ *
+ * The following DTDs are mapped to local resources: *
For all other resources, an attempt is made to resolve them as resources, + *
+ * For all other resources, an attempt is made to resolve them as resources,
* either absolute or relative to Constants.SCHEMA_ROOT
.
- *
+ *
* @author Patrick Peck
* @author Sven Aigner
*/
@@ -54,56 +55,58 @@ public class MOAEntityResolver implements EntityResolver {
/**
* Resolve an entity.
- *
+ *
* The systemId
parameter is used to perform the lookup of the
- * entity as a resource, either by interpreting the systemId
as
- * an absolute resource path, or by appending the last path component of
+ * entity as a resource, either by interpreting the systemId
as an
+ * absolute resource path, or by appending the last path component of
* systemId
to Constants.SCHEMA_ROOT
.
- *
+ *
* @param publicId The public ID of the resource.
* @param systemId The system ID of the resource.
* @return An InputSource
from which the entity can be read, or
- * null
, if the entity could not be found.
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ * null
, if the entity could not be found.
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
+ * java.lang.String)
*/
+ @Override
public InputSource resolveEntity(String publicId, String systemId) {
InputStream stream;
int slashPos;
if (Logger.isDebugEnabled()) {
Logger.debug(
- new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId));
+ new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId));
}
if (publicId != null) {
// check if we can resolve some standard dtd's
if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) {
return new InputSource(
- getClass().getResourceAsStream(
- Constants.SCHEMA_ROOT + "XMLSchema.dtd"));
+ getClass().getResourceAsStream(
+ Constants.SCHEMA_ROOT + "XMLSchema.dtd"));
} else if (publicId.equalsIgnoreCase("datatypes")) {
return new InputSource(
- getClass().getResourceAsStream(
- Constants.SCHEMA_ROOT + "datatypes.dtd"));
+ getClass().getResourceAsStream(
+ Constants.SCHEMA_ROOT + "datatypes.dtd"));
}
} else if (systemId != null) {
// get the URI path
try {
- URI uri = new URI(systemId);
+ final URI uri = new URI(systemId);
systemId = uri.getPath();
-
+
if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) {
return null;
}
-
- } catch (MalformedURIException e) {
+
+ } catch (final MalformedURIException e) {
return null;
}
-
+
// try to get the resource from the full path
stream = getClass().getResourceAsStream(systemId);
if (stream != null) {
- InputSource source = new InputSource(stream);
+ final InputSource source = new InputSource(stream);
source.setSystemId(systemId);
return source;
@@ -114,9 +117,9 @@ public class MOAEntityResolver implements EntityResolver {
if (slashPos >= 0 && systemId.length() > slashPos) {
systemId = systemId.substring(slashPos + 1, systemId.length());
stream =
- getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId);
+ getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId);
if (stream != null) {
- InputSource source = new InputSource(stream);
+ final InputSource source = new InputSource(stream);
source.setSystemId(systemId);
return source;
--
cgit v1.2.3