As discussed on the gcj mailing list recently:

http://gcc.gnu.org/ml/java/2012-03/msg00048.html

I've added an implementation of java.util.regex.Matcher.usePattern(Pattern).
It was pretty simple, not more than a five minute job.

ChangeLog:

2012-03-22  Andrew John Hughes  <ahug...@redhat.com>

        * java/util/regex/Matcher.java:
        (usePattern(Pattern)): Implemented.

I've also synced in a number of fixes which were only committed to gcj and not
GNU Classpath that I found during the merge:

http://gcc.gnu.org/ml/java-patches/2012-q1/msg00063.html

2012-01-01  Jakub Jelinek  <ja...@redhat.com>

        * gnu/java/rmi/registry/RegistryImpl.java (version): Update
        copyright notice dates.
        * tools/gnu/classpath/tools/orbd/Main.java (run): Likewise.

2007-02-26  Jakub Jelinek  <ja...@redhat.com>

        * java/util/TimeZone.java (getDefaultDisplayName): Don't
        check if TimeZone is instanceof SimpleTimeZone.

2006-09-13  Andrew Haley  <a...@redhat.com>

        * java/util/PriorityQueue.java: Throw IllegalArgumentException for
        capacity < 1.
        (Iterator.remove()): Decrement index after removing element.

2007-02-14  Jakub Jelinek  <ja...@redhat.com>
        Andrew Haley  <a...@redhat.com>

        * java/util/TimeZone.java (getDateParams): Negate dayOfWeek.

All patches are attached and have been committed.
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07
commit 8d06dfcad3d15670c0b14a447ff93821a8f6e369
Author: Andrew Haley <a...@redhat.com>
Date:   Tue Apr 3 12:25:59 2012 +0100

    Negate dayOfWeek in java.util.TimeZone.getDateParams.
    
    2007-02-14  Jakub Jelinek  <ja...@redhat.com>
        Andrew Haley  <a...@redhat.com>
    
        * java/util/TimeZone.java (getDateParams): Negate dayOfWeek.
    
    Signed-off-by: Andrew John Hughes <ahug...@redhat.com>

diff --git a/ChangeLog b/ChangeLog
index 1711490..f8bfb96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-14  Jakub Jelinek  <ja...@redhat.com>
+       Andrew Haley  <a...@redhat.com>
+
+       * java/util/TimeZone.java (getDateParams): Negate dayOfWeek.
+
 2012-03-22  Andrew John Hughes  <ahug...@redhat.com>
 
        * java/util/regex/Matcher.java:
diff --git a/java/util/TimeZone.java b/java/util/TimeZone.java
index ce59c20..276602e 100644
--- a/java/util/TimeZone.java
+++ b/java/util/TimeZone.java
@@ -1151,18 +1151,30 @@ public abstract class TimeZone implements 
java.io.Serializable, Cloneable
         int day;
 
         // Month, week of month, day of week
+
+       // "Mm.w.d".  d is between 0 (Sunday) and 6.  Week w is
+       // between 1 and 5; Week 1 is the first week in which day d
+       // occurs and Week 5 specifies the last d day in the month.
+       // Month m is between 1 and 12.
+
         month = Integer.parseInt(date.substring(1, date.indexOf('.')));
         int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
                                                    date.lastIndexOf('.')));
         int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
                                                         + 1));
-        if (week == 5)
-          day = -1; // last day of month is -1 in java, 5 in TZ
-        else
-          // first day of week starting on or after.
-          day = (week - 1) * 7 + 1;
+       dayOfWeek++; // Java day of week is one-based, Sunday is first day.
+
+       if (week == 5)
+         day = -1; // last day of month is -1 in java, 5 in TZ
+       else
+         {
+           // First day of week starting on or after.  For example,
+           // to specify the second Sunday of April, set month to
+           // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
+           day = (week - 1) * 7 + 1;
+           dayOfWeek = -dayOfWeek;
+         }
 
-        dayOfWeek++; // Java day of week is one-based, Sunday is first day.
         month--; // Java month is zero-based.
         return new int[] { month, day, dayOfWeek };
       }
