You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/07/24 12:14:46 UTC

[commons-io] branch master updated: Match XML PI at start of document

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c9d7bc1 Match XML PI at start of document
3c9d7bc1 is described below

commit 3c9d7bc18c1c0a4bd2524003c8c1db1c9eb112c2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 24 08:14:41 2023 -0400

    Match XML PI at start of document
---
 src/main/java/org/apache/commons/io/input/XmlStreamReader.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
index 550af9ee..66c8d9b6 100644
--- a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
+++ b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
@@ -202,7 +202,7 @@ public class XmlStreamReader extends Reader {
     /**
      * Pattern capturing the encoding of the "xml" processing instruction.
      */
-    public static final Pattern ENCODING_PATTERN = Pattern.compile("<\\?xml.*encoding[\\s]*=[\\s]*((?:\".[^\"]*\")|(?:'.[^']*'))", Pattern.MULTILINE);
+    public static final Pattern ENCODING_PATTERN = Pattern.compile("^<\\?xml.*encoding[\\s]*=[\\s]*((?:\".[^\"]*\")|(?:'.[^']*'))", Pattern.MULTILINE);
 
     private static final String RAW_EX_1 = "Illegal encoding, BOM [{0}] XML guess [{1}] XML prolog [{2}] encoding mismatch";