[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: awt, swing and text fixes

Kaffe CVS cvs-commits at kaffe.org
Sun Jul 3 07:19:50 PDT 2005


PatchSet 6684 
Date: 2005/07/03 14:14:53
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: awt, swing and text fixes

Members: 
	ChangeLog:1.4209->1.4210 
	libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.20->1.21 
	libraries/javalib/gnu/java/net/protocol/jar/Handler.java:INITIAL->1.9 
	libraries/javalib/java/text/DecimalFormat.java:1.35->1.36 
	libraries/javalib/javax/swing/JComponent.java:1.21->1.22 
	libraries/javalib/javax/swing/JScrollPane.java:1.10->1.11 
	libraries/javalib/javax/swing/text/InternationalFormatter.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4209 kaffe/ChangeLog:1.4210
--- kaffe/ChangeLog:1.4209	Sun Jul  3 13:58:06 2005
+++ kaffe/ChangeLog	Sun Jul  3 14:14:53 2005
@@ -2,6 +2,40 @@
 
 	Resynced with GNU Classpath.
 
+	2005-06-14  Mark Wielaard  <mark at klomp.org>
+
+        * javax/swing/JComponent.java (setMinimumSize): Only adjust
+        prefferedSize or maximumSize when they are set.
+        * javax/swing/JScrollPane.java (JScrollPane(Component,int,int)):
+        Set viewport and view manually.
+
+	2005-06-14  Ziga Mahkovec  <ziga.mahkovec at klika.si>
+
+        * gnu/java/awt/peer/gtk/GdkGraphics2D.java (updateBufferedImage):
+        Fixed pixelBuffer array index.
+
+	2005-06-14  Ziga Mahkovec  <ziga.mahkovec at klika.si>
+
+        Classpath bug #13353:
+        * gnu/java/net/protocol/jar/Handler.java (parseURL, toExternalForm):
+        Append fragments (#ref) to URLs.
+
+	2005-06-14  Mark Wielaard  <mark at klomp.org>
+
+        * javax/swing/text/InternationalFormatter.java (clone): Disabled.
+
+	2005-06-14  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * java/text/DecimalFormat.java
+        (DecimalFormat(String, DecimalFormatSymbols)): store clone of symbols;
+        (equals): add missing checks;
+        (getDecimalFormatSymbols): return clone of symbols;
+        (setDecimalFormatSymbols): store clone of symbols.
+
+2005-07-03  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-06-13  Ziga Mahkovec  <ziga.mahkovec at klika.si>
 
         * java/awt/image/SampleModel.java (getPixels): Fixed array
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.20 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.21
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.20	Sat Jun 11 22:04:54 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java	Sun Jul  3 14:14:55 2005
@@ -498,9 +498,10 @@
       {
         int height = bimage.getHeight();
         int width = bimage.getWidth();
+        int index = 0;
         for (int y = 0; y < height; ++y)
           for (int x = 0; x < width; ++x)
-            bimage.setRGB(x, y, pixelBuffer[y*width+height]);
+            bimage.setRGB(x, y, pixelBuffer[index++]);
       }
   }
 
===================================================================
Checking out kaffe/libraries/javalib/gnu/java/net/protocol/jar/Handler.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/java/net/protocol/jar/Handler.java,v
VERS: 1.9
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/java/net/protocol/jar/Handler.java	Sun Jul  3 14:19:50 2005
@@ -0,0 +1,173 @@
+/* gnu.java.net.protocol.jar.Handler - jar protocol handler for java.net
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.net.protocol.jar;
+
+import gnu.java.net.URLParseError;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+/**
+ * @author Kresten Krab Thorup (krab at gnu.org)
+ */
+public class Handler extends URLStreamHandler
+{
+  /**
+   * A do nothing constructor
+   */
+  public Handler()
+  {
+  }
+
+  /**
+   * This method returs a new JarURLConnection for the specified URL
+   *
+   * @param url The URL to return a connection for
+   *
+   * @return The URLConnection
+   *
+   * @exception IOException If an error occurs
+   */
+  protected URLConnection openConnection(URL url) throws IOException
+  {
+    return new Connection(url);
+  }
+
+  /**
+   * This method overrides URLStreamHandler's for parsing url of protocol "jar"
+   *
+   * @param url The URL object in which to store the results
+   * @param url_string The String-ized URL to parse
+   * @param start The position in the string to start scanning from
+   * @param end The position in the string to stop scanning
+   */
+  protected void parseURL (URL url, String url_string, int start, int end)
+  {
+    // This method does not throw an exception or return a value.  Thus our
+    // strategy when we encounter an error in parsing is to return without
+    // doing anything.
+    String file = url.getFile();
+    
+    if (!file.equals(""))
+      { //has context url
+	url_string = url_string.substring (start, end);
+        if (url_string.startsWith("/"))
+          { //url string is an absolute path
+            int idx = file.lastIndexOf ("!/");
+	    
+	    if (idx < 0)
+	      throw new URLParseError("no !/ in spec");
+	    
+	    file = file.substring (0, idx + 1) + url_string;
+          }
+        else if (url_string.length() > 0)
+          {
+            int idx = file.lastIndexOf ("/");
+            if (idx == -1) //context path is weird
+              file = "/" + url_string; 
+            else if (idx == (file.length() - 1))
+              //just concatenate two parts
+              file = file + url_string;
+            else
+              // according to Java API Documentation, here is a little different 
+              // with URLStreamHandler.parseURL
+              // but JDK seems doesn't handle it well
+              file = file.substring(0, idx + 1) + url_string;
+          }
+        
+        setURL (url, "jar", url.getHost(), url.getPort(), file, null);
+        return;
+      }
+
+    // Bunches of things should be true.  Make sure.
+    if (end < start)
+      return;
+    if (end - start < 2)
+      return;
+    if (start > url_string.length())
+      return;
+    
+    // Skip remains of protocol
+    url_string = url_string.substring (start, end);
+
+    int jar_stop;
+    if ((jar_stop = url_string.indexOf("!/")) < 0)
+      throw new URLParseError("no !/ in spec");
+
+    try
+      {
+	new URL(url_string.substring (0, jar_stop));
+      }
+    catch (MalformedURLException e)
+      {
+	throw new URLParseError("invalid inner URL: " + e.getMessage());
+      }
+    
+    if (!url.getProtocol().equals ("jar") )
+      throw new URLParseError("unexpected protocol " + url.getProtocol());
+        
+    setURL (url, "jar", url.getHost(), url.getPort(), url_string, null);
+  }
+
+  /**
+   * This method converts a Jar URL object into a String.
+   *
+   * @param url The URL object to convert
+   */
+  protected String toExternalForm (URL url)
+  {
+    String file = url.getFile();
+    String ref = url.getRef();
+
+    // return "jar:" + file;
+    // Performance!!: 
+    //  Do the concatenation manually to avoid resize StringBuffer's 
+    //  internal buffer.  The length of ref is not taken into consideration
+    //  as it's a rare path.
+    StringBuffer sb = new StringBuffer (file.length() + 5);
+    sb.append ("jar:");
+    sb.append (file);
+    if (ref != null)
+      sb.append('#').append(ref);
+    return sb.toString();
+  }
+}
Index: kaffe/libraries/javalib/java/text/DecimalFormat.java
diff -u kaffe/libraries/javalib/java/text/DecimalFormat.java:1.35 kaffe/libraries/javalib/java/text/DecimalFormat.java:1.36
--- kaffe/libraries/javalib/java/text/DecimalFormat.java:1.35	Sun May 15 17:05:23 2005
+++ kaffe/libraries/javalib/java/text/DecimalFormat.java	Sun Jul  3 14:14:56 2005
@@ -437,13 +437,9 @@
    * @throws NullPointerException if any argument is null.
    * @throws IllegalArgumentException if the pattern is invalid.
    */
-  public DecimalFormat (String pattern, DecimalFormatSymbols symbols)
+  public DecimalFormat(String pattern, DecimalFormatSymbols symbols)
   {
-    if (symbols == null)
-      {
-        throw new NullPointerException("Supplied set of symbols is null.");
-      }
-    this.symbols = symbols;
+    this.symbols = (DecimalFormatSymbols) symbols.clone();
     applyPattern(pattern);
   }
 
@@ -454,21 +450,39 @@
     return s1.equals(s2);
   }
 
