aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/gnu/javax
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
commite1bea0c0687c5f4551b3a6058ec37ce3705fa6cc (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/gnu/javax
parentaf333b9a7f9e1cc1029bec56d48f2de63acdf686 (diff)
downloadgcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.zip
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.gz
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.bz2
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. From-SVN: r125302
Diffstat (limited to 'libjava/classpath/gnu/javax')
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGICCProfile.java4
-rw-r--r--libjava/classpath/gnu/javax/management/Translator.java544
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/Base64.java311
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/PrivateCredentials.java5
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/SSLEngineImpl.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java3
-rw-r--r--libjava/classpath/gnu/javax/security/auth/login/ConfigFileParser.java8
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java6
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java5
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java5
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java2
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/css/CSSParser.java7
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/gnuDTD.java1
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java2
14 files changed, 568 insertions, 337 deletions
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGICCProfile.java b/libjava/classpath/gnu/javax/imageio/png/PNGICCProfile.java
index d2696e1..b6dc21e 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGICCProfile.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGICCProfile.java
@@ -61,7 +61,9 @@ public class PNGICCProfile extends PNGChunk
{
super( type, data, crc );
int i = 0;
- while( data[i++] != 0 );
+ while( data[i++] != 0 )
+ ;
+
try
{
name = new String(data, 0, i, "8859_1");
diff --git a/libjava/classpath/gnu/javax/management/Translator.java b/libjava/classpath/gnu/javax/management/Translator.java
new file mode 100644
index 0000000..69191d4
--- /dev/null
+++ b/libjava/classpath/gnu/javax/management/Translator.java
@@ -0,0 +1,544 @@
+/* Translator.java -- Performs MXBean data type translation.
+ Copyright (C) 2007 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 gnu.javax.management;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+
+import javax.management.JMX;
+import javax.management.MBeanServerInvocationHandler;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenMBeanParameterInfo;
+import javax.management.openmbean.OpenMBeanParameterInfoSupport;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
+
+/**
+ * Translates Java data types to their equivalent
+ * open data type, and vice versa, according to the
+ * {@link javax.management.MXBean} rules.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+public final class Translator
+{
+
+ /**
+ * Translates the input Java data types to the equivalent
+ * open data types.
+ *
+ * @param jtypes the Java types supplied as parameters.
+ * @param method the method that was called.
+ * @return the equivalent open types required by the {@link MXBean}.
+ * @throws Throwable if an exception is thrown in performing the
+ * conversion.
+ */
+ public static final Object[] fromJava(Object[] jtypes, Method method)
+ throws Throwable
+ {
+ Type[] gtypes = method.getGenericParameterTypes();
+ Object[] otypes = new Object[jtypes.length];
+ for (int a = 0; a < jtypes.length; ++a)
+ otypes[a] = fromJava(jtypes[a], (Class<?>) gtypes[a]);
+ return otypes;
+ }
+
+ /**
+ * Translates the input Java data type to the equivalent
+ * open data type.
+ *
+ * @param jtype the Java type supplied as a parameter.
+ * @param type the type of the parameter.
+ * @return the equivalent open type required by the {@link MXBean}.
+ * @throws Throwable if an exception is thrown in performing the
+ * conversion.
+ */
+ public static final Object fromJava(Object jtype, Type type)
+ throws Throwable
+ {
+ if (jtype == null)
+ return null;
+ Class<?> jclass = jtype.getClass();
+ if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(jclass.getName()))
+ return jtype;
+ if (jclass.isArray())
+ {
+ Class<?> ctype = jclass.getComponentType();
+ if (ctype.isPrimitive())
+ return jtype;
+ if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(ctype.getName()))
+ return jtype;
+ Object[] elems = (Object[]) jtype;
+ Object[] celems = new Object[elems.length];
+ for (int a = 0; a < elems.length; ++a)
+ celems[a] = fromJava(elems[a], elems[a].getClass());
+ return makeArraySpecific(celems);
+ }
+ String tName = getTypeName(type);
+ if (jtype instanceof List || jtype instanceof Set ||
+ jtype instanceof SortedSet)
+ {
+ String elemType = tName.substring(tName.indexOf("<") + 1,
+ tName.indexOf(">")).trim();
+ if (jtype instanceof SortedSet)
+ {
+ Class<?> elemClass = Class.forName(elemType);
+ if (!Comparable.class.isAssignableFrom(elemClass))
+ throw new IllegalArgumentException(jtype + " has a " +
+ "non-comparable element " +
+ "type, " + elemClass);
+ if (((SortedSet) jtype).comparator() != null)
+ throw new IllegalArgumentException(jtype + " does not " +
+ "use natural ordering.");
+ }
+ List elems = (List) jtype;
+ Object[] celems = new Object[elems.size()];
+ for (int a = 0; a < elems.size(); ++a)
+ {
+ Object elem = elems.get(a);
+ celems[a] = fromJava(elem, elem.getClass());
+ }
+ return makeArraySpecific(celems);
+ }
+ if (jtype instanceof Enum)
+ return ((Enum) jtype).name();
+ if (jtype instanceof Map || jtype instanceof SortedMap)
+ {
+ int lparam = tName.indexOf("<");
+ int comma = tName.indexOf(",", lparam);
+ int rparam = tName.indexOf(">", comma);
+ String key = tName.substring(lparam + 1, comma).trim();
+ String value = tName.substring(comma + 1, rparam).trim();
+ String typeName = null;
+ if (jtype instanceof Map)
+ typeName = "java.util.Map" + tName.substring(lparam);
+ else
+ {
+ Class<?> keyClass = Class.forName(key);
+ if (!Comparable.class.isAssignableFrom(keyClass))
+ throw new IllegalArgumentException(jtype + " has a " +
+ "non-comparable element " +
+ "type, " + keyClass);
+ if (((SortedMap) jtype).comparator() != null)
+ throw new IllegalArgumentException(jtype + " does not " +
+ "use natural ordering.");
+ typeName = "java.util.SortedMap" + tName.substring(lparam);
+ }
+ OpenType k = translate(key).getOpenType();
+ OpenType v = translate(value).getOpenType();
+ CompositeType rowType = new CompositeType(typeName, typeName,
+ new String[] { "key", "value" },
+ new String[] { "Map key", "Map value"},
+ new OpenType[] {k,v});
+ TabularType tabType = new TabularType(typeName, typeName, rowType,
+ new String[]{"key"});
+ TabularData data = new TabularDataSupport(tabType);
+ for (Map.Entry entry : (Set<Map.Entry>) ((Map) jtype).entrySet())
+ {
+ try
+ {
+ data.put(new CompositeDataSupport(rowType,
+ new String[] {
+ "key",
+ "value"
+ },
+ new Object[] {
+ entry.getKey(),
+ entry.getValue()
+ }));
+ }
+ catch (OpenDataException e)
+ {
+ throw (InternalError) (new InternalError("A problem occurred " +
+ "converting the map " +
+ "to a composite data " +
+ "structure.").initCause(e));
+ }
+ }
+ return data;
+ }
+ if (JMX.isMXBeanInterface(jclass))
+ {
+ try
+ {
+ MBeanServerInvocationHandler ih = (MBeanServerInvocationHandler)
+ Proxy.getInvocationHandler(jtype);
+ return ih.getObjectName();
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalArgumentException("For a MXBean to be translated " +
+ "to an open type, it must be a " +
+ "proxy.", e);
+ }
+ catch (ClassCastException e)
+ {
+ throw new IllegalArgumentException("For a MXBean to be translated " +
+ "to an open type, it must have a " +
+ "MBeanServerInvocationHandler.", e);
+ }
+ }
+ /* FIXME: Handle other types */
+ throw new IllegalArgumentException("The type, " + jtype +
+ ", is not convertible.");
+ }
+
+ /**
+ * Translates the returned open data type to the value
+ * required by the interface.
+ *
+ * @param otype the open type returned by the method call.
+ * @param method the method that was called.
+ * @return the equivalent return type required by the interface.
+ * @throws Throwable if an exception is thrown in performing the
+ * conversion.
+ */
+ public static final Object toJava(Object otype, Method method)
+ throws Throwable
+ {
+ Class<?> returnType = method.getReturnType();
+ if (returnType.isEnum())
+ {
+ String ename = (String) otype;
+ Enum[] constants = (Enum[]) returnType.getEnumConstants();
+ for (Enum c : constants)
+ if (c.name().equals(ename))
+ return c;
+ }
+ if (List.class.isAssignableFrom(returnType))
+ {
+ Object[] elems = (Object[]) otype;
+ List l = new ArrayList(elems.length);
+ for (Object elem : elems)
+ l.add(elem);
+ return l;
+ }
+ if (Map.class.isAssignableFrom(returnType))
+ {
+ TabularData data = (TabularData) otype;
+ Map m = new HashMap(data.size());
+ for (Object val : data.values())
+ {
+ CompositeData vals = (CompositeData) val;
+ m.put(vals.get("key"), vals.get("value"));
+ }
+ return m;
+ }
+ try
+ {
+ Method m = returnType.getMethod("from",
+ new Class[]
+ { CompositeData.class });
+ return m.invoke(null, (CompositeData) otype);
+ }
+ catch (NoSuchMethodException e)
+ {
+ /* Ignored; we expect this if this
+ isn't a from(CompositeData) class */
+ }
+ return otype;
+ }
+
+ /**
+ * Creates a new array which has the specific type
+ * used by the elements of the original {@link Object}
+ * array supplied.
+ *
+ * @param arr a series of elements in an {@link Object}
+ * array.
+ * @return the same elements in a new array of the specific
+ * type.
+ */
+ private static final Object[] makeArraySpecific(Object[] arr)
+ {
+ Object[] rcelems = (Object[]) Array.newInstance(arr[0].getClass(),
+ arr.length);
+ System.arraycopy(arr, 0, rcelems, 0, arr.length);
+ return rcelems;
+ }
+
+ /**
+ * Translates the name of a type into an equivalent
+ * {@link javax.management.openmbean.OpenMBeanParameterInfo}
+ * that describes it.
+ *
+ * @param type the type to describe.
+ * @return an instance of
+ * {@link javax.management.openmbean.OpenMBeanParameterInfo},
+ * describing the translated type and limits of the given type.
+ * @throws OpenDataException if a type is not open.
+ */
+ public static final OpenMBeanParameterInfo translate(String type)
+ throws OpenDataException
+ {
+ if (type.equals("boolean") || type.equals(Boolean.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.BOOLEAN,
+ null,
+ new Boolean[] {
+ Boolean.TRUE,
+ Boolean.FALSE
+ });
+ if (type.equals("byte") || type.equals(Byte.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.BYTE,
+ null,
+ Byte.valueOf(Byte.MIN_VALUE),
+ Byte.valueOf(Byte.MAX_VALUE));
+ if (type.equals("char") || type.equals(Character.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.CHARACTER,
+ null,
+ Character.valueOf(Character.MIN_VALUE),
+ Character.valueOf(Character.MAX_VALUE));
+ if (type.equals("double") || type.equals(Double.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.DOUBLE,
+ null,
+ Double.valueOf(Double.MIN_VALUE),
+ Double.valueOf(Double.MAX_VALUE));
+ if (type.equals("float") || type.equals(Float.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.FLOAT,
+ null,
+ Float.valueOf(Float.MIN_VALUE),
+ Float.valueOf(Float.MAX_VALUE));
+ if (type.equals("int") || type.equals(Integer.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.INTEGER,
+ null,
+ Integer.valueOf(Integer.MIN_VALUE),
+ Integer.valueOf(Integer.MAX_VALUE));
+ if (type.equals("long") || type.equals(Long.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.LONG,
+ null,
+ Long.valueOf(Long.MIN_VALUE),
+ Long.valueOf(Long.MAX_VALUE));
+ if (type.equals("short") || type.equals(Short.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.SHORT,
+ null,
+ Short.valueOf(Short.MIN_VALUE),
+ Short.valueOf(Short.MAX_VALUE));
+ if (type.equals(String.class.getName()))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.STRING);
+ if (type.equals("void"))
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.VOID);
+ if (type.startsWith("java.util.Map"))
+ {
+ int lparam = type.indexOf("<");
+ int comma = type.indexOf(",", lparam);
+ int rparam = type.indexOf(">", comma);
+ String key = type.substring(lparam + 1, comma).trim();
+ OpenType k = translate(key).getOpenType();
+ OpenType v = translate(type.substring(comma + 1, rparam).trim()).getOpenType();
+ CompositeType ctype = new CompositeType(Map.class.getName(), Map.class.getName(),
+ new String[] { "key", "value" },
+ new String[] { "Map key", "Map value"},
+ new OpenType[] { k, v});
+ TabularType ttype = new TabularType(key, key, ctype,
+ new String[] { "key" });
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ ttype);
+ }
+ if (type.startsWith("java.util.List"))
+ {
+ int lparam = type.indexOf("<");
+ int rparam = type.indexOf(">");
+ OpenType e = translate(type.substring(lparam + 1, rparam).trim()).getOpenType();
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ new ArrayType(1, e)
+ );
+ }
+ Class c;
+ try
+ {
+ c = Class.forName(type);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (InternalError)
+ (new InternalError("The class for a type used in a management bean " +
+ "could not be loaded.").initCause(e));
+ }
+ if (c.isEnum())
+ {
+ Object[] values = c.getEnumConstants();
+ String[] names = new String[values.length];
+ for (int a = 0; a < values.length; ++a)
+ names[a] = values[a].toString();
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ SimpleType.STRING,
+ null, names);
+ }
+ try
+ {
+ c.getMethod("from", new Class[] { CompositeData.class });
+ Method[] methods = c.getDeclaredMethods();
+ List<String> names = new ArrayList<String>();
+ List<OpenType> types = new ArrayList<OpenType>();
+ for (int a = 0; a < methods.length; ++a)
+ {
+ String name = methods[a].getName();
+ if (name.startsWith("get"))
+ {
+ names.add(name.substring(3));
+ types.add(getTypeFromClass(methods[a].getReturnType()));
+ }
+ }
+ String[] fields = names.toArray(new String[names.size()]);
+ CompositeType ctype = new CompositeType(c.getName(), c.getName(),
+ fields, fields,
+ types.toArray(new OpenType[types.size()]));
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ ctype);
+ }
+ catch (NoSuchMethodException e)
+ {
+ /* Ignored; we expect this if this isn't a from(CompositeData) class */
+ }
+ if (c.isArray())
+ {
+ int depth;
+ for (depth = 0; c.getName().charAt(depth) == '['; ++depth)
+ ;
+ OpenType ot = getTypeFromClass(c.getComponentType());
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ new ArrayType(depth, ot)
+ );
+ }
+ throw new InternalError("The type used does not have an open type translation.");
+ }
+
+ /**
+ * Obtains the {@link javax.management.openmbean.OpenType}
+ * for a particular class.
+ *
+ * @param c the class to obtain the type for.
+ * @return the appropriate instance.
+ * @throws OpenDataException if the type is not open.
+ */
+ private static final OpenType getTypeFromClass(Class c)
+ throws OpenDataException
+ {
+ return Translator.translate(c.getName()).getOpenType();
+ }
+
+ /**
+ * <p>
+ * Returns the type name according to the rules described
+ * in {@link javax.management.MXBean}. Namely, for a type,
+ * {@code T}, {@code typename(T)} is computed as follows:
+ * </p>
+ * <ul>
+ * <li>If T is non-generic and not an array, then the value
+ * of {@link java.lang.Class#getName()} is returned.</li>
+ * <li>If T is an array type, {@code{E[]}, then the type name
+ * is {@code typename(E)} followed by an occurrence
+ * of {@code '[]'} for each dimension.</li>
+ * <li>If T is a generic or parameterized type, the type name
+ * is composed of {@code typename(P)}, where {@code P} is the
+ * parameterized type name, followed by {@code '<'}, the resulting
+ * list of type names of the parameters after applying {@code typename}
+ * to each, separated by commas, and {@code '>'}.</li>
+ * </ul>
+ *
+ * @param type the type to return the type name of.
+ * @return the type name computed according to the rules above.
+ */
+ private static final String getTypeName(Type type)
+ {
+ if (type instanceof Class)
+ {
+ Class<?> c = (Class<?>) type;
+ if (c.isArray())
+ {
+ StringBuilder b =
+ new StringBuilder(c.getComponentType().getName());
+ String normName = c.getName();
+ for (int a = 0; a < normName.length(); ++a)
+ {
+ if (normName.charAt(a) == '[')
+ b.append("[]");
+ else
+ break;
+ }
+ return b.toString();
+ }
+ return c.getName();
+ }
+ return type.toString();
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/net/ssl/Base64.java b/libjava/classpath/gnu/javax/net/ssl/Base64.java
deleted file mode 100644
index 52989da..0000000
--- a/libjava/classpath/gnu/javax/net/ssl/Base64.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Base64.java -- Base64 encoding and decoding.
- Copyright (C) 2006 Free Software Foundation, Inc.
-
-This file is a 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 of the License, 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; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, 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.
-
---
-Base64 encoding derived from ISC's DHCP. Copyright notices from DHCP
-follow. See http://www.isc.org/products/DHCP/.
-
-Copyright (c) 1996 by Internet Software Consortium.
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
-DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
-INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
-FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
---
-Portions Copyright (c) 1995 by International Business Machines, Inc.
-
-International Business Machines, Inc. (hereinafter called IBM) grants
-permission under its copyrights to use, copy, modify, and distribute
-this Software with or without fee, provided that the above copyright
-notice and all paragraphs of this notice appear in all copies, and
-that the name of IBM not be used in connection with the marketing of
-any product incorporating the Software or modifications thereof,
-without specific, written prior permission.
-
-To the extent it has a right to do so, IBM grants an immunity from
-suit under its patents, if any, for the use, sale or manufacture of
-products to the extent that such products are used for performing
-Domain Name System dynamic updates in TCP/IP networks by means of the
-Software. No immunity is granted for any product per se or for any
-other function of any product.
-
-THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
-DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE, EVEN IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH
-DAMAGES. */
-
-
-package gnu.javax.net.ssl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public final class Base64
-{
-
- // No constructor.
- private Base64() { }
-
- // Class methods.
- // -------------------------------------------------------------------------
-
- /** Base-64 characters. */
- private static final String BASE_64 =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- /** Base-64 padding character. */
- private static final char BASE_64_PAD = '=';
-
- /**
- * Base64 encode a byte array, returning the returning string.
- *
- * @param buf The byte array to encode.
- * @param tw The total length of any line, 0 for unlimited.
- * @return <tt>buf</tt> encoded in Base64.
- */
- public static String encode(byte[] buf, int tw)
- {
- int srcLength = buf.length;
- byte[] input = new byte[3];
- int[] output = new int[4];
- StringBuffer out = new StringBuffer();
- int i = 0;
- int chars = 0;
-
- while (srcLength > 2)
- {
- input[0] = buf[i++];
- input[1] = buf[i++];
- input[2] = buf[i++];
- srcLength -= 3;
-
- output[0] = (input[0] & 0xff) >>> 2;
- output[1] = ((input[0] & 0x03) << 4) + ((input[1] & 0xff) >>> 4);
- output[2] = ((input[1] & 0x0f) << 2) + ((input[2] & 0xff) >>> 6);
- output[3] = input[2] & 0x3f;
-
- out.append(BASE_64.charAt(output[0]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- out.append(BASE_64.charAt(output[1]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- out.append(BASE_64.charAt(output[2]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- out.append(BASE_64.charAt(output[3]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- }
-
- if (srcLength != 0)
- {
- input[0] = input[1] = input[2] = 0;
- for (int j = 0; j < srcLength; j++)
- {
- input[j] = buf[i+j];
- }
- output[0] = (input[0] & 0xff) >>> 2;
- output[1] = ((input[0] & 0x03) << 4) + ((input[1] & 0xff) >>> 4);
- output[2] = ((input[1] & 0x0f) << 2) + ((input[2] & 0xff) >>> 6);
-
- out.append(BASE_64.charAt(output[0]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- out.append(BASE_64.charAt(output[1]));
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- if (srcLength == 1)
- {
- out.append(BASE_64_PAD);
- }
- else
- {
- out.append(BASE_64.charAt(output[2]));
- }
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- out.append(BASE_64_PAD);
- if (tw > 0 && ++chars % tw == 0)
- {
- out.append("\n");
- }
- }
- if (tw > 0)
- {
- out.append("\n");
- }
-
- return out.toString();
- }
-
- /**
- * Decode a Base-64 string into a byte array.
- *
- * @param b64 The Base-64 encoded string.
- * @return The decoded bytes.
- * @throws java.io.IOException If the argument is not a valid Base-64
- * encoding.
- */
- public static byte[] decode(String b64) throws IOException
- {
- ByteArrayOutputStream result = new ByteArrayOutputStream(b64.length() / 3);
- int state = 0, i;
- byte temp = 0;
-
- for (i = 0; i < b64.length(); i++)
- {
- if (Character.isWhitespace(b64.charAt(i)))
- {
- continue;
- }
- if (b64.charAt(i) == BASE_64_PAD)
- {
- break;
- }
-
- int pos = BASE_64.indexOf(b64.charAt(i));
- if (pos < 0)
- {
- throw new IOException("non-Base64 character " + b64.charAt(i));
- }
- switch (state)
- {
- case 0:
- temp = (byte) (pos - BASE_64.indexOf('A') << 2);
- state = 1;
- break;
-
- case 1:
- temp |= (byte) (pos - BASE_64.indexOf('A') >>> 4);
- result.write(temp);
- temp = (byte) ((pos - BASE_64.indexOf('A') & 0x0f) << 4);
- state = 2;
- break;
-
- case 2:
- temp |= (byte) ((pos - BASE_64.indexOf('A') & 0x7f) >>> 2);
- result.write(temp);
- temp = (byte) ((pos - BASE_64.indexOf('A') & 0x03) << 6);
- state = 3;
- break;
-
- case 3:
- temp |= (byte) (pos - BASE_64.indexOf('A') & 0xff);
- result.write(temp);
- state = 0;
- break;
-
- default:
- throw new Error("this statement should be unreachable");
- }
- }
-
- if (i < b64.length() && b64.charAt(i) == BASE_64_PAD)
- {
- switch (state)
- {
- case 0:
- case 1:
- throw new IOException("malformed Base64 sequence");
-
- case 2:
- for ( ; i < b64.length(); i++)
- {
- if (!Character.isWhitespace(b64.charAt(i)))
- {
- break;
- }
- }
- // We must see a second pad character here.
- if (b64.charAt(i) != BASE_64_PAD)
- {
- throw new IOException("malformed Base64 sequence");
- }
- i++;
- // Fall-through.
-
- case 3:
- i++;
- for ( ; i < b64.length(); i++)
- {
- // We should only see whitespace after this.
- if (!Character.isWhitespace(b64.charAt(i)))
- {
- System.err.println(b64.charAt(i));
- throw new IOException("malformed Base64 sequence");
- }
- }
- }
- }
- else
- {
- if (state != 0)
- {
- throw new IOException("malformed Base64 sequence");
- }
- }
-
- return result.toByteArray();
- }
-}
diff --git a/libjava/classpath/gnu/javax/net/ssl/PrivateCredentials.java b/libjava/classpath/gnu/javax/net/ssl/PrivateCredentials.java
index 4426293..4a37cd8 100644
--- a/libjava/classpath/gnu/javax/net/ssl/PrivateCredentials.java
+++ b/libjava/classpath/gnu/javax/net/ssl/PrivateCredentials.java
@@ -1,5 +1,5 @@
/* PrivateCredentials.java -- private key/certificate pairs.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;
@@ -80,6 +78,7 @@ import gnu.javax.crypto.pad.WrongPaddingException;
import gnu.java.security.der.DER;
import gnu.java.security.der.DERReader;
+import gnu.java.util.Base64;
/**
* An instance of a manager factory parameters for holding a single
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/SSLEngineImpl.java b/libjava/classpath/gnu/javax/net/ssl/provider/SSLEngineImpl.java
index 22c488d..4a7f924 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/SSLEngineImpl.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/SSLEngineImpl.java
@@ -99,7 +99,7 @@ public final class SSLEngineImpl extends SSLEngine
private Mode mode;
- private enum Mode { SERVER, CLIENT };
+ private enum Mode { SERVER, CLIENT }
SSLEngineImpl (SSLContextImpl contextImpl, String host, int port)
{
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java b/libjava/classpath/gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java
index 415efc6..e6981c9 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java
@@ -188,7 +188,8 @@ public class SSLRSASignatureImpl extends SignatureSpi
final byte[] eb = EB.toByteArray();
if (eb[0] == 0x00)
{
- for (i = 0; i < eb.length && eb[i] == 0x00; i++);
+ for (i = 0; i < eb.length && eb[i] == 0x00; i++)
+ ;
}
else if (eb[0] == 0x01)
{
diff --git a/libjava/classpath/gnu/javax/security/auth/login/ConfigFileParser.java b/libjava/classpath/gnu/javax/security/auth/login/ConfigFileParser.java
index b5b5069..40adb78 100644
--- a/libjava/classpath/gnu/javax/security/auth/login/ConfigFileParser.java
+++ b/libjava/classpath/gnu/javax/security/auth/login/ConfigFileParser.java
@@ -122,7 +122,9 @@ public final class ConfigFileParser
initParser(r);
while (parseAppOrOtherEntry())
- ; // do nothing
+ {
+ /* do nothing */
+ }
}
private void initParser(Reader r) throws IOException
@@ -157,7 +159,9 @@ public final class ConfigFileParser
List lmis = new ArrayList();
while (parseACE(lmis))
- ; // do nothing
+ {
+ /* do nothing */
+ }
c = cft.nextToken();
if (c != '}')
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
index c91f1e3..3810dff 100644
--- a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
@@ -1,5 +1,5 @@
/* AlsaMidiSequencerDevice.java -- The ALSA MIDI sequencer device
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,10 +51,6 @@ import javax.sound.midi.Sequencer;
import javax.sound.midi.Track;
import javax.sound.midi.Transmitter;
-// FIXME: These next two imports are only required by gcj it seems.
-import javax.sound.midi.MidiDevice.Info;
-import javax.sound.midi.Sequencer.SyncMode;
-
/**
* The ALSA MIDI sequencer device. This is a singleton device.
*
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
index d666be1..0e59bc8 100644
--- a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
@@ -1,5 +1,5 @@
/* AlsaPortDevice.java -- ALSA MIDI Port Devices
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,9 +43,6 @@ import javax.sound.midi.MidiMessage;
import javax.sound.midi.Receiver;
import javax.sound.midi.Transmitter;
-// FIXME: This next import is only rquired for gcj it seems.
-import javax.sound.midi.MidiDevice.Info;
-
import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
/**
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
index ca09b30..2682186 100644
--- a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
@@ -1,5 +1,5 @@
/* DSSISynthesizer.java -- DSSI Synthesizer Provider
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,9 +55,6 @@ import javax.sound.midi.Synthesizer;
import javax.sound.midi.Transmitter;
import javax.sound.midi.VoiceStatus;
-// FIXME: This import in only required for gcj it seems.
-import javax.sound.midi.MidiDevice.Info;
-
/**
* DSSI soft-synth support.
*
diff --git a/libjava/classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java b/libjava/classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java
index 06732e4..77bac12 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/CharacterAttributeTranslator.java
@@ -74,7 +74,7 @@ public class CharacterAttributeTranslator
colorMap.put("teal" , "#008080");
colorMap.put("white" , "#FFFFFF");
colorMap.put("yellow" , "#FFFF00");
- };
+ }
/**
* Convert the color string represenation into java.awt.Color. The valid
diff --git a/libjava/classpath/gnu/javax/swing/text/html/css/CSSParser.java b/libjava/classpath/gnu/javax/swing/text/html/css/CSSParser.java
index 5647e25..1f8fdfa 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/css/CSSParser.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/css/CSSParser.java
@@ -308,7 +308,9 @@ public class CSSParser
{
// FIXME: Handle block and ATKEYWORD.
boolean success = parseAny(s);
- while (parseAny(s));
+ while (parseAny(s))
+ ;
+
return success;
}
@@ -329,7 +331,8 @@ public class CSSParser
boolean ret = parseAny(sel);
if (ret)
{
- while (parseAny(sel));
+ while (parseAny(sel))
+ ;
}
return ret;
}
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/gnuDTD.java b/libjava/classpath/gnu/javax/swing/text/html/parser/gnuDTD.java
index 1f4b3ec..5924e0f 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/gnuDTD.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/gnuDTD.java
@@ -390,7 +390,6 @@ public class gnuDTD
allowed.add(allowed_values [ i ]);
}
}
- ;
AttributeList attr =
new AttributeList(name, type, modifier, default_value, allowed, null);
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java b/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
index 3a40731..c0d1e63 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
@@ -1382,7 +1382,7 @@ public class Parser
if (c == '\r')
buffer.append(' '); // CR replaced by space
else if (c == '\n')
- ; // LF ignored
+ { /* LF ignored */ }
else if (c == '\t')
buffer.append(' '); // Tab replaced by space
else