Imported GNU Classpath 0.92

2006-08-14  Mark Wielaard  <mark@klomp.org>

       Imported GNU Classpath 0.92
       * HACKING: Add more importing hints. Update automake version
       requirement.

       * configure.ac (gconf-peer): New enable AC argument.
       Add --disable-gconf-peer and --enable-default-preferences-peer
       to classpath configure when gconf is disabled.
       * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
       gnu/java/awt/dnd/peer/gtk to bc. Classify
       gnu/java/security/Configuration.java as generated source file.

       * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
       gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
       gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
       gnu/java/lang/management/VMThreadMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryMXBeanImpl.java,
       gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
       classes.
       * java/lang/management/VMManagementFactory.java: Likewise.
       * java/net/VMURLConnection.java: Likewise.
       * gnu/java/nio/VMChannel.java: Likewise.

       * java/lang/Thread.java (getState): Add stub implementation.
       * java/lang/Class.java (isEnum): Likewise.
       * java/lang/Class.h (isEnum): Likewise.

       * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.

       * javax/naming/spi/NamingManager.java: New override for StackWalker
       functionality.

       * configure, sources.am, Makefile.in, gcj/Makefile.in,
       include/Makefile.in, testsuite/Makefile.in: Regenerated.

From-SVN: r116139
This commit is contained in:
Mark Wielaard 2006-08-14 23:12:35 +00:00
parent abab460491
commit ac1ed908de
1294 changed files with 99479 additions and 35933 deletions

View file

@ -1,5 +1,5 @@
/* Arrays.java -- Utility class with methods to operate on arrays
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -97,7 +97,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final byte d = a[mid];
if (d == key)
return mid;
@ -131,7 +131,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final char d = a[mid];
if (d == key)
return mid;
@ -165,7 +165,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final short d = a[mid];
if (d == key)
return mid;
@ -199,7 +199,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final int d = a[mid];
if (d == key)
return mid;
@ -233,7 +233,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final long d = a[mid];
if (d == key)
return mid;
@ -268,7 +268,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final int r = Float.compare(a[mid], key);
if (r == 0)
return mid;
@ -303,7 +303,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final int r = Double.compare(a[mid], key);
if (r == 0)
return mid;
@ -369,7 +369,7 @@ public class Arrays
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >> 1;
mid = (low + hi) >>> 1;
final int d = Collections.compare(key, a[mid], c);
if (d == 0)
return mid;
@ -2341,8 +2341,10 @@ public class Arrays
* value modification. The returned list implements both Serializable and
* RandomAccess.
*
* @param a the array to return a view of
* @param a the array to return a view of (<code>null</code> not permitted)
* @return a fixed-size list, changes to which "write through" to the array
*
* @throws NullPointerException if <code>a</code> is <code>null</code>.
* @see Serializable
* @see RandomAccess
* @see Arrays.ArrayList

View file

@ -877,6 +877,7 @@ public abstract class Calendar implements Serializable, Cloneable
1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
0, 0, zone.getRawOffset(), 0
};
complete();
isTimeSet = false;
areFieldsSet = false;
isSet[field] = false;

View file

@ -1,5 +1,5 @@
/* Collections.java -- Utility class with methods to operate on collections
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -655,7 +655,7 @@ public class Collections
boolean forward = true;
while (low <= hi)
{
pos = (low + hi) >> 1;
pos = (low + hi) >>> 1;
if (i < pos)
{
if (!forward)
@ -684,7 +684,7 @@ public class Collections
{
while (low <= hi)
{
pos = (low + hi) >> 1;
pos = (low + hi) >>> 1;
final int d = compare(l.get(pos), key, c);
if (d == 0)
return pos;
@ -4817,6 +4817,87 @@ public class Collections
private static final class UnmodifiableEntrySet extends UnmodifiableSet
implements Serializable
{
// Unmodifiable implementation of Map.Entry used as return value for
// UnmodifiableEntrySet accessors (iterator, toArray, toArray(Object[]))
private static final class UnmodifiableMapEntry
implements Map.Entry
{
private final Map.Entry e;
private UnmodifiableMapEntry(Map.Entry e)
{
super();
this.e = e;
}
/**
* Returns <code>true</code> if the object, o, is also a map entry
* with an identical key and value.
*
* @param o the object to compare.
* @return <code>true</code> if o is an equivalent map entry.
*/
public boolean equals(Object o)
{
return e.equals(o);
}
/**
* Returns the key of this map entry.
*
* @return the key.
*/
public Object getKey()
{
return e.getKey();
}
/**
* Returns the value of this map entry.
*
* @return the value.
*/
public Object getValue()
{
return e.getValue();
}
/**
* Computes the hash code of this map entry. The computation is
* described in the <code>Map</code> interface documentation.
*
* @return the hash code of this entry.
* @see Map#hashCode()
*/
public int hashCode()
{
return e.hashCode();
}
/**
* Blocks the alteration of the value of this map entry. This method
* never returns, throwing an exception instead.
*
* @param value The new value.
* @throws UnsupportedOperationException as an unmodifiable map entry
* does not support the <code>setValue()</code> operation.
*/
public Object setValue(Object value)
{
throw new UnsupportedOperationException();
}
/**
* Returns a textual representation of the map entry.
*
* @return The map entry as a <code>String</code>.
*/
public String toString()
{
return e.toString();
}
}
/**
* Compatible with JDK 1.4.
*/
@ -4846,80 +4927,46 @@ public class Collections
public Object next()
{
final Map.Entry e = (Map.Entry) super.next();
return new Map.Entry()
{
/**
* Returns <code>true</code> if the object, o, is also a map entry with an
* identical key and value.
*
* @param o the object to compare.
* @return <code>true</code> if o is an equivalent map entry.
*/
public boolean equals(Object o)
{
return e.equals(o);
}
/**
* Returns the key of this map entry.
*
* @return the key.
*/
public Object getKey()
{
return e.getKey();
}
/**
* Returns the value of this map entry.
*
* @return the value.
*/
public Object getValue()
{
return e.getValue();
}
/**
* Computes the hash code of this map entry.
* The computation is described in the <code>Map</code>
* interface documentation.
*
* @return the hash code of this entry.
* @see Map#hashCode()
*/
public int hashCode()
{
return e.hashCode();
}
/**
* Blocks the alteration of the value of this map entry.
* This method never returns, throwing an exception instead.
*
* @param value The new value.
* @throws UnsupportedOperationException as an unmodifiable
* map entry does not support the <code>setValue()</code>
* operation.
*/
public Object setValue(Object value)
{
throw new UnsupportedOperationException();
}
/**
* Returns a textual representation of the map entry.
*
* @return The map entry as a <code>String</code>.
*/
public String toString()
{
return e.toString();
}
};
return new UnmodifiableMapEntry(e);
}
};
}
// The array returned is an array of UnmodifiableMapEntry instead of
// Map.Entry
public Object[] toArray()
{
Object[] mapEntryResult = super.toArray();
UnmodifiableMapEntry result[] = null;
if (mapEntryResult != null)
{
result = new UnmodifiableMapEntry[mapEntryResult.length];
for (int i = 0; i < mapEntryResult.length; i++)
{
Map.Entry r = (Map.Entry) mapEntryResult[i];
result[i] = new UnmodifiableMapEntry(r);
}
}
return result;
}
// The array returned is an array of UnmodifiableMapEntry instead of
// Map.Entry
public Object[] toArray(Object[] array)
{
super.toArray(array);
if (array != null)
{
for (int i = 0; i < array.length; i++)
{
array[i] = new UnmodifiableMapEntry((Map.Entry) array[i]);
}
}
return array;
}
} // class UnmodifiableEntrySet
/**

View file

@ -0,0 +1,88 @@
/* DuplicateFormatFlagsException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} contain duplicates.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class DuplicateFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 18890531L;
/**
* The flags which contain a duplicate.
*
* @serial the flags containing a duplicate.
*/
// Note: name fixed by serialization.
private String flags;
/**
* Constructs a new <code>DuplicateFormatFlagsException</code>
* which specifies that the supplied set of flags contains a
* duplicate.
*
* @param flags the flags containing a duplicate.
* @throws NullPointerException if <code>flags</code> is null.
*/
public DuplicateFormatFlagsException(String flags)
{
super("Duplicate flag passed in " + flags);
if (flags == null)
throw new
NullPointerException("Null flags value passed to constructor.");
this.flags = flags;
}
/**
* Returns the flags which contain a duplicate.
*
* @return the flags.
*/
public String getFlags()
{
return flags;
}
}