-  public boolean equals (Object obj)
+  /**
+   * Tests this instance for equality with an arbitrary object.  This method
+   * returns <code>true</code> if:
+   * <ul>
+   * <li><code>obj</code> is not <code>null</code>;</li>
+   * <li><code>obj</code> is an instance of <code>DecimalFormat</code>;</li>
+   * <li>this instance and <code>obj</code> have the same attributes;</li>
+   * </ul>
+   * 
+   * @param obj  the object (<code>null</code> permitted).
+   * 
+   * @return A boolean.
+   */
+  public boolean equals(Object obj)
   {
     if (! (obj instanceof DecimalFormat))
       return false;
     DecimalFormat dup = (DecimalFormat) obj;
-    return (decimalSeparatorAlwaysShown == dup.decimalSeparatorAlwaysShown
-	    && groupingSize == dup.groupingSize
-	    && minExponentDigits == dup.minExponentDigits
-	    && multiplier == dup.multiplier
-	    && equals(negativePrefix, dup.negativePrefix)
-	    && equals(negativeSuffix, dup.negativeSuffix)
-	    && equals(positivePrefix, dup.positivePrefix)
-	    && equals(positiveSuffix, dup.positiveSuffix)
-	    && symbols.equals(dup.symbols)
-	    && useExponentialNotation == dup.useExponentialNotation);
+    return (decimalSeparatorAlwaysShown == dup.decimalSeparatorAlwaysShown 
+           && groupingUsed == dup.groupingUsed 
+           && groupingSize == dup.groupingSize 
+           && multiplier == dup.multiplier
+           && useExponentialNotation == dup.useExponentialNotation
+           && minExponentDigits == dup.minExponentDigits
+           && minimumIntegerDigits == dup.minimumIntegerDigits
+           && maximumIntegerDigits == dup.maximumIntegerDigits
+           && minimumFractionDigits == dup.minimumFractionDigits
+           && maximumFractionDigits == dup.maximumFractionDigits
+           && equals(negativePrefix, dup.negativePrefix)
+           && equals(negativeSuffix, dup.negativeSuffix)
+           && equals(positivePrefix, dup.positivePrefix)
+           && equals(positiveSuffix, dup.positiveSuffix)
+           && symbols.equals(dup.symbols));
   }
 
   private void formatInternal (double number, FormatBuffer dest,
@@ -784,9 +798,14 @@
     return symbols.getCurrency();
   }
 
