aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-06-21 14:15:26 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-09-15 08:02:47 +0200
commit85bcdb660aca73e87a3173350b66bcdef558d287 (patch)
tree2722a881c7b45441a7e34f13fa8078117cc29320 /id/server/moa-id-commons/src/main
parenta387d8d75d7f0e1c8032765cf7428728b8e0d70e (diff)
downloadmoa-id-spss-85bcdb660aca73e87a3173350b66bcdef558d287.tar.gz
moa-id-spss-85bcdb660aca73e87a3173350b66bcdef558d287.tar.bz2
moa-id-spss-85bcdb660aca73e87a3173350b66bcdef558d287.zip
fix Bug in 'parse document from input stream' method which produce a SaxParserException if DebugLevel is 'debug'
Diffstat (limited to 'id/server/moa-id-commons/src/main')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java
index 95cd63643..fed968443 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java
@@ -49,6 +49,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.commons.io.IOUtils;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.parsers.SAXParser;
import org.apache.xerces.parsers.XMLGrammarPreparser;
@@ -225,12 +226,13 @@ public class DOMUtils {
byte buffer [] = null;
ByteArrayInputStream baStream = null;
if(true == Logger.isDebugEnabled()) {
- int len = inputStream.available();
- buffer = new byte[len];
- inputStream.read(buffer);
+ buffer = IOUtils.toByteArray(inputStream);
baStream = new ByteArrayInputStream(buffer);
- }
+ }
+
+
+
// create the DOM parser
if (symbolTable != null) {
parser = new DOMParser(symbolTable, grammarPool);
@@ -298,7 +300,7 @@ public class DOMUtils {
else
parser.parse(new InputSource(inputStream));
} catch(SAXException e) {
- if(true == Logger.isDebugEnabled() && null != buffer) {
+ if(true == Logger.isDebugEnabled() && null != buffer) {
String xmlContent = new String(buffer);
Logger.debug("SAXException in:\n" + xmlContent);
}