View file

@ -0,0 +1,111 @@
/* FormatFlagsConversionMismatchException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} contains a flag that does not match
* the conversion character specified for it.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class FormatFlagsConversionMismatchException
extends IllegalFormatException
{
private static final long serialVersionUID = 19120414L;
/**
* The mismatching flag.
*
* @serial the mismatching flag.
*/
// Note: name fixed by serialization.
private String f;
/**
* The conversion character which doesn't match the
* appropriate flag.
*
* @serial the conversion character which doesn't match its flag.
*/
// Note: name fixed by serialization.
private char c;
/**
* Constructs a new <code>FormatFlagsConversionMismatchException</code>
* which specifies that the flag, <code>f</code>, does
* not match its appropriate conversion character, <code>c</code>.
*
* @param f the mismatching flag.
* @param c the conversion character which doesn't match its flag.
* @throws NullPointerException if <code>f</code> is null.
*/
public FormatFlagsConversionMismatchException(String f, char c)
{
super("Invalid flag " + f + " for conversion " + c);
if (f == null)
throw new
NullPointerException("Null flag value passed to constructor.");
this.f = f;
this.c = c;
}
/**
* Returns the conversion character which doesn't
* match the flag.
*
* @return the conversion character.
*/
public char getConversion()
{
return c;
}
/**
* Returns the mismatching flag.
*
* @return the mismatching flag.
*/
public String getFlags()
{
return f;
}
}

View file

@ -0,0 +1,92 @@
/* Formattable.java -- Objects which can be passed to a Formatter
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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* <p>
* The <code>Formattable</code> interface is used to provide customised
* formatting to arbitrary objects via the {@link Formatter}. The
* {@link #formatTo} method is called for <code>Formattable</code>
* objects used with the 's' conversion operator, allowing the object
* to provide its own formatting of its internal data.
* </p>
* <p>
* Thread safety is left up to the implementing class. Thus,
* {@link Formattable} objects are not guaranteed to be thread-safe,
* and users should make their own provisions for multiple thread access.
* </p>
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public interface Formattable
{
/**
* Formats the object using the supplied formatter to the specification
* provided by the given flags, width and precision.
*
* @param formatter the formatter to use for formatting the object.
* The formatter gives access to the output stream
* and locale via {@link Formatter#out()} and
* {@link Formatter#locale()} respectively.
* @param flags a bit mask constructed from the flags in the
* {@link FormattableFlags} class. When no flags
* are set, the implementing class should use its
* defaults.
* @param width the minimum number of characters to include.
* A value of -1 indicates no minimum. The remaining
* space is padded with ' ' either on the left
* (the default) or right (if left justification is
* specified by the flags).
* @param precision the maximum number of characters to include.
* A value of -1 indicates no maximum. This value
* is applied prior to the minimum (the width). Thus,
* a value may meet the minimum width initially, but
* not when the width value is applied, due to
* characters being removed by the precision value.
* @throws IllegalFormatException if there is a problem with
* the syntax of the format
* specification or a mismatch
* between it and the arguments.
*/
public void formatTo(Formatter formatter, int flags, int width,
int precision);
}

View file

