Fix a couple of FindBBugs warnings
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Mar 2011 13:23:13 +0000 (13:23 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Mar 2011 13:23:13 +0000 (13:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1081771 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/resources/LocalStrings.properties
java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
res/findbugs/filter-false-positives.xml

index ac24d87..d7a82bd 100644 (file)
@@ -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
index f25e82e..0529251 100644 (file)
@@ -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);
index a3ba7c6..649137c 100644 (file)
   <Match>
     <Class name="org.apache.el.parser.ParseException" />
   </Match>
+  <Match>
+    <!-- fCurrentEntity may be null after endEntity() call -->
+    <Class name="org.apache.jasper.xmlparser.XMLEncodingDetector" />
+    <Method name="load" />
+    <Bug code="RCN" />
+  </Match>
 
   <!-- Test code -->
   <Match>