commit 7dbf9fc8c6b98137c4db3d8a6c63e5344746fefd
Author: Andrew Haley <a...@redhat.com>
Date:   Tue Apr 3 12:31:42 2012 +0100

    Decrement index when removing elements from PriorityQueue.  Catch capacity 
< 1.
    
    2006-09-13  Andrew Haley  <a...@redhat.com>
    
        * java/util/PriorityQueue.java: Throw IllegalArgumentException for
        capacity < 1.
        (Iterator.remove()): Decrement index after removing element.
    
    Signed-off-by: Andrew John Hughes <ahug...@redhat.com>

diff --git a/ChangeLog b/ChangeLog
index f8bfb96..f935a45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-13  Andrew Haley  <a...@redhat.com>
+
+       * java/util/PriorityQueue.java: Throw IllegalArgumentException for
+       capacity < 1.
+       (Iterator.remove()): Decrement index after removing element.
+
 2007-02-14  Jakub Jelinek  <ja...@redhat.com>
        Andrew Haley  <a...@redhat.com>
 
diff --git a/java/util/PriorityQueue.java b/java/util/PriorityQueue.java
index 470041e..e421418 100644
--- a/java/util/PriorityQueue.java
+++ b/java/util/PriorityQueue.java
@@ -108,6 +108,8 @@ public class PriorityQueue<E> extends AbstractQueue<E> 
implements Serializable
 
   public PriorityQueue(int cap, Comparator<? super E> comp)
   {
+    if (cap < 1)
+      throw new IllegalArgumentException();      
     this.used = 0;
     this.storage = (E[]) new Object[cap];
     this.comparator = comp;
@@ -170,6 +172,7 @@ public class PriorityQueue<E> extends AbstractQueue<E> 
implements Serializable
       public void remove()
       {
         PriorityQueue.this.remove(index);
+       index--;
       }
     };
   }
commit 9d9b5f5b0a9cc8607687fb484ca48cf990ad61db
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Apr 3 12:58:19 2012 +0100

    Don't check if TimeZone is an instance of SimpleTimeZone.
    
    2007-02-26  Jakub Jelinek  <ja...@redhat.com>
    
        * java/util/TimeZone.java (getDefaultDisplayName): Don't
        check if TimeZone is instanceof SimpleTimeZone.
    
    Signed-off-by: Andrew John Hughes <ahug...@redhat.com>

diff --git a/ChangeLog b/ChangeLog
index f935a45..ecec2e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-26  Jakub Jelinek  <ja...@redhat.com>
+
+       * java/util/TimeZone.java (getDefaultDisplayName): Don't
+       check if TimeZone is instanceof SimpleTimeZone.
+
 2006-09-13  Andrew Haley  <a...@redhat.com>
 
        * java/util/PriorityQueue.java: Throw IllegalArgumentException for