@ -0,0 +1,123 @@
/* FormattableFlags.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* This class contains a set of flags used
* by the {@link Formattable#formatTo()} method.
* They are used to modify the output of the
* {@link Formattable}. The interpretation and
* validation of the flags is left to the
* particular {@link Formattable}.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class FormattableFlags
{
/**
* Requires the output to be left-justified. Any spaces
* required to meet the specified width will be added to
* the right of the output. The default output is
* right-justified, where spaces are added to the left.
* The output is as for the format specifier
* '-' ('\u002d').
*/
public static final int LEFT_JUSTIFY = 1;
/**
* Requires the output to be in uppercase. The output
* should be the same as the result from calling
* {@link String#toUpperCase(java.util.Locale)} with
* the formatting locale. The output is as for the
* format specifier '^' ('\u005e').
*/
public static final int UPPERCASE = 2;
/**
* Requires the use of an alternate form, as specified
* in the documentation of {@link Formattable}.
* The output is as for the format specifier
* '#' ('\u0023').
*/
public static final int ALTERNATE = 4;
// Used internally by Formatter.
// Changes here must be reflected in the FLAGS string there.
/**
* Requires the output to always include a '+' sign.
* The output is as for the format specifier '+'.
*/
static final int PLUS = 8;
/**
* Requires the output to include a leading space on
* positive value. The output is as for the format
* specifier ' '.
*/
static final int SPACE = 16;
/**
* Requires the output to be zero-padded. The output
* is as for the format specifier '0'.
*/
static final int ZERO = 32;
/**
* Requires the output to include locale-specific
* grouping operators. The output is as for the
* format specifier ','.
*/
static final int COMMA = 64;
/**
* Requires the output to include negative numbers
* enclosed in parentheses. The output is as for
* the format specifier '('.
*/
static final int PAREN = 128;
// Not instantiable.
private FormattableFlags()
{
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,60 @@
/* FormatterClosedException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when a method is called on a {@link Formatter} but
* it has already been closed.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class FormatterClosedException
extends IllegalStateException
{
private static final long serialVersionUID = 18111216L;
/**
* Constructs a new <code>FormatterClosedException</code>.
*/
public FormatterClosedException()
{
}
}

View file

@ -445,7 +445,7 @@ public class GregorianCalendar extends Calendar
if (isSet[WEEK_OF_MONTH])
{
int weeks = (month == 1 && leap == 0) ? 4 : 5;
int weeks = (month == 1 && leap == 0) ? 5 : 6;
if (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > weeks)
throw new IllegalArgumentException("Illegal WEEK_OF_MONTH.");
}
@ -1164,7 +1164,7 @@ public class GregorianCalendar extends Calendar
*/
private static final int[] maximums =
{
AD, 5000000, 11, 53, 5, 31, 366,
AD, 5000000, 11, 53, 6, 31, 366,
SATURDAY, 5, PM, 12, 23, 59, 59, 999,
+(12 * 60 * 60 * 1000),
(12 * 60 * 60 * 1000)

View file

@ -0,0 +1,85 @@
/* IllegalFormatCodePointException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when a {@link Formatter} receives a character with an
* invalid Unicode codepoint, as defined by
* {@link Character#isValidCodePoint(int)}.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatCodePointException
extends IllegalFormatException
{
private static final long serialVersionUID = 19080630L;
/**
* The character which is an invalid Unicode code point.
*
* @serial the invalid character.
*/
// Note: name fixed by serialization.
int c;
/**
* Constructs a new <code>IllegalFormatCodePointException</code>
* which specifies that the character, <code>c</code>, passed to
* a {@link Formatter} is an invalid Unicode code point.
*
* @param c the invalid character.
*/
public IllegalFormatCodePointException(int c)
{
super("An invalid Unicode code point was supplied.");
this.c = c;
}
/**
* Returns the invalid character.
*
* @return the invalid character.
*/
public int getCodePoint()
{
return c;
}
}

View file

@ -0,0 +1,110 @@
/* IllegalFormatConversionException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the type of an argument supplied to the
* {@link Formatter#format()} method of a {@link Formatter}
* does not match the conversion character specified for it.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatConversionException
extends IllegalFormatException
{
private static final long serialVersionUID = 17000126L;
/**
* The conversion character which doesn't match
* the type of the argument.
*
* @serial the conversion character.
*/
// Note: name fixed by serialization.
char c;
/**
* The type of the mismatching argument.
*
* @serial the mismatching argument type.
*/
// Note: name fixed by serialization.
Class arg;
/**
* Constructs a new <code>IllegalFormatConversionException</code>
* which specifies that the argument of type <code>arg</code> does
* not match the conversion character, <code>c</code>.
*
* @param c the conversion character.
* @param arg the type which doesn't match the conversion character.
* @throws NullPointerException if <code>arg</code> is null.
*/
public IllegalFormatConversionException(char c, Class arg)
{
super("The type, " + arg + ", is invalid for the conversion character, " +
c + ".");
if (arg == null)
throw new NullPointerException("The supplied type was null.");
this.c = c;
this.arg = arg;
}
/**
* Returns the conversion character.
*
* @return the conversion character.
*/
public char getConversion()
{
return c;
}
/**
* Returns the type of the mismatched argument.
*
* @return the type of the mismatched argument.
*/
public Class getArgumentClass()
{
return arg;
}
}

View file

@ -0,0 +1,75 @@
/* IllegalFormatException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* A general exception thrown when a format string is supplied
* to a {@link Formatter} that contains either invalid syntax
* or a mismatch between the format specification and the
* supplied arguments. This class is never instantiated;
* instead one of its subclasses is used to throw a more
* specific exception.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatException
extends IllegalArgumentException
{
private static final long serialVersionUID = 18830826L;
/**
* Constructs a new <code>IllegalFormatException</code>.
*/
IllegalFormatException()
{
}
/**
* Constructs a new <code>IllegalFormatException</code>
* with the specified message.
*
* @param msg the error message for this exception.
*/
IllegalFormatException(String msg)
{
super(msg);
}
}

View file

@ -0,0 +1,86 @@
/* IllegalFormatFlagsException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} form an illegal combination.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 790824L;
/**
* The set of flags which forms an illegal combination.
*
* @serial the illegal set of flags.
*/
// Note: name fixed by serialization.
private String flags;
/**
* Constructs a new <code>IllegalFormatFlagsException</code>
* for the specified flags.
*
* @param flags the illegal set of flags.
* @throws NullPointerException if <code>flags</code> is null.
*/
public IllegalFormatFlagsException(String flags)
{
super("An illegal set of flags, " + flags + ", was supplied.");
if (flags == null)
throw new NullPointerException("The supplied flags are null.");
this.flags = flags;
}
/**
* Returns the illegal flags.
*
* @return the illegal flags.
*/
public String getFlags()
{
return flags;
}
}

