Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.2386.2.58 diff -u -3 -p -u -r1.2386.2.58 ChangeLog --- ChangeLog 17 Jan 2005 10:10:57 -0000 1.2386.2.58 +++ ChangeLog 18 Jan 2005 11:32:42 -0000 @@ -1,3 +1,78 @@ +2005-01-18 Jeroen Frijters + + * java/io/Externalizable.java, + java/io/Serializable.java + (serialVersionUID): Removed. + * java/rmi/server/RemoteObject.java, + java/rmi/server/UID.java + (serialVersionUID): Made private. + * java/rmi/server/RemoteRef.java, + java/rmi/server/ServerRef.java + (serialVersionUID): Set proper value. + * java/security/interfaces/DSAPrivateKey.java, + java/security/interfaces/DSAPublicKey.java, + java/security/interfaces/RSAMultiPrimePrivateCrtKey.java, + java/security/interfaces/RSAPrivateCrtKey.java, + java/security/interfaces/RSAPrivateKey.java, + java/security/interfaces/RSAPublicKey.java, + javax/crypto/SecretKey.java + (serialVersionUID): Added. + +2005-01-18 Graydon Hoare + + * gnu/java/awt/ClasspathToolkit.java: Likewise. + * gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise. + * java/awt/EventQueue.java (getNextEvent): + Adjust event loop to switch to native mode after 100ms. + * javax/swing/Timer.java (drainEvents): Reuse Runnable. + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c + (Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose): + Wake up event thread. + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c + (Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue): + Adjust event loop to switch to java mode after 100ms. + +2005-01-18 Michael Koch + + * include/gnu_java_awt_peer_gtk_GtkToolkit.h: Regenerated. + +2005-01-17 Tom Tromey + + * java/text/MessageFormat.java (scanString): Changed how quoting + is handled. + (scanFormatElement): Likewise. + +2005-01-17 Mark Wielaard + + * scripts/check_jni_methods.sh: Don't use mktemp for TMPFILEs. + +2005-01-17 Michael Koch + + PR libgcj/19444 + * java/net/URI.java + (AUTHORITY_REGEXP): New regexp constant. + (AUTHORITY_USERINFO_GROUP): New constant. + (AUTHORITY_HOST_GROUP): Likewise. + (AUTHORITY_PORT_GROUP): Likewise. + (port): Changed default value to -1. + (parseURI): Parse authority part and initialize host, + port and userInfo. + +2005-01-17 Michael Koch + + * javax/print/attribute/standard/Chromaticity.java, + javax/print/attribute/standard/Destination.java: + New files. + +2005-01-17 Jerry Quinn + + * javax/imageio/metadata/IIOMetadataNode.java: + Implemented. + * javax/imageio/metadata/IIOAttr.java, + javax/imageio/metadata/IIONamedNodeMap.java, + javax/imageio/metadata/IIONodeList.java: + New files + 2005-01-17 Andrew John Hughes * java/util/IdentityHashMap.java: Index: gnu/java/awt/ClasspathToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/ClasspathToolkit.java,v retrieving revision 1.3.2.2 diff -u -3 -p -u -r1.3.2.2 ClasspathToolkit.java --- gnu/java/awt/ClasspathToolkit.java 16 Jan 2005 15:15:01 -0000 1.3.2.2 +++ gnu/java/awt/ClasspathToolkit.java 18 Jan 2005 11:32:43 -0000 @@ -367,5 +367,5 @@ public abstract class ClasspathToolkit public abstract boolean nativeQueueEmpty(); public abstract void wakeNativeQueue(); - public abstract void iterateNativeQueue(EventQueue locked); + public abstract void iterateNativeQueue(EventQueue locked, boolean block); } Index: gnu/java/awt/peer/gtk/GtkToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.54.2.3 diff -u -3 -p -u -r1.54.2.3 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 16 Jan 2005 15:15:01 -0000 1.54.2.3 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 18 Jan 2005 11:32:46 -0000 @@ -656,6 +656,6 @@ public class GtkToolkit extends gnu.java public native boolean nativeQueueEmpty(); public native void wakeNativeQueue(); - public native void iterateNativeQueue(EventQueue locked); + public native void iterateNativeQueue(EventQueue locked, boolean block); } // class GtkToolkit Index: include/gnu_java_awt_peer_gtk_GtkToolkit.h =================================================================== RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h,v retrieving revision 1.6.2.1 diff -u -3 -p -u -r1.6.2.1 gnu_java_awt_peer_gtk_GtkToolkit.h --- include/gnu_java_awt_peer_gtk_GtkToolkit.h 16 Jan 2005 15:15:11 -0000 1.6.2.1 +++ include/gnu_java_awt_peer_gtk_GtkToolkit.h 18 Jan 2005 11:32:46 -0000 @@ -18,7 +18,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_loadSystemColors (JNIEnv *env, jobject, jintArray); JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue (JNIEnv *env, jobject); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue (JNIEnv *env, jobject, jobject); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue (JNIEnv *env, jobject, jobject, jboolean); #ifdef __cplusplus } Index: java/awt/EventQueue.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/EventQueue.java,v retrieving revision 1.17.2.2 diff -u -3 -p -u -r1.17.2.2 EventQueue.java --- java/awt/EventQueue.java 16 Jan 2005 15:15:11 -0000 1.17.2.2 +++ java/awt/EventQueue.java 18 Jan 2005 11:32:47 -0000 @@ -76,6 +76,9 @@ public class EventQueue private EventDispatchThread dispatchThread = new EventDispatchThread(this); private boolean shutdown = false; + private long lastNativeQueueAccess = 0; + private long humanLatencyThreshold = 100; + synchronized void setShutdown (boolean b) { shutdown = b; @@ -122,6 +125,16 @@ public class EventQueue { if (next != null) return next.getNextEvent(); + + ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit()); + long curr = System.currentTimeMillis(); + + if (! tk.nativeQueueEmpty() && + (curr - lastNativeQueueAccess > humanLatencyThreshold)) + { + tk.iterateNativeQueue(this, false); + lastNativeQueueAccess = curr; + } while (next_in == next_out) { @@ -143,7 +156,8 @@ public class EventQueue if (isShutdown()) throw new InterruptedException(); - ((ClasspathToolkit) Toolkit.getDefaultToolkit()).iterateNativeQueue(this); + tk.iterateNativeQueue(this, true); + lastNativeQueueAccess = System.currentTimeMillis(); } else { Index: java/io/Externalizable.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/io/Externalizable.java,v retrieving revision 1.12 diff -u -3 -p -u -r1.12 Externalizable.java --- java/io/Externalizable.java 12 Oct 2003 15:49:19 -0000 1.12 +++ java/io/Externalizable.java 18 Jan 2005 11:32:47 -0000 @@ -60,8 +60,6 @@ package java.io; */ public interface Externalizable extends Serializable { - long serialVersionUID = -282491828744381764L; - /** * This method restores an object's state by reading in the instance data * for the object from the passed in stream. Note that this stream is not Index: java/io/Serializable.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/io/Serializable.java,v retrieving revision 1.9 diff -u -3 -p -u -r1.9 Serializable.java --- java/io/Serializable.java 12 Oct 2003 15:49:20 -0000 1.9 +++ java/io/Serializable.java 18 Jan 2005 11:32:47 -0000 @@ -51,5 +51,4 @@ package java.io; */ public interface Serializable { - long serialVersionUID = 1196656838076753133L; } // interface Serializable Index: java/net/URI.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/URI.java,v retrieving revision 1.6.2.2 diff -u -3 -p -u -r1.6.2.2 URI.java --- java/net/URI.java 15 Jan 2005 17:01:56 -0000 1.6.2.2 +++ java/net/URI.java 18 Jan 2005 11:32:48 -0000 @@ -1,5 +1,5 @@ -/* URI.java - An URI class -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. +/* URI.java -- An URI class + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,6 +35,7 @@ this exception to your version of the li obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package java.net; import java.io.IOException; @@ -44,7 +45,6 @@ import java.io.Serializable; import java.util.regex.Matcher; import java.util.regex.Pattern; - /** * @author Ito Kazumitsu (address@hidden) * @author Dalibor Topic (address@hidden) @@ -64,6 +64,9 @@ public final class URI implements Compar private static final String URI_REGEXP = "^(([^:/?#]+):)?((//([^/?#]*))?([^?#]*)(\\?([^#]*))?)?(#(.*))?"; + private static final String AUTHORITY_REGEXP = + "^(([^?#]*)@([^?#]*):([^?#]*))?"; + /** * Valid characters (taken from rfc2396) */ @@ -111,6 +114,11 @@ public final class URI implements Compar * Index of fragment component in parsed URI. */ private static final int FRAGMENT_GROUP = 10; + + private static final int AUTHORITY_USERINFO_GROUP = 2; + private static final int AUTHORITY_HOST_GROUP = 3; + private static final int AUTHORITY_PORT_GROUP = 4; + private transient String scheme; private transient String rawSchemeSpecificPart; private transient String schemeSpecificPart; @@ -120,7 +128,7 @@ public final class URI implements Compar private transient String userInfo; private transient String rawHost; private transient String host; - private transient int port; + private transient int port = -1; private transient String rawPath; private transient String path; private transient String rawQuery; @@ -168,6 +176,7 @@ public final class URI implements Compar { Pattern pattern = Pattern.compile(URI_REGEXP); Matcher matcher = pattern.matcher(str); + if (matcher.matches()) { scheme = getURIGroup(matcher, SCHEME_GROUP); @@ -180,10 +189,42 @@ public final class URI implements Compar else throw new URISyntaxException(str, "doesn't match URI regular expression"); + if (rawAuthority != null) + { + pattern = Pattern.compile(AUTHORITY_REGEXP); + matcher = pattern.matcher(rawAuthority); + + if (matcher.matches()) + { + rawUserInfo = getURIGroup(matcher, AUTHORITY_USERINFO_GROUP); + rawHost = getURIGroup(matcher, AUTHORITY_HOST_GROUP); + + String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP); + + if (portStr != null) + try + { + port = Integer.parseInt(portStr); + } + catch (NumberFormatException e) + { + URISyntaxException use = + new URISyntaxException + (str, "doesn't match URI regular expression"); + use.initCause(e); + throw use; + } + } + else + throw new URISyntaxException(str, "doesn't match URI regular expression"); + } + // We must eagerly unquote the parts, because this is the only time // we may throw an exception. schemeSpecificPart = unquote(rawSchemeSpecificPart); authority = unquote(rawAuthority); + userInfo = unquote(rawUserInfo); + host = unquote(rawHost); path = unquote(rawPath); query = unquote(rawQuery); fragment = unquote(rawFragment); Index: java/rmi/server/RemoteObject.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/rmi/server/RemoteObject.java,v retrieving revision 1.4.2.1 diff -u -3 -p -u -r1.4.2.1 RemoteObject.java --- java/rmi/server/RemoteObject.java 15 Jan 2005 17:02:04 -0000 1.4.2.1 +++ java/rmi/server/RemoteObject.java 18 Jan 2005 11:32:49 -0000 @@ -49,7 +49,7 @@ import java.rmi.UnmarshalException; public abstract class RemoteObject implements Remote, Serializable { -public static final long serialVersionUID = -3215090123894869218l; +private static final long serialVersionUID = -3215090123894869218l; protected transient RemoteRef ref; Index: java/rmi/server/RemoteRef.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/rmi/server/RemoteRef.java,v retrieving revision 1.4.2.1 diff -u -3 -p -u -r1.4.2.1 RemoteRef.java --- java/rmi/server/RemoteRef.java 15 Jan 2005 17:02:04 -0000 1.4.2.1 +++ java/rmi/server/RemoteRef.java 18 Jan 2005 11:32:49 -0000 @@ -46,7 +46,7 @@ import java.rmi.RemoteException; public interface RemoteRef extends Externalizable { - long serialVersionUID = 0; + long serialVersionUID = 3632638527362204081L; String packagePrefix = "gnu.java.rmi.server"; Index: java/rmi/server/ServerRef.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/rmi/server/ServerRef.java,v retrieving revision 1.3.2.1 diff -u -3 -p -u -r1.3.2.1 ServerRef.java --- java/rmi/server/ServerRef.java 15 Jan 2005 17:02:05 -0000 1.3.2.1 +++ java/rmi/server/ServerRef.java 18 Jan 2005 11:32:49 -0000 @@ -43,7 +43,7 @@ import java.rmi.RemoteException; public interface ServerRef extends RemoteRef { - long serialVersionUID = 0; + long serialVersionUID = -4557750989390278438L; RemoteStub exportObject(Remote obj, Object data) throws RemoteException; Index: java/rmi/server/UID.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/rmi/server/UID.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 UID.java --- java/rmi/server/UID.java 15 Jan 2005 17:02:05 -0000 1.2.2.2 +++ java/rmi/server/UID.java 18 Jan 2005 11:32:49 -0000 @@ -45,7 +45,7 @@ import java.io.Serializable; public final class UID implements Serializable { -public static final long serialVersionUID = 1086053664494604050L; +private static final long serialVersionUID = 1086053664494604050L; private static final Object lock = UID.class; private static long baseTime = System.currentTimeMillis(); Index: java/security/interfaces/DSAPrivateKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/DSAPrivateKey.java,v retrieving revision 1.6 diff -u -3 -p -u -r1.6 DSAPrivateKey.java --- java/security/interfaces/DSAPrivateKey.java 23 Apr 2004 18:14:04 -0000 1.6 +++ java/security/interfaces/DSAPrivateKey.java 18 Jan 2005 11:32:49 -0000 @@ -50,6 +50,11 @@ import java.security.PrivateKey; public interface DSAPrivateKey extends DSAKey, PrivateKey { /** + * The version identifier used for serialization. + */ + long serialVersionUID = 7776497482533790279L; + + /** * This method returns the value of the DSA private key */ BigInteger getX(); Index: java/security/interfaces/DSAPublicKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/DSAPublicKey.java,v retrieving revision 1.6 diff -u -3 -p -u -r1.6 DSAPublicKey.java --- java/security/interfaces/DSAPublicKey.java 23 Apr 2004 18:14:04 -0000 1.6 +++ java/security/interfaces/DSAPublicKey.java 18 Jan 2005 11:32:49 -0000 @@ -50,6 +50,11 @@ import java.security.PublicKey; public interface DSAPublicKey extends DSAKey, PublicKey { /** + * The version identifier used for serialization. + */ + long serialVersionUID = 1234526332779022332L; + + /** * This method returns the value of the DSA public key */ BigInteger getY(); Index: java/security/interfaces/RSAMultiPrimePrivateCrtKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java,v retrieving revision 1.1 diff -u -3 -p -u -r1.1 RSAMultiPrimePrivateCrtKey.java --- java/security/interfaces/RSAMultiPrimePrivateCrtKey.java 9 Mar 2003 07:00:46 -0000 1.1 +++ java/security/interfaces/RSAMultiPrimePrivateCrtKey.java 18 Jan 2005 11:32:49 -0000 @@ -54,6 +54,7 @@ public interface RSAMultiPrimePrivateCrt { // Constants // -------------------------------------------------------------------------- + long serialVersionUID = 618058533534628008L; // Methods // -------------------------------------------------------------------------- Index: java/security/interfaces/RSAPrivateCrtKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/RSAPrivateCrtKey.java,v retrieving revision 1.5 diff -u -3 -p -u -r1.5 RSAPrivateCrtKey.java --- java/security/interfaces/RSAPrivateCrtKey.java 12 Oct 2003 15:53:15 -0000 1.5 +++ java/security/interfaces/RSAPrivateCrtKey.java 18 Jan 2005 11:32:49 -0000 @@ -49,6 +49,8 @@ import java.math.BigInteger; */ public interface RSAPrivateCrtKey extends RSAPrivateKey { + long serialVersionUID = -5682214253527700368L; + /** * Returns the public exponent for this key * Index: java/security/interfaces/RSAPrivateKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/RSAPrivateKey.java,v retrieving revision 1.7 diff -u -3 -p -u -r1.7 RSAPrivateKey.java --- java/security/interfaces/RSAPrivateKey.java 23 Apr 2004 18:14:04 -0000 1.7 +++ java/security/interfaces/RSAPrivateKey.java 18 Jan 2005 11:32:49 -0000 @@ -49,6 +49,8 @@ import java.security.PrivateKey; */ public interface RSAPrivateKey extends PrivateKey, RSAKey { + long serialVersionUID = 5187144804936595022L; + /** * Returns the private exponent value for this key * Index: java/security/interfaces/RSAPublicKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/security/interfaces/RSAPublicKey.java,v retrieving revision 1.7 diff -u -3 -p -u -r1.7 RSAPublicKey.java --- java/security/interfaces/RSAPublicKey.java 23 Apr 2004 18:14:04 -0000 1.7 +++ java/security/interfaces/RSAPublicKey.java 18 Jan 2005 11:32:49 -0000 @@ -49,6 +49,8 @@ import java.security.PublicKey; */ public interface RSAPublicKey extends PublicKey, RSAKey { + long serialVersionUID = -8727434096241101194L; + /** * Returns the public exponent value for this key * Index: java/text/MessageFormat.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/text/MessageFormat.java,v retrieving revision 1.11.2.4 diff -u -3 -p -u -r1.11.2.4 MessageFormat.java --- java/text/MessageFormat.java 16 Jan 2005 15:15:12 -0000 1.11.2.4 +++ java/text/MessageFormat.java 18 Jan 2005 11:32:49 -0000 @@ -1,5 +1,5 @@ /* MessageFormat.java - Localized message formatting. - Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -193,27 +193,36 @@ public class MessageFormat extends Forma { int max = pat.length(); buffer.setLength(0); + boolean quoted = false; for (; index < max; ++index) { char c = pat.charAt(index); - if (c == '\'' && index + 2 < max && pat.charAt(index + 2) == '\'') + if (quoted) { - buffer.append(pat.charAt(index + 1)); - index += 2; + // In a quoted context, a single quote ends the quoting. + if (c == '\'') + quoted = false; + else + buffer.append(c); } - else if (c == '\'' && index + 1 < max - && pat.charAt(index + 1) == '\'') + // Check for '', which is a single quote. + else if (c == '\'' && index + 1 < max && pat.charAt(index + 1) == '\'') { buffer.append(c); ++index; } + else if (c == '\'') + { + // Start quoting. + quoted = true; + } else if (c == '{') break; - else if (c == '}') - throw new IllegalArgumentException("Found '}' without '{'"); else buffer.append(c); } + // Note that we explicitly allow an unterminated quote. This is + // done for compatibility. return index; } @@ -225,39 +234,42 @@ public class MessageFormat extends Forma int max = pat.length(); buffer.setLength(0); int brace_depth = 1; + boolean quoted = false; for (; index < max; ++index) { char c = pat.charAt(index); - if (c == '\'' && index + 2 < max && pat.charAt(index + 2) == '\'') + // First see if we should turn off quoting. + if (quoted) { - buffer.append(c); - buffer.append(pat.charAt(index + 1)); - buffer.append(c); - index += 2; + if (c == '\'') + quoted = false; + // In both cases we fall through to inserting the + // character here. } + // See if we have just a plain quote to insert. else if (c == '\'' && index + 1 < max && pat.charAt(index + 1) == '\'') { buffer.append(c); ++index; } + // See if quoting should turn on. + else if (c == '\'') + quoted = true; else if (c == '{') - { - buffer.append(c); - ++brace_depth; - } + ++brace_depth; else if (c == '}') { if (--brace_depth == 0) break; - buffer.append(c); } // Check for TERM after braces, because TERM might be `}'. else if (c == term) break; - else - buffer.append(c); + // All characters, including opening and closing quotes, are + // inserted here. + buffer.append(c); } return index; } Index: javax/crypto/SecretKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/crypto/SecretKey.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 SecretKey.java --- javax/crypto/SecretKey.java 15 Jan 2005 17:02:16 -0000 1.2.2.2 +++ javax/crypto/SecretKey.java 18 Jan 2005 11:32:49 -0000 @@ -61,4 +61,5 @@ import java.security.Key; */ public interface SecretKey extends Key { + long serialVersionUID = -4795878709595146952L; } Index: javax/imageio/metadata/IIOAttr.java =================================================================== RCS file: javax/imageio/metadata/IIOAttr.java diff -N javax/imageio/metadata/IIOAttr.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/imageio/metadata/IIOAttr.java 18 Jan 2005 11:32:49 -0000 @@ -0,0 +1,378 @@ +/* IIOAttr.java -- + Copyright (C) 2004, 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 javax.imageio.metadata; + +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.TypeInfo; +import org.w3c.dom.UserDataHandler; + +/** + * Simple Attr node for metadata trees + * + * @author jlquinn + */ +class IIOAttr implements Attr +{ + String name; + String value; + IIOMetadataNode owner; + + public IIOAttr(String name, String value, IIOMetadataNode owner) + { + this.name = name; + this.value = value; + this.owner = owner; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Attr#getName() + */ + public String getName() + { + return name; + } + + public TypeInfo getSchemaTypeInfo() + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Attr#getSpecified() + */ + public boolean getSpecified() + { + // I don't think there can be default attrs in metadata + return true; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Attr#getValue() + */ + public String getValue() + { + return value; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Attr#setValue(java.lang.String) + */ + public void setValue(String value) throws DOMException + { + this.value = value; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Attr#getOwnerElement() + */ + public Element getOwnerElement() + { + return owner; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeName() + */ + public String getNodeName() + { + return name; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeValue() + */ + public String getNodeValue() throws DOMException + { + return value; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#setNodeValue(java.lang.String) + */ + public void setNodeValue(String nodeValue) throws DOMException + { + this.value = nodeValue; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeType() + */ + public short getNodeType() + { + return ATTRIBUTE_NODE; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getParentNode() + */ + public Node getParentNode() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getChildNodes() + */ + public NodeList getChildNodes() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getFirstChild() + */ + public Node getFirstChild() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getLastChild() + */ + public Node getLastChild() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getPreviousSibling() + */ + public Node getPreviousSibling() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNextSibling() + */ + public Node getNextSibling() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getAttributes() + */ + public NamedNodeMap getAttributes() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getOwnerDocument() + */ + public Document getOwnerDocument() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) + */ + public Node insertBefore(Node newChild, Node refChild) throws DOMException + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) + */ + public Node replaceChild(Node newChild, Node oldChild) throws DOMException + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node) + */ + public Node removeChild(Node oldChild) throws DOMException + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node) + */ + public Node appendChild(Node newChild) throws DOMException + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#hasChildNodes() + */ + public boolean hasChildNodes() + { + return false; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#cloneNode(boolean) + */ + public Node cloneNode(boolean deep) + { + return new IIOAttr(name, value, owner); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#normalize() + */ + public void normalize() + { + } + + public boolean isDefaultNamespace(String namespaceURI) + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String) + */ + public boolean isSupported(String feature, String version) + { + return false; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNamespaceURI() + */ + public String getNamespaceURI() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getPrefix() + */ + public String getPrefix() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#setPrefix(java.lang.String) + */ + public void setPrefix(String prefix) throws DOMException + { + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getLocalName() + */ + public String getLocalName() + { + return name; + } + + public Object getUserData(String key) + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#hasAttributes() + */ + public boolean hasAttributes() + { + return false; + } + + public boolean isId() + { + throw new Error("not implemented"); + } + + public String lookupNamespaceURI(String prefix) + { + throw new Error("not implemented"); + } + + public String lookupPrefix(String namespaceURI) + { + throw new Error("not implemented"); + } + + public Object setUserData(String key, Object data, UserDataHandler handler) + { + throw new Error("not implemented"); + } + + public String getBaseURI() + { + throw new Error("not implemented"); + } + + public String getTextContent() + { + throw new Error("not implemented"); + } + + public void setTextContent(String textContent) + { + throw new Error("not implemented"); + } + + public short compareDocumentPosition(Node other) + throws DOMException + { + throw new Error("not implemented"); + } + + public Object getFeature(String feature, String version) + { + throw new Error("not implemented"); + } + + public boolean isEqualNode(Node other) + { + throw new Error("not implemented"); + } + + public boolean isSameNode(Node other) + { + throw new Error("not implemented"); + } +} Index: javax/imageio/metadata/IIOMetadataNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/imageio/metadata/IIOMetadataNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 IIOMetadataNode.java --- javax/imageio/metadata/IIOMetadataNode.java 16 Jan 2005 02:45:18 -0000 1.1.2.1 +++ javax/imageio/metadata/IIOMetadataNode.java 18 Jan 2005 11:32:49 -0000 @@ -38,6 +38,555 @@ exception statement from your version. * package javax.imageio.metadata; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.TypeInfo; +import org.w3c.dom.UserDataHandler; + public class IIOMetadataNode + implements Element, NodeList { + private String name; + private HashMap attrs = new HashMap(); + private List children = new ArrayList(); + private IIOMetadataNode parent; + private Object obj; + + public IIOMetadataNode() + { + // Do nothing here. + } + + public IIOMetadataNode(String nodename) + { + name = nodename; + } + + public Object getUserObject() + { + return obj; + } + + public void setUserObject(Object o) + { + obj = o; + } + + public short compareDocumentPosition(Node other) + throws DOMException + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getAttribute(java.lang.String) + */ + public String getAttribute(String name) + { + Attr anode = (Attr) attrs.get(name); + return anode != null ? anode.getValue() : null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getAttributeNode(java.lang.String) + */ + public Attr getAttributeNode(String name) + { + String val = getAttribute(name); + if (val != null) + return new IIOAttr(name, val, this); + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String) + */ + public Attr getAttributeNodeNS(String namespaceURI, String localName) + { + return getAttributeNode(localName); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String) + */ + public String getAttributeNS(String namespaceURI, String localName) + { + return getAttribute(localName); + } + + public String getBaseURI() + { + throw new Error("not implemented"); + } + + // Recursive function for assembling a node list. + private void getElementsRecurse(IIONodeList list, String name) + { + for (int i=0; i < children.size(); i++) + { + if (((Node)children.get(i)).getNodeName().equals(name)) + list.children.add(children.get(i)); + getElementsRecurse(list, name); + } + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String) + */ + public NodeList getElementsByTagName(String name) + { + IIONodeList list = new IIONodeList(); + getElementsRecurse(list, name); + return list; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String) + */ + public NodeList getElementsByTagNameNS(String namespaceURI, String localName) + { + IIONodeList list = new IIONodeList(); + getElementsRecurse(list, name); + return list; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#getTagName() + */ + public String getTagName() + { + return name; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#hasAttribute(java.lang.String) + */ + public boolean hasAttribute(String name) + { + return attrs.containsKey(name); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#hasAttributeNS(java.lang.String, java.lang.String) + */ + public boolean hasAttributeNS(String namespaceURI, String localName) + { + return attrs.containsKey(localName); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#removeAttribute(java.lang.String) + */ + public void removeAttribute(String name) + { + attrs.remove(name); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr) + */ + public Attr removeAttributeNode(Attr oldAttr) + { + return (Attr)attrs.remove(oldAttr.getName()); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String) + */ + public void removeAttributeNS(String namespaceURI, String localName) + { + removeAttribute(localName); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String) + */ + public void setAttribute(String name, String value) + { + Attr attr = (Attr) getAttributeNode(name); + if (attr != null) + attr.setValue(value); + else + attrs.put(name, new IIOAttr(name, value, this)); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr) + */ + public Attr setAttributeNode(Attr newAttr) + { + return (Attr)attrs.put(newAttr.getName(), newAttr); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr) + */ + public Attr setAttributeNodeNS(Attr newAttr) + { + return (Attr)attrs.put(newAttr.getName(), newAttr); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Element#setAttributeNS(java.lang.String, java.lang.String, java.lang.String) + */ + public void setAttributeNS(String namespaceURI, String qualifiedName, String value) + { + setAttribute(qualifiedName, value); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() + { + return children.size(); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) + { + if (index < children.size()) + return (Node)children.get(index); + else + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node) + */ + public Node appendChild(Node newChild) + { + if (newChild == null) + throw new IllegalArgumentException("Child node is null"); + + IIOMetadataNode child = (IIOMetadataNode) newChild; + + children.add(child); + child.parent = this; + return this; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#cloneNode(boolean) + */ + public Node cloneNode(boolean deep) + { + IIOMetadataNode newnode = new IIOMetadataNode(name); + newnode.parent = null; + newnode.obj = obj; + if (deep) + { + for (int i=0; i < children.size(); i++) + newnode.children.add(((Node)children.get(i)).cloneNode(deep)); + } + + // clone attrs + for (Iterator it = attrs.values().iterator(); it.hasNext();) + { + IIOAttr attr = (IIOAttr)it.next(); + newnode.attrs.put(attr.name, attr.cloneNode(deep)); + attr.owner = newnode; + } + + return newnode; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getAttributes() + */ + public NamedNodeMap getAttributes() + { + return new IIONamedNodeMap(attrs); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getChildNodes() + */ + public NodeList getChildNodes() + { + return this; + } + + public Object getFeature(String feature, String version) + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getFirstChild() + */ + public Node getFirstChild() + { + return (children.size() > 0) ? (Node)children.get(0) : null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getLastChild() + */ + public Node getLastChild() + { + return (children.size() > 0) ? (Node)children.get(children.size() - 1) + : null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getLocalName() + */ + public String getLocalName() + { + return name; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNamespaceURI() + */ + public String getNamespaceURI() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNextSibling() + */ + public Node getNextSibling() + { + // If this op needs to be faster, add links to prev and next nodes. + if (parent == null) return null; + int idx = parent.children.indexOf(this); + return (idx == parent.children.size() - 1) ? null + : (Node)parent.children.get(idx + 1); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeName() + */ + public String getNodeName() + { + return name; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeType() + */ + public short getNodeType() + { + return ELEMENT_NODE; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getNodeValue() + */ + public String getNodeValue() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getOwnerDocument() + */ + public Document getOwnerDocument() + { + // IOMetadataNodes have no owner + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getParentNode() + */ + public Node getParentNode() + { + return parent; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getPrefix() + */ + public String getPrefix() + { + return null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#getPreviousSibling() + */ + public Node getPreviousSibling() + { + // If this op needs to be faster, add links to prev and next nodes. + if (parent == null) return null; + int idx = parent.children.indexOf(this); + return (idx == 0) ? null + : (Node)parent.children.get(idx - 1); + } + + public TypeInfo getSchemaTypeInfo() + { + throw new Error("not implemented"); + } + + public String getTextContent() + throws DOMException + { + throw new Error("not implemented"); + } + + public Object getUserData(String key) + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#hasAttributes() + */ + public boolean hasAttributes() + { + return !attrs.isEmpty(); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#hasChildNodes() + */ + public boolean hasChildNodes() + { + return !children.isEmpty(); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) + */ + public Node insertBefore(Node newChild, Node refChild) + { + if (newChild == null) + throw new IllegalArgumentException(); + + int idx = children.indexOf(refChild); + if (idx == -1) + children.add(newChild); + else + children.add(idx, newChild); + ((IIOMetadataNode)newChild).parent = this; + + return newChild; + } + + public boolean isDefaultNamespace(String namespaceURI) + { + throw new Error("not implemented"); + } + + public boolean isEqualNode(Node arg) + { + throw new Error("not implemented"); + } + + public boolean isSameNode(Node other) + { + return this == other; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String) + */ + public boolean isSupported(String feature, String version) + { + // No DOM features are supported + return false; + } + + public String lookupNamespaceURI(String prefix) + { + throw new Error("not implemented"); + } + + public String lookupPrefix(String namespaceURI) + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#normalize() + */ + public void normalize() + { + // No text nodes so no action + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node) + */ + public Node removeChild(Node oldChild) + { + if (oldChild == null) + throw new IllegalArgumentException(); + children.remove(oldChild); + ((IIOMetadataNode)oldChild).parent = null; + + return oldChild; + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) + */ + public Node replaceChild(Node newChild, Node oldChild) + { + if (newChild == null) + throw new IllegalArgumentException(); + children.set(children.indexOf(oldChild), newChild); + ((IIOMetadataNode)oldChild).parent = null; + return oldChild; + } + + public void setIdAttribute(String name, boolean isId) + throws DOMException + { + throw new Error("not implemented"); + } + + public void setIdAttributeNode(Attr idAttr, boolean isId) + throws DOMException + { + throw new Error("not implemented"); + } + + public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) + throws DOMException + { + throw new Error("not implemented"); + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#setNodeValue(java.lang.String) + */ + public void setNodeValue(String nodeValue) throws DOMException + { + } + + /* (non-Javadoc) + * @see org.w3c.dom.Node#setPrefix(java.lang.String) + */ + public void setPrefix(String prefix) + { + } + + public void setTextContent(String textContent) + throws DOMException + { + throw new Error("not implemented"); + } + + public Object setUserData(String key, Object data, UserDataHandler handler) + { + throw new Error("not implemented"); + } } Index: javax/imageio/metadata/IIONamedNodeMap.java =================================================================== RCS file: javax/imageio/metadata/IIONamedNodeMap.java diff -N javax/imageio/metadata/IIONamedNodeMap.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/imageio/metadata/IIONamedNodeMap.java 18 Jan 2005 11:32:49 -0000 @@ -0,0 +1,138 @@ +/* IIONamedNodeMap.java -- + Copyright (C) 2004 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 javax.imageio.metadata; + +import java.util.HashMap; + +import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + +/** + * Simple NamedNodeMap class for IIOMetadataNode. + * + * @author jlquinn + */ +class IIONamedNodeMap implements NamedNodeMap +{ + HashMap attrs; + + /** + * @param attrs + * @param node + */ + public IIONamedNodeMap(HashMap attrs) + { + this.attrs = attrs; + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String) + */ + public Node getNamedItem(String name) + { + return (Node)attrs.get(name); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node) + */ + public Node setNamedItem(Node arg) throws DOMException + { + if (arg instanceof IIOAttr) + { + IIOAttr attr = (IIOAttr) arg; + // The only code that can successfully do this is in this package. + if (attr.owner != null) + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, ""); + return (Node)attrs.put(attr.name, attr); + } + // Anything else gets treated as an invalid op. + throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String) + */ + public Node removeNamedItem(String name) throws DOMException + { + return (Node)attrs.remove(name); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#item(int) + */ + public Node item(int index) + { + return (Node)attrs.values().toArray()[index]; + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#getLength() + */ + public int getLength() + { + return attrs.size(); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String) + */ + public Node getNamedItemNS(String namespaceURI, String localName) + { + return getNamedItem(localName); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node) + */ + public Node setNamedItemNS(Node arg) throws DOMException + { + return setNamedItem(arg); + } + + /* (non-Javadoc) + * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String) + */ + public Node removeNamedItemNS(String namespaceURI, String localName) + throws DOMException + { + return removeNamedItem(localName); + } + +} Index: javax/imageio/metadata/IIONodeList.java =================================================================== RCS file: javax/imageio/metadata/IIONodeList.java diff -N javax/imageio/metadata/IIONodeList.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/imageio/metadata/IIONodeList.java 18 Jan 2005 11:32:50 -0000 @@ -0,0 +1,72 @@ +/* IIOAttr.java -- + Copyright (C) 2004 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 javax.imageio.metadata; + +import java.util.ArrayList; +import java.util.List; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Simple NodeList implementation for IIOMetadataNode. + * + * @author jlquinn + * + */ +class IIONodeList implements NodeList +{ + List children = new ArrayList(); + + /* (non-Javadoc) + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) + { + return (index < children.size()) ? (Node)children.get(index) : null; + } + + /* (non-Javadoc) + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() + { + return children.size(); + } + +} Index: javax/print/attribute/standard/Chromaticity.java =================================================================== RCS file: javax/print/attribute/standard/Chromaticity.java diff -N javax/print/attribute/standard/Chromaticity.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/standard/Chromaticity.java 18 Jan 2005 11:32:50 -0000 @@ -0,0 +1,86 @@ +/* Chromaticity.java -- + Copyright (C) 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 javax.print.attribute.standard; + +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * @author Michael Koch (address@hidden) + */ +public final class Chromaticity extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = -6890309414893262822L; + + public static final Chromaticity MONOCHROME = new Chromaticity(0); + public static final Chromaticity COLOR = new Chromaticity(1); + + /** + * Creates a Chromaticity object. + * + * @param value the enum value + */ + protected Chromaticity(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return the class Sides itself + */ + public Class getCategory() + { + return Chromaticity.class; + } + + /** + * Returns the name of this attribute. + * + * @return the name + */ + public String getName() + { + return "chromaticity"; + } +} Index: javax/print/attribute/standard/Destination.java =================================================================== RCS file: javax/print/attribute/standard/Destination.java diff -N javax/print/attribute/standard/Destination.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/standard/Destination.java 18 Jan 2005 11:32:50 -0000 @@ -0,0 +1,82 @@ +/* Destination.java -- + Copyright (C) 2004 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 javax.print.attribute.standard; + +import java.net.URI; + +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.URISyntax; + +/** + * @author Michael Koch (address@hidden) + */ +public final class Destination extends URISyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 7923912792485606497L; + + /** + * Constructs a Destination object. + */ + public Destination(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return the class Destination itself + */ + public Class getCategory() + { + return Destination.class; + } + + /** + * Returns name of this class. + * + * @return the string "printer-uri" + */ + public String getName() + { + return "destination"; + } +} Index: javax/swing/Timer.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/Timer.java,v retrieving revision 1.10.2.2 diff -u -3 -p -u -r1.10.2.2 Timer.java --- javax/swing/Timer.java 15 Jan 2005 17:02:20 -0000 1.10.2.2 +++ javax/swing/Timer.java 18 Jan 2005 11:32:51 -0000 @@ -72,6 +72,14 @@ public class Timer implements Serializab /** DOCUMENT ME! */ private Waker waker; + private Runnable drainer = new Runnable() + { + public void run() + { + drainEvents(); + } + }; + /** * DOCUMENT ME! */ @@ -81,14 +89,7 @@ public class Timer implements Serializab { queue++; if (queue == 1) - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - drainEvents(); - } - }); - + SwingUtilities.invokeLater(drainer); } } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 gnu_java_awt_peer_gtk_GtkGenericPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c 15 Jan 2005 17:02:22 -0000 1.1.2.2 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c 18 Jan 2005 11:32:52 -0000 @@ -56,6 +56,13 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPee gtk_widget_destroy (GTK_WIDGET (ptr)); gdk_threads_leave (); + + /* + * Wake up the main thread, to make sure it re-checks the window + * destruction condition. + */ + + g_main_context_wakeup (NULL); } JNIEXPORT void JNICALL Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,v retrieving revision 1.7.2.1 diff -u -3 -p -u -r1.7.2.1 gnu_java_awt_peer_gtk_GtkToolkit.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c 16 Jan 2005 15:15:14 -0000 1.7.2.1 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c 18 Jan 2005 11:32:52 -0000 @@ -40,6 +40,8 @@ exception statement from your version. * #include "gnu_java_awt_peer_gtk_GtkToolkit.h" #include "gthread-jni.h" +#include + #ifdef JVM_SUN struct state_table *native_state_table; struct state_table *native_global_ref_table; @@ -298,12 +300,27 @@ dpi_changed_cb (GtkSettings *settings, dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE); } +static int +within_human_latency_tolerance(struct timeval *init) +{ + struct timeval curr; + unsigned long milliseconds_elapsed; + + gettimeofday(&curr, NULL); + + milliseconds_elapsed = (((curr.tv_sec * 1000) + (curr.tv_usec / 1000)) + - ((init->tv_sec * 1000) + (init->tv_usec / 1000))); + + return milliseconds_elapsed < 100; +} + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue (JNIEnv *env, jobject self __attribute__((unused)), - jobject lockedQueue) + jobject lockedQueue, + jboolean block) { /* We're holding an EventQueue lock, and we're about to acquire the GDK * lock before dropping the EventQueue lock. This can deadlock if someone @@ -313,21 +330,30 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_it * acquiring the GDK lock and calling back into * EventQueue.getNextEvent(). */ + + struct timeval init; + gettimeofday(&init, NULL); + gdk_threads_enter (); (*env)->MonitorExit (env, lockedQueue); - /* It is quite important that this be a do .. while loop. The first pass - * should do an iteration w/o a test so that it sleeps when there really - * aren't any events; and the loop should continue for as many events as - * there are to avoid pointless thrashing up and down through JNI (it - * runs very slowly when this is not a loop). - */ - do + if (block) { - gtk_main_iteration(); + + /* If we're blocking-when-empty, we want a do .. while loop. */ + do + gtk_main_iteration (); + while (within_human_latency_tolerance (&init) + && gtk_events_pending ()); } - while (gtk_events_pending()); - + else + { + /* If we're not blocking-when-empty, we want a while loop. */ + while (within_human_latency_tolerance (&init) + && gtk_events_pending ()) + gtk_main_iteration (); + } + (*env)->MonitorEnter (env, lockedQueue); gdk_threads_leave (); } Index: scripts/check_jni_methods.sh =================================================================== RCS file: /cvsroot/classpath/classpath/scripts/check_jni_methods.sh,v retrieving revision 1.4.2.2 diff -u -3 -p -u -r1.4.2.2 check_jni_methods.sh --- scripts/check_jni_methods.sh 16 Jan 2005 15:15:15 -0000 1.4.2.2 +++ scripts/check_jni_methods.sh 18 Jan 2005 11:32:52 -0000 @@ -1,9 +1,8 @@ #!/bin/sh -pattern=/tmp/check-jni-methods.XXXXXX -TMPFILE=`mktemp $pattern` || { echo >&2 "$0: Unable to make temp file; aborting" ; exit 3; } -TMPFILE2=`mktemp $pattern` || { echo >&2 "$0: Unable to make temp file; aborting" ; exit 3; } -TMPFILE3=`mktemp $pattern` || { echo >&2 "$0: Unable to make temp file; aborting" ; exit 3; } +TMPFILE=check-jni-methods.$$.1 +TMPFILE2=check-jni-methods.$$.2 +TMPFILE3=check-jni-methods.$$.3 # Find all methods defined in the header files generated # from the java source files.