summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog75
-rw-r--r--gnu/java/awt/ClasspathToolkit.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkToolkit.java2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkToolkit.h2
-rw-r--r--java/awt/EventQueue.java16
-rw-r--r--java/io/Externalizable.java2
-rw-r--r--java/io/Serializable.java1
-rw-r--r--java/net/URI.java49
-rw-r--r--java/rmi/server/RemoteObject.java2
-rw-r--r--java/rmi/server/RemoteRef.java2
-rw-r--r--java/rmi/server/ServerRef.java2
-rw-r--r--java/rmi/server/UID.java2
-rw-r--r--java/security/interfaces/DSAPrivateKey.java5
-rw-r--r--java/security/interfaces/DSAPublicKey.java5
-rw-r--r--java/security/interfaces/RSAMultiPrimePrivateCrtKey.java1
-rw-r--r--java/security/interfaces/RSAPrivateCrtKey.java2
-rw-r--r--java/security/interfaces/RSAPrivateKey.java2
-rw-r--r--java/security/interfaces/RSAPublicKey.java2
-rw-r--r--java/text/MessageFormat.java52
-rw-r--r--javax/crypto/SecretKey.java1
-rw-r--r--javax/imageio/metadata/IIOAttr.java378
-rw-r--r--javax/imageio/metadata/IIOMetadataNode.java549
-rw-r--r--javax/imageio/metadata/IIONamedNodeMap.java138
-rw-r--r--javax/imageio/metadata/IIONodeList.java72
-rw-r--r--javax/print/attribute/standard/Chromaticity.java86
-rw-r--r--javax/print/attribute/standard/Destination.java82
-rw-r--r--javax/swing/Timer.java17
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c7
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c48
-rwxr-xr-xscripts/check_jni_methods.sh7
30 files changed, 1553 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b705c8d3..834d75632 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,78 @@
+2005-01-18 Jeroen Frijters <jeroen@frijters.net>
+
+ * 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 <graydon@redhat.com>
+
+ * 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 <konqueror@gmx.de>
+
+ * include/gnu_java_awt_peer_gtk_GtkToolkit.h: Regenerated.
+
+2005-01-17 Tom Tromey <tromey@redhat.com>
+
+ * java/text/MessageFormat.java (scanString): Changed how quoting
+ is handled.
+ (scanFormatElement): Likewise.
+
+2005-01-17 Mark Wielaard <mark@klomp.org>
+
+ * scripts/check_jni_methods.sh: Don't use mktemp for TMPFILEs.
+
+2005-01-17 Michael Koch <konqueror@gmx.de>
+
+ 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 <konqueror@gmx.de>
+
+ * javax/print/attribute/standard/Chromaticity.java,
+ javax/print/attribute/standard/Destination.java:
+ New files.
+
+2005-01-17 Jerry Quinn <jlquinn@optonline.net>
+
+ * 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 <gnu_andrew@member.fsf.org>
* java/util/IdentityHashMap.java:
diff --git a/gnu/java/awt/ClasspathToolkit.java b/gnu/java/awt/ClasspathToolkit.java
index b26a640c2..b54e21948 100644
--- a/gnu/java/awt/ClasspathToolkit.java
+++ b/gnu/java/awt/ClasspathToolkit.java
@@ -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);
}
diff --git a/gnu/java/awt/peer/gtk/GtkToolkit.java b/gnu/java/awt/peer/gtk/GtkToolkit.java
index 55496496e..28715d7cf 100644
--- a/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ b/gnu/java/awt/peer/gtk/GtkToolkit.java
@@ -656,6 +656,6 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public native boolean nativeQueueEmpty();
public native void wakeNativeQueue();
- public native void iterateNativeQueue(EventQueue locked);
+ public native void iterateNativeQueue(EventQueue locked, boolean block);
} // class GtkToolkit
diff --git a/include/gnu_java_awt_peer_gtk_GtkToolkit.h b/include/gnu_java_awt_peer_gtk_GtkToolkit.h
index c3c078772..55febed56 100644
--- a/include/gnu_java_awt_peer_gtk_GtkToolkit.h
+++ b/include/gnu_java_awt_peer_gtk_GtkToolkit.h
@@ -18,7 +18,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env,
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
}
diff --git a/java/awt/EventQueue.java b/java/awt/EventQueue.java
index f6b4808c2..fc0926cce 100644
--- a/java/awt/EventQueue.java
+++ b/java/awt/EventQueue.java
@@ -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
{
diff --git a/java/io/Externalizable.java b/java/io/Externalizable.java
index 09080a058..71304e24a 100644
--- a/java/io/Externalizable.java
+++ b/java/io/Externalizable.java
@@ -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
diff --git a/java/io/Serializable.java b/java/io/Serializable.java
index b6c47c4cc..2afdff466 100644
--- a/java/io/Serializable.java
+++ b/java/io/Serializable.java
@@ -51,5 +51,4 @@ package java.io;
*/
public interface Serializable
{
- long serialVersionUID = 1196656838076753133L;
} // interface Serializable
diff --git a/java/net/URI.java b/java/net/URI.java
index 01381cd8a..4de5095bb 100644
--- a/java/net/URI.java
+++ b/java/net/URI.java
@@ -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 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 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 (ito.kazumitsu@hitachi-cable.co.jp)
* @author Dalibor Topic (robilad@kaffe.org)
@@ -64,6 +64,9 @@ public final class URI implements Comparable, Serializable
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 Comparable, Serializable
* 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 Comparable, Serializable
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 Comparable, Serializable
{
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 Comparable, Serializable
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);
diff --git a/java/rmi/server/RemoteObject.java b/java/rmi/server/RemoteObject.java
index 1bc7648c8..9c3422b6f 100644
--- a/java/rmi/server/RemoteObject.java
+++ b/java/rmi/server/RemoteObject.java
@@ -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;
diff --git a/java/rmi/server/RemoteRef.java b/java/rmi/server/RemoteRef.java
index a3f22c27a..89cee1256 100644
--- a/java/rmi/server/RemoteRef.java
+++ b/java/rmi/server/RemoteRef.java
@@ -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";
diff --git a/java/rmi/server/ServerRef.java b/java/rmi/server/ServerRef.java
index a6e986750..906b12698 100644
--- a/java/rmi/server/ServerRef.java
+++ b/java/rmi/server/ServerRef.java
@@ -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;
diff --git a/java/rmi/server/UID.java b/java/rmi/server/UID.java
index c6fd30e46..d472e69c9 100644
--- a/java/rmi/server/UID.java
+++ b/java/rmi/server/UID.java
@@ -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();
diff --git a/java/security/interfaces/DSAPrivateKey.java b/java/security/interfaces/DSAPrivateKey.java
index 4e6f13ddb..223db91e8 100644
--- a/java/security/interfaces/DSAPrivateKey.java
+++ b/java/security/interfaces/DSAPrivateKey.java
@@ -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();
diff --git a/java/security/interfaces/DSAPublicKey.java b/java/security/interfaces/DSAPublicKey.java
index aec1c606d..3f8d211d2 100644
--- a/java/security/interfaces/DSAPublicKey.java
+++ b/java/security/interfaces/DSAPublicKey.java
@@ -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();
diff --git a/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java b/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
index 7e115fabc..68a5e4488 100644
--- a/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
+++ b/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
@@ -54,6 +54,7 @@ public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey
{
// Constants
// --------------------------------------------------------------------------
+ long serialVersionUID = 618058533534628008L;
// Methods
// --------------------------------------------------------------------------
diff --git a/java/security/interfaces/RSAPrivateCrtKey.java b/java/security/interfaces/RSAPrivateCrtKey.java
index 8af1bb916..1fb2881ed 100644
--- a/java/security/interfaces/RSAPrivateCrtKey.java
+++ b/java/security/interfaces/RSAPrivateCrtKey.java
@@ -49,6 +49,8 @@ import java.math.BigInteger;
*/
public interface RSAPrivateCrtKey extends RSAPrivateKey
{
+ long serialVersionUID = -5682214253527700368L;
+
/**
* Returns the public exponent for this key
*
diff --git a/java/security/interfaces/RSAPrivateKey.java b/java/security/interfaces/RSAPrivateKey.java
index d287d6732..b4e342923 100644
--- a/java/security/interfaces/RSAPrivateKey.java
+++ b/java/security/interfaces/RSAPrivateKey.java
@@ -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
*
diff --git a/java/security/interfaces/RSAPublicKey.java b/java/security/interfaces/RSAPublicKey.java
index 22d64b1bb..9847ae9d2 100644
--- a/java/security/interfaces/RSAPublicKey.java
+++ b/java/security/interfaces/RSAPublicKey.java
@@ -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
*
diff --git a/java/text/MessageFormat.java b/java/text/MessageFormat.java
index 171fffe6d..a7484a727 100644
--- a/java/text/MessageFormat.java
+++ b/java/text/MessageFormat.java
@@ -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 Format
{
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 Format
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;
}
diff --git a/javax/crypto/SecretKey.java b/javax/crypto/SecretKey.java
index ce7057e70..3865db4a6 100644
--- a/javax/crypto/SecretKey.java
+++ b/javax/crypto/SecretKey.java
@@ -61,4 +61,5 @@ import java.security.Key;
*/
public interface SecretKey extends Key
{
+ long serialVersionUID = -4795878709595146952L;
}
diff --git a/javax/imageio/metadata/IIOAttr.java b/javax/imageio/metadata/IIOAttr.java
new file mode 100644
index 000000000..c041d396b
--- /dev/null
+++ b/javax/imageio/metadata/IIOAttr.java
@@ -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");
+ }
+}
diff --git a/javax/imageio/metadata/IIOMetadataNode.java b/javax/imageio/metadata/IIOMetadataNode.java
index 3d1c7d267..609db4d78 100644
--- a/javax/imageio/metadata/IIOMetadataNode.java
+++ b/javax/imageio/metadata/IIOMetadataNode.java
@@ -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");
+ }
}
diff --git a/javax/imageio/metadata/IIONamedNodeMap.java b/javax/imageio/metadata/IIONamedNodeMap.java
new file mode 100644
index 000000000..e549c1cf0
--- /dev/null
+++ b/javax/imageio/metadata/IIONamedNodeMap.java
@@ -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);
+ }
+
+}
diff --git a/javax/imageio/metadata/IIONodeList.java b/javax/imageio/metadata/IIONodeList.java
new file mode 100644
index 000000000..4ef7f4cbe
--- /dev/null
+++ b/javax/imageio/metadata/IIONodeList.java
@@ -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();
+ }
+
+}
diff --git a/javax/print/attribute/standard/Chromaticity.java b/javax/print/attribute/standard/Chromaticity.java
new file mode 100644
index 000000000..9d34863d4
--- /dev/null
+++ b/javax/print/attribute/standard/Chromaticity.java
@@ -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 (konqueror@gmx.de)
+ */
+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 <code>Chromaticity</code> object.
+ *
+ * @param value the enum value
+ */
+ protected Chromaticity(int value)
+ {
+ super(value);
+ }
+
+ /**
+ * Returns category of this class.
+ *
+ * @return the class <code>Sides</code> itself
+ */
+ public Class getCategory()
+ {
+ return Chromaticity.class;
+ }
+
+ /**
+ * Returns the name of this attribute.
+ *
+ * @return the name
+ */
+ public String getName()
+ {
+ return "chromaticity";
+ }
+}
diff --git a/javax/print/attribute/standard/Destination.java b/javax/print/attribute/standard/Destination.java
new file mode 100644
index 000000000..6d73bf10f
--- /dev/null
+++ b/javax/print/attribute/standard/Destination.java
@@ -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 (konqueror@gmx.de)
+ */
+public final class Destination extends URISyntax
+ implements PrintJobAttribute, PrintRequestAttribute
+{
+ private static final long serialVersionUID = 7923912792485606497L;
+
+ /**
+ * Constructs a <code>Destination</code> object.
+ */
+ public Destination(URI uri)
+ {
+ super(uri);
+ }
+
+ /**
+ * Returns category of this class.
+ *
+ * @return the class <code>Destination</code> itself
+ */
+ public Class getCategory()
+ {
+ return Destination.class;
+ }
+
+ /**
+ * Returns name of this class.
+ *
+ * @return the string "printer-uri"
+ */
+ public String getName()
+ {
+ return "destination";
+ }
+}
diff --git a/javax/swing/Timer.java b/javax/swing/Timer.java
index afdf4f32d..0906b8d93 100644
--- a/javax/swing/Timer.java
+++ b/javax/swing/Timer.java
@@ -72,6 +72,14 @@ public class Timer implements Serializable
/** DOCUMENT ME! */
private Waker waker;
+ private Runnable drainer = new Runnable()
+ {
+ public void run()
+ {
+ drainEvents();
+ }
+ };
+
/**
* DOCUMENT ME!
*/
@@ -81,14 +89,7 @@ public class Timer implements Serializable
{
queue++;
if (queue == 1)
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- drainEvents();
- }
- });
-
+ SwingUtilities.invokeLater(drainer);
}
}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
index 8eebce980..808d76b20 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
@@ -56,6 +56,13 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
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
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
index 6099303bb..59dc7c8ac 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
@@ -40,6 +40,8 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
#include "gthread-jni.h"
+#include <sys/time.h>
+
#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_iterateNativeQueue
* 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 ();
}
diff --git a/scripts/check_jni_methods.sh b/scripts/check_jni_methods.sh
index 6263cd9dd..5871853aa 100755
--- a/scripts/check_jni_methods.sh
+++ b/scripts/check_jni_methods.sh
@@ -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.