View file

@ -0,0 +1,85 @@
/* IllegalFormatPrecisionException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the specified precision for a {@link Formatter}
* argument is illegal. This may be because the number is
* a negative number (other than -1), the argument does not
* accept a precision or for some other reason.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatPrecisionException
extends IllegalFormatException
{
private static final long serialVersionUID = 18711008L;
/**
* The illegal precision value.
*
* @serial the illegal precision.
*/
// Note: name fixed by serialization.
private int p;
/**
* Constructs a new <code>IllegalFormatPrecisionException</code>
* for the precision, <code>p</code>.
*
* @param p the illegal precision.
*/
public IllegalFormatPrecisionException(int p)
{
super("The precision, " + p + ", is illegal.");
this.p = p;
}
/**
* Returns the illegal precision.
*
* @return the illegal precision.
*/
public int getPrecision()
{
return p;
}
}

View file

@ -0,0 +1,84 @@
/* IllegalFormatWidthException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the specified width for a {@link Formatter}
* argument is illegal. This may be because the number is
* a negative number (other than -1) or for some other reason.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class IllegalFormatWidthException
extends IllegalFormatException
{
private static final long serialVersionUID = 16660902L;
/**
* The illegal width value.
*
* @serial the illegal width.
*/
// Note: name fixed by serialization.
private int w;
/**
* Constructs a new <code>IllegalFormatWidthException</code>
* with the specified width, <code>w</code>.
*
* @param w the illegal width.
*/
public IllegalFormatWidthException(int w)
{
super("The width, " + w + ", is illegal.");
this.w = w;
}
/**
* Returns the illegal width.
*
* @return the illegal width.
*/
public int getWidth()
{
return w;
}
}

View file

@ -0,0 +1,73 @@
/* InputMismatchException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when a {@link Scanner} instance encounters a mismatch
* between the input data and the pattern it is trying to match it
* against. This could be because the input data represents an
* out-of-range value for the type the pattern represents, or simply
* because the data does not fit that particular type.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class InputMismatchException
extends NoSuchElementException
{
/**
* Constructs a new <code>InputMismatchException</code>
* with a <code>null</code> message.
*/
public InputMismatchException()
{
}
/**
* Constructs a new <code>InputMismatchException</code>
* with the supplied error message.
*
* @param s the error message to report back to the user.
*/
public InputMismatchException(String s)
{
super(s);
}
}

View file

@ -0,0 +1,90 @@
/* MissingFormatArgumentException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the a format specification for a {@link Formatter}
* refers to an argument that is non-existent, or an argument index
* references a non-existent argument.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class MissingFormatArgumentException
extends IllegalFormatException
{
private static final long serialVersionUID = 19190115L;
/**
* The format specification which contains the
* unmatched argument.
*
* @serial the format specification.
*/
// Note: name fixed by serialization.
private String s;
/**
* Constructs a new <code>MissingFormatArgumentException</code>
* for a format specification, <code>s</code>, which refers
* to a non-existent argument.
*
* @param s the format specification.
* @throws NullPointerException if <code>s</code> is null.
*/
public MissingFormatArgumentException(String s)
{
super("The specification, " + s +
", refers to a non-existent argument.");
if (s == null)
throw new NullPointerException("The specification is null.");
this.s = s;
}
/**
* Returns the format specification.
*
* @return the format specification.
*/
public String getFormatSpecifier()
{
return s;
}
}

View file

@ -0,0 +1,88 @@
/* MissingFormatWidthException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when the a format specification for a {@link Formatter}
* does not include a width for a value where one is required.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class MissingFormatWidthException
extends IllegalFormatException
{
private static final long serialVersionUID = 15560123L;
/**
* The format specification which contains the
* unmatched argument.
*
* @serial the format specification.
*/
// Note: name fixed by serialization.
private String s;
/**
* Constructs a new <code>MissingFormatWidthException</code>
* for a format specification, <code>s</code>, which excludes
* a required width argument.
*
* @param s the format specification.
* @throws NullPointerException if <code>s</code> is null.
*/
public MissingFormatWidthException(String s)
{
super("The specification, " + s + ", misses a required width.");
if (s == null)
throw new NullPointerException("The specification is null.");
this.s = s;
}
/**
* Returns the format specification.
*
* @return the format specification.
*/
public String getFormatSpecifier()
{
return s;
}
}

View file