diff --git a/java/util/TimeZone.java b/java/util/TimeZone.java
index 276602e..8436440 100644
--- a/java/util/TimeZone.java
+++ b/java/util/TimeZone.java
@@ -1404,14 +1404,7 @@ public abstract class TimeZone implements 
java.io.Serializable, Cloneable
 
   private String getDefaultDisplayName(boolean dst)
   {
-    int offset = getRawOffset();
-    if (dst && this instanceof SimpleTimeZone)
-      {
-        // ugly, but this is a design failure of the API:
-        // getDisplayName takes a dst parameter even though
-        // TimeZone knows nothing about daylight saving offsets.
-        offset += ((SimpleTimeZone) this).getDSTSavings();
-      }
+    int offset = getRawOffset() + (dst ? getDSTSavings() : 0);
 
     CPStringBuilder sb = new CPStringBuilder(9);
     sb.append("GMT");
commit b89554548a07db1c0109ae5637907767d567d085
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Apr 3 13:33:10 2012 +0100

    Update copyright notices.
    
    2012-01-01  Jakub Jelinek  <ja...@redhat.com>
    
        * gnu/java/rmi/registry/RegistryImpl.java (version): Update
        copyright notice dates.
        * tools/gnu/classpath/tools/orbd/Main.java (run): Likewise.
    
    Signed-off-by: Andrew John Hughes <ahug...@redhat.com>

diff --git a/ChangeLog b/ChangeLog
index ecec2e9..c2f2a0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-01  Jakub Jelinek  <ja...@redhat.com>
+
+       * gnu/java/rmi/registry/RegistryImpl.java (version): Update
+       copyright notice dates.
+       * tools/gnu/classpath/tools/orbd/Main.java (run): Likewise.
+
 2007-02-26  Jakub Jelinek  <ja...@redhat.com>
 
        * java/util/TimeZone.java (getDefaultDisplayName): Don't
diff --git a/gnu/java/rmi/registry/RegistryImpl.java 
b/gnu/java/rmi/registry/RegistryImpl.java
index 51d49a4..c95a1e3 100644
--- a/gnu/java/rmi/registry/RegistryImpl.java
+++ b/gnu/java/rmi/registry/RegistryImpl.java
@@ -1,6 +1,6 @@
 /* RegistryImpl.java --
-   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
-   Free Software Foundation, Inc.
+   Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -111,7 +111,7 @@ public static void version() {
                            + System.getProperty("java.vm.name")
                            + ") "
                            + System.getProperty("java.vm.version"));
-        System.out.println("Copyright 2006 Free Software Foundation, Inc.");
+        System.out.println("Copyright 2012 Free Software Foundation, Inc.");
         System.out.println("This is free software; see the source for copying 
conditions.  There is NO");
         System.out.println("warranty; not even for MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE.");
         System.exit(0);
diff --git a/tools/gnu/classpath/tools/orbd/Main.java 
b/tools/gnu/classpath/tools/orbd/Main.java
index 52aa5bd..33de649 100644
--- a/tools/gnu/classpath/tools/orbd/Main.java
+++ b/tools/gnu/classpath/tools/orbd/Main.java
@@ -1,5 +1,6 @@
 /* NamingServicePersistent.java -- The persistent naming service.
-   Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2008, 2009, 2010, 2011, 2012
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -179,7 +180,7 @@ public class Main
         System.out.println("GNU Classpath persistent naming service "
                            + "started at " + iorr.Internet.host + ":"
                            + iorr.Internet.port + " key 'NameService'.\n\n"
-                           + "Copyright (C) 2008 Free Software Foundation\n"
+                           + "Copyright (C) 2012 Free Software Foundation\n"
                            + "This tool comes with ABSOLUTELY NO WARRANTY. "
                            + "This is free software, and you are\nwelcome to "
                            + "redistribute it under conditions, defined in "
diff --git a/java/util/regex/Matcher.java b/java/util/regex/Matcher.java
index 8d033d5..95a3553 100644
--- a/java/util/regex/Matcher.java
+++ b/java/util/regex/Matcher.java
@@ -103,6 +103,28 @@ public final class Matcher implements MatchResult
   }
 
   /**
+   * Changes the pattern used by the {@link Matcher} to
+   * the one specified.  Existing match information is lost,
+   * but the input and the matcher's position within it is
+   * retained.
+   *
+   * @param newPattern the new pattern to use.
+   * @return this matcher.
+   * @throws IllegalArgumentException if {@code newPattern} is
+   *                                  {@code null}.
+   * @since 1.5
+   */
+  public Matcher usePattern(Pattern newPattern)
+  {
+    if (newPattern == null)
+      throw new IllegalArgumentException("The new pattern was null.");
+    pattern = newPattern;
+    match = null;
+
+    return this;
+  }
+
+  /**
    * @param sb The target string buffer
    * @param replacement The replacement string
    *
@@ -620,7 +642,7 @@ public final class Matcher implements MatchResult
    *
    * @param s the string to literalize.
    * @return the literalized string.
-   * @since 1.5
+   * @since 1.5
    */
   public static String quoteReplacement(String s)
   {

Attachment: signature.asc
Description: Digital signature

Reply via email to