-  public DecimalFormatSymbols getDecimalFormatSymbols ()
+  /**
+   * Returns a copy of the symbols used by this instance.
+   * 
+   * @return A copy of the symbols.
+   */
+  public DecimalFormatSymbols getDecimalFormatSymbols()
   {
-    return symbols;
+    return (DecimalFormatSymbols) symbols.clone();
   }
 
   public int getGroupingSize ()
@@ -1133,9 +1152,15 @@
     symbols.setCurrency(currency);
   }
 
-  public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
+  /**
+   * Sets the symbols used by this instance.  This method makes a copy of 
+   * the supplied symbols.
+   * 
+   * @param newSymbols  the symbols (<code>null</code> not permitted).
+   */
+  public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)
   {
-    symbols = newSymbols;
+    symbols = (DecimalFormatSymbols) newSymbols.clone();
   }
 
   public void setDecimalSeparatorAlwaysShown (boolean newValue)
Index: kaffe/libraries/javalib/javax/swing/JComponent.java
diff -u kaffe/libraries/javalib/javax/swing/JComponent.java:1.21 kaffe/libraries/javalib/javax/swing/JComponent.java:1.22
--- kaffe/libraries/javalib/javax/swing/JComponent.java:1.21	Sat Jun 11 21:43:17 2005
+++ kaffe/libraries/javalib/javax/swing/JComponent.java	Sun Jul  3 14:14:56 2005
@@ -2065,14 +2065,20 @@
     repaint();
 
     // adjust preferred and maximum size accordingly
-    Dimension prefSize = getPreferredSize();
-    prefSize.width = Math.max(prefSize.width, minimumSize.width);
-    prefSize.height = Math.max(prefSize.height, minimumSize.height);
-    setPreferredSize(prefSize);
-    Dimension maxSize = getMaximumSize();
-    maxSize.width = Math.max(maxSize.width, minimumSize.width);
-    maxSize.height = Math.max(maxSize.height, minimumSize.height);
-    setMaximumSize(maxSize);
+    if (preferredSize != null)
+      {
+	Dimension prefSize = getPreferredSize();
+	prefSize.width = Math.max(prefSize.width, minimumSize.width);
+	prefSize.height = Math.max(prefSize.height, minimumSize.height);
+	setPreferredSize(prefSize);
+      }
+    if (maximumSize != null)
+      {
+	Dimension maxSize = getMaximumSize();
+	maxSize.width = Math.max(maxSize.width, minimumSize.width);
+	maxSize.height = Math.max(maxSize.height, minimumSize.height);
+	setMaximumSize(maxSize);
+      }
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/JScrollPane.java
diff -u kaffe/libraries/javalib/javax/swing/JScrollPane.java:1.10 kaffe/libraries/javalib/javax/swing/JScrollPane.java:1.11
--- kaffe/libraries/javalib/javax/swing/JScrollPane.java:1.10	Mon May 30 01:27:47 2005
+++ kaffe/libraries/javalib/javax/swing/JScrollPane.java	Sun Jul  3 14:14:56 2005
@@ -588,7 +588,9 @@
     setVerticalScrollBar(createVerticalScrollBar());
     setHorizontalScrollBarPolicy(hsbPolicy);
     setHorizontalScrollBar(createHorizontalScrollBar());
-    setViewportView(view);
+    viewport = createViewport();
+    if (view != null)
+      viewport.setView(view);
     setLayout(new ScrollPaneLayout());
     setOpaque(false);
     updateUI();
Index: kaffe/libraries/javalib/javax/swing/text/InternationalFormatter.java
diff -u kaffe/libraries/javalib/javax/swing/text/InternationalFormatter.java:1.1 kaffe/libraries/javalib/javax/swing/text/InternationalFormatter.java:1.2
--- kaffe/libraries/javalib/javax/swing/text/InternationalFormatter.java:1.1	Sat Jun 11 22:56:07 2005
+++ kaffe/libraries/javalib/javax/swing/text/InternationalFormatter.java	Sun Jul  3 14:14:58 2005
@@ -326,7 +326,7 @@
    *
    * @throws CloneNotSupportedException not thrown here, since cloning is
    *     supported
-   */
+   * XXX - FIXME - Whole method disabled as workaround for gcj bug #22060.
   public Object clone()
     throws CloneNotSupportedException
   {
@@ -335,6 +335,7 @@
     Object clone = super.clone();
     return clone;
   }
+   */
 
   /**
    * Returns the Actions that are supported by this Formatter.




More information about the kaffe mailing list