@ -0,0 +1,383 @@
/* UUID.java -- Class that represents a UUID object.
Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
import java.io.Serializable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* This class represents a 128-bit UUID value.
*
* There are several types of UUID, and while this class can be used to store
* them, only the Leach-Salz (variant 2) UUID specified in RFC-4122 will
* give meaningful results from the method calls.
* See: http://tools.ietf.org/html/4122 for the details
*
* The format of a Leach-Salz (variant 2) time-based (version 1) UUID
* is as follows:
* time_low - upper 32 bits of the most significant 64 bits,
* this is the least-significant part of the timestamp.
*
* time_mid - bits 16-31 of the most significant 64 bits,
* this is the middle portion of the timestamp.
*
* version - bits 8-15 of the most significant 64 bits.
*
* time_hi - bits 0-7 of the most significant 64 bits,
* the most significant portion of the timestamp.
*
* clock_and_reserved - bits 48-63 of the least significant 64 bits.
* a variable number of bits hold the variant
* (see the spec)
*
* node identifier - bits 0-47 of the least signficant 64 bits.
*
* These fields are valid only for version 1, in the remaining versions,
* only the version and variant fields are set, all others are used for data.
*
* @since 1.5
* @author Sven de Marothy
*/
public final class UUID
extends Object
implements Serializable, Comparable // genericizeme!
{
private static final long serialVersionUID = -4856846361193249489L;
/**
* Serialized field - most significant 64 bits.
*/
private long mostSigBits;
/**
* Serialized field - least significant 64 bits.
*/
private long leastSigBits;
/**
* Random-number generator.
*/
private static transient Random r = new Random();
/**
* Constructs a new UUID.
*
* @since 1.5
*/
public UUID(long mostSigBits, long leastSigBits)
{
this.mostSigBits = mostSigBits;
this.leastSigBits = leastSigBits;
}
/**
* Returns the clock-sequence value of this UUID.
* This field only exists in a time-based (version 1) UUID.
*
* @throws UnsupportedOperationException if the UUID type is not 1.
* @returns an int containing the clock-sequence value.
*/
public int clockSequence()
{
if( version() != 1 )
throw new UnsupportedOperationException("Not a type 1 UUID");
return (int)((leastSigBits & 0x3FFF000000000000L) >> 48);
}
/**
* Compare this UUID to another.
* The comparison is performed as between two 128-bit integers.
*
* @return -1 if this < val, 0 if they are equal, 1 if this > val.
*/
public int compareTo(Object val)
{
return compareTo((UUID)val);
}
/**
* Compare this UUID to another.
* The comparison is performed as between two 128-bit integers.
*
* @return -1 if this < val, 0 if they are equal, 1 if this > val.
*/
public int compareTo(UUID o)
{
if( mostSigBits < o.mostSigBits )
return -1;
if( mostSigBits > o.mostSigBits )
return 1;
if( leastSigBits < o.leastSigBits )
return -1;
if( leastSigBits > o.mostSigBits )
return 1;
return 0;
}
/**
* Compare a (UUID) object to this one
*/
public boolean equals(Object obj)
{
if( !(obj instanceof UUID ) )
return false;
return ( ((UUID)obj).mostSigBits == mostSigBits &&
((UUID)obj).leastSigBits == leastSigBits );
}
/**
* Creates a UUID object from a Sting representation.
*
* For the format of the string,
* @see #toString()
*
* @return a new UUID object.
*/
public static UUID fromString(String name)
{
StringTokenizer st = new StringTokenizer( name.trim(), "-" );
if( st.countTokens() < 5 )
throw new IllegalArgumentException( "Incorrect UUID string"+
" representation:"+name );
long msb = (Long.parseLong(st.nextToken(), 16) << 32); // time low
msb |= (Long.parseLong(st.nextToken(), 16) << 16); // time mid
msb |= Long.parseLong(st.nextToken(), 16); // time high
long lsb = (Long.parseLong(st.nextToken(), 16) << 48); // clock
lsb |= Long.parseLong(st.nextToken(), 16); // node
return new UUID(msb, lsb);
}
/**
* Returns a String representation of the UUID.
*
* The format of the standard string representation (given in RFC4122) is:
*
* time-low "-" time-mid "-"
* time-high-and-version "-"
* clock-seq-and-reserved
* clock-seq-low "-" node
*
* Where each field is represented as a hex string.
*
* @return the String representation.
*/
public String toString()
{
return // time-low first
padHex( (( mostSigBits & 0xFFFFFFFF00000000L) >> 32) & 0xFFFFFFFFL, 8)
+ "-" + // then time-mid
padHex( (( mostSigBits & 0xFFFF0000L ) >> 16), 4 )
+ "-" + // time-high
padHex( ( mostSigBits & 0x0000000000000000FFFFL ), 4 )
+ "-" + // clock (note - no reason to separate high and low here)
padHex( (((leastSigBits & 0xFFFF000000000000L) >> 48) & 0xFFFF), 4 )
+ "-" + // finally the node value.
padHex(leastSigBits & 0xFFFFFFFFFFFFL, 12);
}
/**
* Returns the least significant 64 bits of the UUID as a <code>long</code>.
*/
public long getLeastSignificantBits()
{
return leastSigBits;
}
/**
* Returns the most significant 64 bits of the UUID as a <code>long</code>.
*/
public long getMostSignificantBits()
{
return mostSigBits;
}
/**
* Returns a hash of this UUID.
*/
public int hashCode()
{
int l1 = (int)(leastSigBits & 0xFFFFFFFFL);
int l2 = (int)((leastSigBits & 0xFFFFFFFF00000000L) >> 32);
int m1 = (int)(mostSigBits & 0xFFFFFFFFL);
int m2 = (int)((mostSigBits & 0xFFFFFFFF00000000L) >> 32);
return (l1 ^ l2) ^ (m1 ^ m2);
}
/**
* Creates a UUID version 3 object (name based with MD5 hashing)
* from a series of bytes representing a name.
*/
public static UUID nameUUIDFromBytes(byte[] name)
{
long msb, lsb;
byte[] hash;
try
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
hash = md5.digest( name );
}
catch (NoSuchAlgorithmException e)
{
throw new UnsupportedOperationException("No MD5 algorithm available.");
}
msb = ((hash[0] & 0xFFL) << 56) | ((hash[1] & 0xFFL) << 48) |
((hash[2] & 0xFFL) << 40) | ((hash[3] & 0xFFL) << 32) |
((hash[4] & 0xFFL) << 24) | ((hash[5] & 0xFFL) << 16) |
((hash[6] & 0xFFL) << 8) | (hash[7] & 0xFFL);
lsb = ((hash[8] & 0xFFL) << 56) | ((hash[9] & 0xFFL) << 48) |
((hash[10] & 0xFFL) << 40) | ((hash[11] & 0xFFL) << 32) |
((hash[12] & 0xFFL) << 24) | ((hash[13] & 0xFFL) << 16) |
((hash[14] & 0xFFL) << 8) | (hash[15] & 0xFFL);
lsb &= 0x3FFFFFFFFFFFFFFFL;
lsb |= 0x8000000000000000L; // set top two bits to variant 2
msb &= 0xFFFFFFFFFFFF0FFFL;
msb |= 0x3000; // Version 3;
return new UUID(msb, lsb);
}
/**
* Returns the 48-bit node value in a long.
* This field only exists in a time-based (version 1) UUID.
*
* @throws UnsupportedOperationException if the UUID type is not 1.
* @returns a long with the node value in the lower 48 bits.
*/
public long node()
{
if( version() != 1 )
throw new UnsupportedOperationException("Not a type 1 UUID");
return (leastSigBits & 0xFFFFFFFFFFFFL);
}
/**
* Returns the 60-bit timestamp value of the UUID in a long.
* This field only exists in a time-based (version 1) UUID.
*
* @throws UnsupportedOperationException if the UUID type is not 1.
* @returns a long with the timestamp value.
*/
public long timestamp()
{
if( version() != 1 )
throw new UnsupportedOperationException("Not a type 1 UUID");
long time = (( mostSigBits & 0xFFFFFFFF00000000L) >> 32);
time |= (( mostSigBits & 0xFFFF0000L ) << 16);
long time_hi = ( mostSigBits & 0xFFFL );
time |= (time_hi << 48);
return time;
}
/**
* Generate a Leach-Salz (Variant 2) randomly generated (version 4)
* UUID.
*
*/
public static UUID randomUUID()
{
long lsb = r.nextLong();
long msb = r.nextLong();
lsb &= 0x3FFFFFFFFFFFFFFFL;
lsb |= 0x8000000000000000L; // set top two bits to variant 2
msb &= 0xFFFFFFFFFFFF0FFFL;
msb |= 0x4000; // Version 4;
return new UUID( msb, lsb );
}
/**
* Returns a hex String from l, padded to n spaces.
*/
private String padHex( long l, int n )
{
String s = Long.toHexString( l );
while( s.length() < n )
s = "0" + s;
return s;
}
/**
* Returns the variant of the UUID
*
* This may be:
* 0 = Reserved for NCS backwards-compatibility
* 2 = Leach-Salz (supports the other methods in this class)
* 6 = Reserved for Microsoft backwards-compatibility
* 7 = (reserved for future use)
*/
public int variant()
{
// Get the top 3 bits (not all may be part of the variant)
int v = (int)((leastSigBits & 0xE000000000000000L) >> 61);
if( (v & 0x04) == 0 ) // msb of the variant is 0
return 0;
if( (v & 0x02) == 0 ) // variant is 0 1 (Leach-Salz)
return 2;
return v; // 6 or 7
}
/**
* Returns the version # of the UUID.
*
* Valid version numbers for a variant 2 UUID are:
* 1 = Time based UUID
* 2 = DCE security UUID
* 3 = Name-based UUID using MD5 hashing
* 4 = Randomly generated UUID
* 5 = Name-based UUID using SHA-1 hashing
*
* @return the version number
*/
public int version()
{
return (int)((mostSigBits & 0xF000L) >> 12);
}
}

