aboutsummaryrefslogtreecommitdiff
path: root/id/server
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-06-21 14:15:26 +0200
commit811ba264eccb93c901db971423022d8e12ca7c69 (patch)
treed80b1329e478aa79badb300f218bfc1554defaa8 /id/server
parent52756cc141ea3f67d6d6eb3a1cadae690c7c2143 (diff)
downloadmoa-id-spss-811ba264eccb93c901db971423022d8e12ca7c69.tar.gz
moa-id-spss-811ba264eccb93c901db971423022d8e12ca7c69.tar.bz2
moa-id-spss-811ba264eccb93c901db971423022d8e12ca7c69.zip
fix Bug in 'parse document from input stream' method which produce a SaxParserException if DebugLevel is 'debug'
Diffstat (limited to 'id/server')
-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);
}