From 59451b938298d484d4a1e82e4fedfe79b0bab41b Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 15 Mar 2011 13:23:13 +0000 Subject: [PATCH] Fix a couple of FindBBugs warnings git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1081771 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/resources/LocalStrings.properties | 2 ++ java/org/apache/jasper/xmlparser/XMLEncodingDetector.java | 7 ++++++- res/findbugs/filter-false-positives.xml | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/java/org/apache/jasper/resources/LocalStrings.properties b/java/org/apache/jasper/resources/LocalStrings.properties index ac24d87a2..d7a82bd2f 100644 --- a/java/org/apache/jasper/resources/LocalStrings.properties +++ b/java/org/apache/jasper/resources/LocalStrings.properties @@ -483,3 +483,5 @@ jsp.message.jsp_queue_update=Updating JSP for path [{0}] in queue of context [{1 jsp.message.jsp_removed_excess=Removing excess JSP for path [{0}] from queue of context [{1}] jsp.message.jsp_removed_idle=Removing idle JSP for path [{0}] in context [{1}] after {2} seconds"); jsp.message.jsp_unload_check=Checking JSPs for unload in context [{0}], JSP count: {1} queue length: {2} + +xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream \ No newline at end of file diff --git a/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java b/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java index f25e82ea6..05292517e 100644 --- a/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java +++ b/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java @@ -37,6 +37,7 @@ import org.apache.jasper.JasperException; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.compiler.ErrorDispatcher; import org.apache.jasper.compiler.JspUtil; +import org.apache.jasper.compiler.Localizer; public class XMLEncodingDetector { @@ -170,7 +171,11 @@ public class XMLEncodingDetector { int b2 = b4[2] & 0xFF; if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) { // ignore first three bytes... - stream.skip(3); + long skipped = stream.skip(3); + if (skipped != 3) { + throw new IOException(Localizer.getMessage( + "xmlParser.skipBomFail")); + } } } reader = createReader(stream, encoding, isBigEndian); diff --git a/res/findbugs/filter-false-positives.xml b/res/findbugs/filter-false-positives.xml index a3ba7c6f2..649137ce2 100644 --- a/res/findbugs/filter-false-positives.xml +++ b/res/findbugs/filter-false-positives.xml @@ -212,6 +212,12 @@ + + + + + + -- 2.11.0