View file

@ -0,0 +1,86 @@
/* UnknownFormatConversionException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when a {@link Formatter} is supplied with an
* unknown conversion.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class UnknownFormatConversionException
extends IllegalFormatException
{
private static final long serialVersionUID = 19060418L;
/**
* The unknown conversion.
*
* @serial the unknown conversion.
*/
// Note: name fixed by serialization.
private String s;
/**
* Constructs a new <code>UnknownFormatConversionException</code>
* for the specified conversion string.
*
* @param s the conversion string.
* @throws NullPointerException if the conversion string is null.
*/
public UnknownFormatConversionException(String s)
{
super("Unknown format conversion: " + s);
if (s == null)
throw new NullPointerException("The conversion string is null.");
this.s = s;
}
/**
* Returns the conversion string.
*
* @return the conversion string.
*/
public String getConversion()
{
return s;
}
}

View file

@ -0,0 +1,88 @@
/* UnknownFormatFlagsException.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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util;
/**
* Thrown when a {@link Formatter} is supplied with an
* unknown flag.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
public class UnknownFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 19370506L;
/**
* The set of flags containing the unknown flag.
*
* @serial the unknown conversion.
*/
// Note: name fixed by serialization.
private String flags;
/**
* Constructs a new <code>UnknownFormatFlagsException</code>
* which specifies that the supplied set of flags contains a
* unknown.
*
* @param flags the flags containing a unknown.
* @throws NullPointerException if <code>flags</code> is null.
*/
public UnknownFormatFlagsException(String s)
{
super("Unknown flag passed in " + s);
if (s == null)
throw new
NullPointerException("Null flags value passed to constructor.");
this.flags = s;
}
/**
* Returns the flags which contain a unknown.
*
* @return the flags.
*/
public String getFlags()
{
return flags;
}
}

View file

