MessageFormat.java (parse): When parsing strings, check for an empty pattern trailer.
authorZiga Mahkovec <ziga.mahkovec@klika.si>
Wed, 8 Jun 2005 15:46:08 +0000 (17:46 +0200)
committerZiga Mahkovec <ziga@gcc.gnu.org>
Wed, 8 Jun 2005 15:46:08 +0000 (15:46 +0000)
2005-06-08  Ziga Mahkovec  <ziga.mahkovec@klika.si>

* java/text/MessageFormat.java (parse): When parsing strings, check
for an empty pattern trailer.

From-SVN: r100761

libjava/ChangeLog
libjava/java/text/MessageFormat.java

index a5ad66c..043a517 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-08  Ziga Mahkovec  <ziga.mahkovec@klika.si>
+
+       * java/text/MessageFormat.java (parse): When parsing strings, check
+       for an empty pattern trailer.
+
 2005-06-06  Keith Seitz  <keiths@redhat.com>
 
        * gnu/classpath/jdwp/util/Signature.java: New file.
index 4a24afd..8d53ec2 100644 (file)
@@ -658,7 +658,11 @@ public class MessageFormat extends Format
          {
            // We have a String format.  This can lose in a number
            // of ways, but we give it a shot.
-           int next_index = sourceStr.indexOf(elements[i].trailer, index);
+           int next_index;
+           if (elements[i].trailer.length() > 0)
+             next_index = sourceStr.indexOf(elements[i].trailer, index);
+           else
+             next_index = sourceStr.length();
            if (next_index == -1)
              {
                pos.setErrorIndex(index);