@ -1,5 +1,6 @@
/* Vector.java -- Class that provides growable arrays.
Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,6 +38,7 @@ exception statement from your version. */
package java.util;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
@ -479,7 +481,7 @@ public class Vector extends AbstractList
}
/**
* Removes the first (the lowestindex) occurance of the given object from
* Removes the first (the lowest index) occurrence of the given object from
* the Vector. If such a remove was performed (the object was found), true
* is returned. If there was no such object, false is returned.
*

View file

@ -101,7 +101,7 @@ public class JarOutputStream extends ZipOutputStream
/**
* Prepares the JarOutputStream for writing the next entry.
* This implementation just calls <code>super.putNextEntre()</code>.
* This implementation just calls <code>super.putNextEntry()</code>.
*
* @param entry The information for the next entry
* @exception IOException when some unexpected I/O exception occurred

View file

@ -1,4 +1,4 @@
/* Manifest.java -- Reads, writes and manipulaties jar manifest files
/* Manifest.java -- Reads, writes and manipulates jar manifest files
Copyright (C) 2000, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -152,7 +152,7 @@ public class Manifest implements Cloneable
}
/**
* Read and merge a <code>Mainfest</code> from the designated input stream.
* Read and merge a <code>Manifest</code> from the designated input stream.
*
* @param in the input stream to read from.
* @throws IOException if an I/O related exception occurs during the process.

View file

@ -191,6 +191,42 @@ import java.util.ListIterator;
public class FileHandler
extends StreamHandler
{
/**
* A literal that prefixes all file-handler related properties in the
* logging.properties file.
*/
private static final String PROPERTY_PREFIX = "java.util.logging.FileHandler";
/**
* The name of the property to set for specifying a file naming (incl. path)
* pattern to use with rotating log files.
*/
private static final String PATTERN_KEY = PROPERTY_PREFIX + ".pattern";
/**
* The default pattern to use when the <code>PATTERN_KEY</code> property was
* not specified in the logging.properties file.
*/
private static final String DEFAULT_PATTERN = "%h/java%u.log";
/**
* The name of the property to set for specifying an approximate maximum
* amount, in bytes, to write to any one log output file. A value of zero
* (which is the default) implies a no limit.
*/
private static final String LIMIT_KEY = PROPERTY_PREFIX + ".limit";
private static final int DEFAULT_LIMIT = 0;
/**
* The name of the property to set for specifying how many output files to
* cycle through. The default value is 1.
*/
private static final String COUNT_KEY = PROPERTY_PREFIX + ".count";
private static final int DEFAULT_COUNT = 1;
/**
* The name of the property to set for specifying whether this handler should
* append, or not, its output to existing files. The default value is
* <code>false</code> meaning NOT to append.
*/
private static final String APPEND_KEY = PROPERTY_PREFIX + ".append";
private static final boolean DEFAULT_APPEND = false;
/**
* The number of bytes a log file is approximately allowed to reach
* before it is closed and the handler switches to the next file in
@ -252,16 +288,10 @@ public class FileHandler
public FileHandler()
throws IOException, SecurityException
{
this(/* pattern: use configiguration */ null,
LogManager.getIntProperty("java.util.logging.FileHandler.limit",
/* default */ 0),
LogManager.getIntProperty("java.util.logging.FileHandler.count",
/* default */ 1),
LogManager.getBooleanProperty("java.util.logging.FileHandler.append",
/* default */ false));
this(LogManager.getLogManager().getProperty(PATTERN_KEY),
LogManager.getIntProperty(LIMIT_KEY, DEFAULT_LIMIT),
LogManager.getIntProperty(COUNT_KEY, DEFAULT_COUNT),
LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
}
@ -269,10 +299,7 @@ public class FileHandler
public FileHandler(String pattern)
throws IOException, SecurityException
{
this(pattern,
/* limit */ 0,
/* count */ 1,
/* append */ false);
this(pattern, DEFAULT_LIMIT, DEFAULT_COUNT, DEFAULT_APPEND);
}
@ -280,10 +307,7 @@ public class FileHandler
public FileHandler(String pattern, boolean append)
throws IOException, SecurityException
{
this(pattern,
/* limit */ 0,
/* count */ 1,
append);
this(pattern, DEFAULT_LIMIT, DEFAULT_COUNT, append);
}
@ -292,9 +316,7 @@ public class FileHandler
throws IOException, SecurityException
{
this(pattern, limit, count,
LogManager.getBooleanProperty(
"java.util.logging.FileHandler.append",
/* default */ false));
LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
}
@ -350,7 +372,7 @@ public class FileHandler
throws IOException, SecurityException
{
super(/* output stream, created below */ null,
"java.util.logging.FileHandler",
PROPERTY_PREFIX,
/* default level */ Level.ALL,
/* formatter */ null,
/* default formatter */ XMLFormatter.class);
@ -358,14 +380,14 @@ public class FileHandler
if ((limit <0) || (count < 1))
throw new IllegalArgumentException();
this.pattern = pattern;
this.pattern = pattern != null ? pattern : DEFAULT_PATTERN;
this.limit = limit;
this.count = count;
this.append = append;
this.written = 0;
this.logFiles = new LinkedList ();
setOutputStream (createFileStream (pattern, limit, count, append,
setOutputStream (createFileStream (this.pattern, limit, count, append,
/* generation */ 0));
}
@ -389,10 +411,9 @@ public class FileHandler
* LogManager configuration property.
*/
if (pattern == null)
pattern = LogManager.getLogManager().getProperty(
"java.util.logging.FileHandler.pattern");
pattern = LogManager.getLogManager().getProperty(PATTERN_KEY);
if (pattern == null)
pattern = "%h/java%u.log";
pattern = DEFAULT_PATTERN;
if (count > 1 && !has (pattern, 'g'))
pattern = pattern + ".%g";

View file

@ -39,6 +39,8 @@ exception statement from your version. */
package java.util.logging;
import gnu.classpath.SystemProperties;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.ByteArrayInputStream;
@ -50,12 +52,11 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import gnu.classpath.SystemProperties;
/**
* The <code>LogManager</code> maintains a hierarchical namespace
* of Logger objects and manages properties for configuring the logging
@ -107,11 +108,23 @@ import gnu.classpath.SystemProperties;
*/
public class LogManager
{
/**
* The object name for the logging management bean.
* @since 1.5
*/
public static final String LOGGING_MXBEAN_NAME
= "java.util.logging:type=Logging";
/**
* The singleton LogManager instance.
*/
private static LogManager logManager;
/**
* The singleton logging bean.
*/
private static LoggingMXBean loggingBean;
/**
* The registered named loggers; maps the name of a Logger to
* a WeakReference to it.
@ -836,11 +849,11 @@ public class LogManager
}
catch (ClassNotFoundException e)
{
warn(property, className, "class not found");
warn(property, className, "class not found", e);
}
catch (IllegalAccessException e)
{
warn(property, className, "illegal access");
warn(property, className, "illegal access", e);
}
catch (InstantiationException e)
{
@ -848,7 +861,7 @@ public class LogManager
}
catch (java.lang.LinkageError e)
{
warn(property, className, "linkage error");
warn(property, className, "linkage error", e);
}
return null;
@ -904,4 +917,63 @@ public class LogManager
}
}
/**
* Return the logging bean. There is a single logging bean per
* VM instance.
* @since 1.5
*/
public static synchronized LoggingMXBean getLoggingMXBean()
{
if (loggingBean == null)
{
loggingBean = new LoggingMXBean()
{
public String getLoggerLevel(String logger)
{
LogManager mgr = getLogManager();
Logger l = mgr.getLogger(logger);
if (l == null)
return null;
Level lev = l.getLevel();
if (lev == null)
return "";
return lev.getName();
}
public List getLoggerNames()
{
LogManager mgr = getLogManager();
// This is inefficient, but perhaps better for maintenance.
return Collections.list(mgr.getLoggerNames());
}
public String getParentLoggerName(String logger)
{
LogManager mgr = getLogManager();
Logger l = mgr.getLogger(logger);
if (l == null)
return null;
l = l.getParent();
if (l == null)
return "";
return l.getName();
}
public void setLoggerLevel(String logger, String level)
{
LogManager mgr = getLogManager();
Logger l = mgr.getLogger(logger);
if (l == null)
throw new IllegalArgumentException("no logger named " + logger);
Level newLevel;
if (level == null)
newLevel = null;
else
newLevel = Level.parse(level);
l.setLevel(newLevel);
}
};
}
return loggingBean;
}
}

View file

@ -1209,7 +1209,7 @@ public class Logger
/**
* Reset and close handlers attached to this logger. This function is package
* private because it must only be avaiable to the LogManager.
* private because it must only be available to the LogManager.
*/
void resetLogger()
{

View file

@ -0,0 +1,85 @@
/* LoggingMxBean.java -- Management interface for logging
Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 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 java.util.logging;
import java.util.List;
/**
* This interface represents the management interface for logging.
* There is a single logging bean per VM instance, which can be
* retrieved via {@link LogManager#getLoggingMXBean()}.
*
* @since 1.5
*/
public interface LoggingMXBean
{
/**
* Return the name of the logging level given the name of
* a logger. Returns null if no such logger exists.
* @param logger the logger's name
* @return the logging level's name, or null
*/
String getLoggerLevel(String logger);
/**
* Return a list of all logger names.
*/
List/*<String>*/ getLoggerNames();
/**
* Return the name of the parent of the indicated logger.
* If no such logger exists, returns null. If the logger
* is the root logger, returns the empty string.
* @param logger the logger's name
* @return the name of the logger's parent, or null
*/
String getParentLoggerName(String logger);
/**
* Sets the logging level for a particular logger.
*
* @param logger the name of the logger
* @param level the name of the new logging level, or null
* @throws IllegalArgumentException if the level is not
* recognized, or if the logger does not exist
* @throws SecurityException if access is denied;
* see {@link Logger#setLevel(Level)}
*/
void setLoggerLevel(String logger, String level);
}

View file

@ -37,6 +37,7 @@ exception statement from your version. */
package java.util.prefs;
import gnu.classpath.ServiceFactory;
import gnu.java.util.prefs.NodeReader;
import java.io.IOException;
@ -45,6 +46,7 @@ import java.io.OutputStream;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.Iterator;
/**
* Preference node containing key value entries and subnodes.
@ -205,6 +207,17 @@ public abstract class Preferences {
}
});
// Still no factory? Try to see if we have one defined
// as a System Preference
if (factory == null)
{
Iterator iter = ServiceFactory.lookupProviders
(PreferencesFactory.class, null);
if (iter != null && iter.hasNext())
factory = (PreferencesFactory) iter.next();
}
// Still no factory? Use our default.
if (factory == null)
{

View file

@ -38,9 +38,9 @@ exception statement from your version. */
package java.util.regex;
import gnu.regexp.RE;
import gnu.regexp.REMatch;
import gnu.regexp.CharIndexed;
import gnu.java.util.regex.CharIndexed;
import gnu.java.util.regex.RE;
import gnu.java.util.regex.REMatch;
/**
* Instance of a regular expression applied to a char sequence.

View file

@ -37,9 +37,9 @@ exception statement from your version. */
package java.util.regex;
import gnu.regexp.RE;
import gnu.regexp.REException;
import gnu.regexp.RESyntax;
import gnu.java.util.regex.RE;
import gnu.java.util.regex.REException;
import gnu.java.util.regex.RESyntax;
import java.io.Serializable;
import java.util.ArrayList;
@ -73,12 +73,17 @@ public final class Pattern implements Serializable
this.regex = regex;
this.flags = flags;
RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4;
int gnuFlags = 0;
gnuFlags |= RE.REG_ICASE_USASCII;
if ((flags & CASE_INSENSITIVE) != 0)
gnuFlags |= RE.REG_ICASE;
if ((flags & MULTILINE) != 0)
gnuFlags |= RE.REG_MULTILINE;
{
gnuFlags |= RE.REG_MULTILINE;
syntax = new RESyntax(syntax);
syntax.setLineSeparator(null);
}
if ((flags & DOTALL) != 0)
gnuFlags |= RE.REG_DOT_NEWLINE;
if ((flags & UNICODE_CASE) != 0)
@ -86,7 +91,6 @@ public final class Pattern implements Serializable
// not yet supported:
// if ((flags & CANON_EQ) != 0) gnuFlags =
RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4;
if ((flags & UNIX_LINES) != 0)
{
// Use a syntax set with \n for linefeeds?

View file

@ -49,8 +49,8 @@ import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
/**
* This class represents a Zip archive. You can ask for the contained
@ -88,7 +88,7 @@ public class ZipFile implements ZipConstants
private final RandomAccessFile raf;
// The entries of this zip file when initialized and not yet closed.
private HashMap entries;
private LinkedHashMap entries;
private boolean closed = false;
@ -250,7 +250,7 @@ public class ZipFile implements ZipConstants
throw new EOFException(name);
int centralOffset = inp.readLeInt();
entries = new HashMap(count+count/2);
entries = new LinkedHashMap(count+count/2);
inp.seek(centralOffset);
for (int i = 0; i < count; i++)
@ -347,7 +347,7 @@ public class ZipFile implements ZipConstants
* @exception IllegalStateException when the ZipFile has already been closed.
* @exception IOException when the entries could not be read.
*/
private HashMap getEntries() throws IOException
private LinkedHashMap getEntries() throws IOException
{
synchronized(raf)
{
@ -375,7 +375,7 @@ public class ZipFile implements ZipConstants
try
{
HashMap entries = getEntries();
LinkedHashMap entries = getEntries();
ZipEntry entry = (ZipEntry) entries.get(name);
// If we didn't find it, maybe it's a directory.
if (entry == null && !name.endsWith("/"))
@ -414,7 +414,7 @@ public class ZipFile implements ZipConstants
{
checkClosed();
HashMap entries = getEntries();
LinkedHashMap entries = getEntries();
String name = entry.getName();
ZipEntry zipEntry = (ZipEntry) entries.get(name);
if (zipEntry == null)