summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/java/beans/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/java/beans/decoder')
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/AbstractContext.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java6
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java144
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ArrayContext.java12
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java52
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/AssemblyException.java4
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ByteHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/CharHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ClassHandler.java6
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java20
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/Context.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/DecoderContext.java6
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/DummyContext.java16
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/DummyHandler.java12
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ElementHandler.java16
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/FloatHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java12
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/IndexContext.java12
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/IntHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/JavaHandler.java4
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/LongHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/MethodContext.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/MethodFinder.java264
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/NullHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ObjectContext.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java140
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java838
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/PropertyContext.java22
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/ShortHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java10
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java14
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/StringHandler.java2
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/VoidHandler.java4
36 files changed, 822 insertions, 822 deletions
diff --git a/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java b/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java
index 0e95d432986..e6f90e21f0d 100644
--- a/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java b/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
index 47f04fa1cbe..d108f191c55 100644
--- a/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
@@ -7,7 +7,7 @@ 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
@@ -65,7 +65,7 @@ abstract class AbstractCreatableObjectContext extends AbstractObjectContext
/** Adds a parameter object to this Context. Implement this without caring
* for illegal states because this has been done already.
*
- * @param obj The parameter object to be added.
+ * @param obj The parameter object to be added.
*/
protected abstract void addParameterObjectImpl(Object obj);
@@ -83,7 +83,7 @@ abstract class AbstractCreatableObjectContext extends AbstractObjectContext
/** Creates the result object. This method is called only once. Implement this
* without checking for double invocations as this is already being prevented.
*
- * @param outerContext The Context that exists around this one.
+ * @param outerContext The Context that exists around this one.
* @return The result object.
* @throws AssemblerException if the object creation fails somehow.
*/
diff --git a/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java b/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java
index e5578a990bc..51765658fe1 100644
--- a/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java
@@ -7,7 +7,7 @@ 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
@@ -91,21 +91,21 @@ abstract class AbstractElementHandler implements ElementHandler
{
try
{
- // lets the subclass create the appropriate Context instance
- context = startElement(attributes, exceptionListener);
+ // lets the subclass create the appropriate Context instance
+ context = startElement(attributes, exceptionListener);
}
catch (AssemblyException pe)
{
- Throwable t = pe.getCause();
+ Throwable t = pe.getCause();
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");
+ if (t instanceof Exception)
+ exceptionListener.exceptionThrown((Exception) t);
+ else
+ throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");
- notifyContextFailed();
+ notifyContextFailed();
- return;
+ return;
}
}
@@ -129,48 +129,48 @@ abstract class AbstractElementHandler implements ElementHandler
// is then invalid or may not exist at all)
if (!hasFailed)
{
- try
- {
- // note: the order of operations is very important here
- // sends the stored character data to the Context
- endElement(buffer.toString());
-
- // reports to the parent handler if this handler's Context is a
- // statement (returning no value BACK to the parent's Context)
- if (context.isStatement())
- {
- // This may create a valid result in the parent's Context
- // or let it fail
- parent.notifyStatement(exceptionListener);
-
- // skips any further processing if the parent handler is now marked
- // as failed
- if (parent.hasFailed())
- return;
- }
-
- // processes the Context and stores the result
- putObject(context.getId(), context.endContext(parent.getContext()));
-
- // transfers the Context's results to the parent's Context
- // if it is an expression (rather than a statement)
- if (! context.isStatement())
- parent.getContext().addParameterObject(context.getResult());
- }
- catch (AssemblyException pe)
- {
- // notifies that an exception was thrown in this handler's Context
- Throwable t = pe.getCause();
-
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw (InternalError) new InternalError("Severe problem while decoding XML data.")
- .initCause(t);
-
- // marks the handler as failed
- notifyContextFailed();
- }
+ try
+ {
+ // note: the order of operations is very important here
+ // sends the stored character data to the Context
+ endElement(buffer.toString());
+
+ // reports to the parent handler if this handler's Context is a
+ // statement (returning no value BACK to the parent's Context)
+ if (context.isStatement())
+ {
+ // This may create a valid result in the parent's Context
+ // or let it fail
+ parent.notifyStatement(exceptionListener);
+
+ // skips any further processing if the parent handler is now marked
+ // as failed
+ if (parent.hasFailed())
+ return;
+ }
+
+ // processes the Context and stores the result
+ putObject(context.getId(), context.endContext(parent.getContext()));
+
+ // transfers the Context's results to the parent's Context
+ // if it is an expression (rather than a statement)
+ if (! context.isStatement())
+ parent.getContext().addParameterObject(context.getResult());
+ }
+ catch (AssemblyException pe)
+ {
+ // notifies that an exception was thrown in this handler's Context
+ Throwable t = pe.getCause();
+
+ if (t instanceof Exception)
+ exceptionListener.exceptionThrown((Exception) t);
+ else
+ throw (InternalError) new InternalError("Severe problem while decoding XML data.")
+ .initCause(t);
+
+ // marks the handler as failed
+ notifyContextFailed();
+ }
}
}
@@ -184,31 +184,31 @@ abstract class AbstractElementHandler implements ElementHandler
{
try
{
-
- // propagates to parent handler first to generate objects
- // needed by this Context instance
- if(context.isStatement())
- {
- parent.notifyStatement(exceptionListener);
- }
-
- // Some Context instances do stuff which can fail now. If that
- // happens this handler is marked as failed.
- context.notifyStatement(parent.getContext());
+
+ // propagates to parent handler first to generate objects
+ // needed by this Context instance
+ if(context.isStatement())
+ {
+ parent.notifyStatement(exceptionListener);
+ }
+
+ // Some Context instances do stuff which can fail now. If that
+ // happens this handler is marked as failed.
+ context.notifyStatement(parent.getContext());
}
catch (AssemblyException ae)
{
- // notifies that an exception was thrown in this handler's Context
- Throwable t = ae.getCause();
+ // notifies that an exception was thrown in this handler's Context
+ Throwable t = ae.getCause();
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw (InternalError) new InternalError("Severe problem while decoding XML data.")
- .initCause(t);
+ if (t instanceof Exception)
+ exceptionListener.exceptionThrown((Exception) t);
+ else
+ throw (InternalError) new InternalError("Severe problem while decoding XML data.")
+ .initCause(t);
- // marks the handler as failed
- notifyContextFailed();
+ // marks the handler as failed
+ notifyContextFailed();
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java b/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java
index 202c33b3413..963ef09058a 100644
--- a/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java b/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java
index cf4267f2779..bdec1c647e0 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java
@@ -7,7 +7,7 @@ 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
@@ -67,7 +67,7 @@ class ArrayContext extends AbstractContext
*/
public void notifyStatement(Context outerContext)
{
- // method call intentionally ignored because there is not any useful effect
+ // method call intentionally ignored because there is not any useful effect
}
/* (non-Javadoc)
@@ -92,11 +92,11 @@ class ArrayContext extends AbstractContext
{
try
{
- Array.set(array, index, o);
+ Array.set(array, index, o);
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
- throw new AssemblyException(aioobe);
+ throw new AssemblyException(aioobe);
}
}
@@ -104,11 +104,11 @@ class ArrayContext extends AbstractContext
{
try
{
- return Array.get(array, index);
+ return Array.get(array, index);
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
- throw new AssemblyException(aioobe);
+ throw new AssemblyException(aioobe);
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java b/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
index 23f0285192b..28930f51944 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
@@ -7,7 +7,7 @@ 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
@@ -86,31 +86,31 @@ class ArrayHandler extends AbstractElementHandler
if (className != null)
{
- try
- {
- Class klass;
-
- if (typeMap.containsKey(className))
- klass = (Class) typeMap.get(className);
- else
- klass = instantiateClass(className);
-
- String length = attributes.getValue("length");
- if (length != null)
- // creates Array with predefined length
- return new ArrayContext(id, klass, Integer.parseInt(length));
- else
- // creates Array without length restriction
- return new GrowableArrayContext(id, klass);
- }
- catch (ClassNotFoundException cnfe)
- {
- throw new AssemblyException(cnfe);
- }
- catch (NumberFormatException nfe)
- {
- throw new AssemblyException(nfe);
- }
+ try
+ {
+ Class klass;
+
+ if (typeMap.containsKey(className))
+ klass = (Class) typeMap.get(className);
+ else
+ klass = instantiateClass(className);
+
+ String length = attributes.getValue("length");
+ if (length != null)
+ // creates Array with predefined length
+ return new ArrayContext(id, klass, Integer.parseInt(length));
+ else
+ // creates Array without length restriction
+ return new GrowableArrayContext(id, klass);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new AssemblyException(cnfe);
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new AssemblyException(nfe);
+ }
}
throw new AssemblyException(new IllegalArgumentException("Missing 'class' attribute in <array> tag."));
diff --git a/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java b/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java
index 29dfa65ac7c..206c5841b69 100644
--- a/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java
+++ b/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java
@@ -7,7 +7,7 @@ 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
@@ -41,7 +41,7 @@ package gnu.java.beans.decoder;
/** The AssemblyException is used to wrap the cause of problems when assembling objects.
* In all cases only the wrapped exception is given to the PersistenceParser's
* ExceptionListener instance (never the AssemblyException itself).
- *
+ *
* <p>Note: Often multiple steps are needed to construct a fully usuable object instance.
* Such a construction can be called assembly and thats why this exception was
* named AssemblyException.</p>
diff --git a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
index a675e8c9012..20aed9a3fed 100644
--- a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java b/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java
index d6c33d14d21..830bbc74768 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/CharHandler.java b/libjava/classpath/gnu/java/beans/decoder/CharHandler.java
index 1b31e5b0559..114df8b79ce 100644
--- a/libjava/classpath/gnu/java/beans/decoder/CharHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/CharHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java b/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java
index 1dbdd63e79a..c67a79a4806 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java
@@ -7,7 +7,7 @@ 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
@@ -56,11 +56,11 @@ class ClassHandler extends SimpleHandler
{
try
{
- return instantiateClass(characters);
+ return instantiateClass(characters);
}
catch (ClassNotFoundException cnfe)
{
- throw new AssemblyException(cnfe);
+ throw new AssemblyException(cnfe);
}
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java b/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java
index 7838fb7e263..32365eef4e0 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java
@@ -7,7 +7,7 @@ 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
@@ -57,7 +57,7 @@ class ConstructorContext extends AbstractCreatableObjectContext
ConstructorContext(String id, Class newClass)
{
setId(id);
- // sets superclass field
+ // sets superclass field
klass = newClass;
}
@@ -76,27 +76,27 @@ class ConstructorContext extends AbstractCreatableObjectContext
try
{
- Constructor constructor = MethodFinder.getConstructor(klass, args);
+ Constructor constructor = MethodFinder.getConstructor(klass, args);
- // instantiates object (klass field gets re-set by superclass)
- return constructor.newInstance(args);
+ // instantiates object (klass field gets re-set by superclass)
+ return constructor.newInstance(args);
}
catch (NoSuchMethodException nsme)
{
- throw new AssemblyException(nsme);
+ throw new AssemblyException(nsme);
}
catch (InvocationTargetException ite)
{
- throw new AssemblyException(ite.getCause());
+ throw new AssemblyException(ite.getCause());
}
catch (IllegalAccessException iae)
{
- throw new AssemblyException(iae);
+ throw new AssemblyException(iae);
}
catch (InstantiationException ie)
{
- throw new AssemblyException(ie);
+ throw new AssemblyException(ie);
}
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/Context.java b/libjava/classpath/gnu/java/beans/decoder/Context.java
index a2db09732d1..4bdbc9ce5eb 100644
--- a/libjava/classpath/gnu/java/beans/decoder/Context.java
+++ b/libjava/classpath/gnu/java/beans/decoder/Context.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java b/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java
index 69d84e57656..174a3b71b21 100644
--- a/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java
@@ -7,7 +7,7 @@ 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
@@ -113,12 +113,12 @@ public class DecoderContext extends AbstractContext
}
/** Returns an Iterator that retrieves the assembled objects.
- *
+ *
* @return An Iterator retrieving assembled objects.
*/
public Iterator iterator()
{
return objects.iterator();
}
-
+
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java b/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java
index 8f6be7ec092..1a14fbabffc 100644
--- a/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/DummyContext.java b/libjava/classpath/gnu/java/beans/decoder/DummyContext.java
index f3b24549de2..03f209c8cf4 100644
--- a/libjava/classpath/gnu/java/beans/decoder/DummyContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/DummyContext.java
@@ -7,7 +7,7 @@ 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
@@ -60,7 +60,7 @@ public class DummyContext extends AbstractContext
*/
public void notifyStatement(Context outerContext) throws AssemblyException
{
- // intentionally ignored
+ // intentionally ignored
}
/* (non-Javadoc)
@@ -69,7 +69,7 @@ public class DummyContext extends AbstractContext
public Object endContext(Context outerContext) throws AssemblyException
{
fail();
- return null;
+ return null;
}
/* (non-Javadoc)
@@ -78,7 +78,7 @@ public class DummyContext extends AbstractContext
public boolean subContextFailed()
{
fail();
- return false;
+ return false;
}
/* (non-Javadoc)
@@ -95,7 +95,7 @@ public class DummyContext extends AbstractContext
public Object get(int index) throws AssemblyException
{
fail();
- return null;
+ return null;
}
/* (non-Javadoc)
@@ -104,13 +104,13 @@ public class DummyContext extends AbstractContext
public Object getResult()
{
fail();
- return null;
+ return null;
}
private void fail()
{
throw new InternalError("Invoking the DummyContext is not expected"
- + " - Please file a bug report at"
- + " http://www/gnu.org/software/classpath/.");
+ + " - Please file a bug report at"
+ + " http://www/gnu.org/software/classpath/.");
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java b/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java
index 880d76adc0e..f9c133e5483 100644
--- a/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java
@@ -7,7 +7,7 @@ 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
@@ -89,7 +89,7 @@ class DummyHandler implements ElementHandler
throws ClassNotFoundException
{
fail();
- return null;
+ return null;
}
/* (non-Javadoc)
@@ -138,19 +138,19 @@ class DummyHandler implements ElementHandler
public Object getObject(String objectId)
{
fail();
- return null;
+ return null;
}
public ElementHandler getParent()
{
fail();
- return null;
+ return null;
}
private void fail()
{
throw new InternalError("Invoking the DummyHandler is not expected"
- + " - Please file a bug report at "
- + " http://www.gnu.org/software/classpath/.");
+ + " - Please file a bug report at "
+ + " http://www.gnu.org/software/classpath/.");
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java b/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java
index e6ae60af886..12e945bbfd5 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java
@@ -7,7 +7,7 @@ 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
@@ -72,19 +72,19 @@ interface ElementHandler
/** Returns whether a subelement of the given name is allowed. The rules
* for evaluating this are derived from the javabeans.dtd which can be found
* here: <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3">Java Persistence Article</a>.
- *
- * @param subElementName
+ *
+ * @param subElementName
* @return
*/
boolean isSubelementAllowed(String subElementName);
/** Provides the same functionality as Class.forName() but allows the decoder
* to use a different class loader.
- *
+ *
* @param className
* @return
* @throws ClassNotFoundException
- */
+ */
Class instantiateClass(String className) throws ClassNotFoundException;
/** Notifies the handler's Context that its child Context will not return
@@ -104,21 +104,21 @@ interface ElementHandler
boolean hasFailed();
/** Returns the Context instance this handler is working on.
- *
+ *
* @return The handler's Context instance.
*/
Context getContext();
/** Notifies the handler that its Context failed and starts a recursive
* invocation of the parent handler if it is affected by that failure.
- *
+ *
* Although the method is a public API member it is only used internally.
*/
void notifyContextFailed();
/** Stores the object under the given id. The object is not stored if the
* id is null.
- *
+ *
* @param objectId
* @param o
*/
diff --git a/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java b/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java
index 5f0e15cefed..443f38f9199 100644
--- a/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java b/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java
index f24a60b4a4b..fb386d1d581 100644
--- a/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java
@@ -7,7 +7,7 @@ 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
@@ -46,11 +46,11 @@ import java.lang.reflect.Array;
class GrowableArrayContext extends AbstractContext
{
private static final int INITIAL_SIZE = 16;
-
+
private Class klass;
private Object array;
private int length;
-
+
GrowableArrayContext(String id, Class newClass)
{
setId(id);
@@ -69,7 +69,7 @@ class GrowableArrayContext extends AbstractContext
System.arraycopy(array, 0, tmp, 0, length);
array = tmp;
}
-
+
try {
Array.set(array, length++, o);
} catch(IllegalArgumentException iae) {
@@ -97,7 +97,7 @@ class GrowableArrayContext extends AbstractContext
System.arraycopy(array, 0, tmp, 0, length);
array = tmp;
}
-
+
return array;
}
@@ -119,7 +119,7 @@ class GrowableArrayContext extends AbstractContext
try {
Array.set(array, index, o);
} catch(IllegalArgumentException iae) {
- throw new AssemblyException(iae);
+ throw new AssemblyException(iae);
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/IndexContext.java b/libjava/classpath/gnu/java/beans/decoder/IndexContext.java
index 11f840caeec..b5af9019f4c 100644
--- a/libjava/classpath/gnu/java/beans/decoder/IndexContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/IndexContext.java
@@ -7,7 +7,7 @@ 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
@@ -65,8 +65,8 @@ class IndexContext extends AbstractContext
{
if (! isSetter)
{
- argument = o;
- isSetter = true;
+ argument = o;
+ isSetter = true;
}
else
throw new AssemblyException(new IllegalStateException("More than one argument for indiced access is not possible."));
@@ -87,10 +87,10 @@ class IndexContext extends AbstractContext
{
if (isSetter)
{
- // setter
- outerContext.set(index, argument);
+ // setter
+ outerContext.set(index, argument);
- return null;
+ return null;
}
else
// getter
diff --git a/libjava/classpath/gnu/java/beans/decoder/IntHandler.java b/libjava/classpath/gnu/java/beans/decoder/IntHandler.java
index a96f4a0315b..bbd3560d735 100644
--- a/libjava/classpath/gnu/java/beans/decoder/IntHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/IntHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java b/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java
index 3bc8c60288c..c4b4f92c5ce 100644
--- a/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java
@@ -7,7 +7,7 @@ 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
@@ -69,7 +69,7 @@ public class JavaHandler extends AbstractElementHandler
protected Context startElement(Attributes attributes, ExceptionListener exceptionListener)
throws AssemblyException
{
- // may expect version and class attribute but it not used in JDK
+ // may expect version and class attribute but it not used in JDK
// so we do either
return context;
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/LongHandler.java b/libjava/classpath/gnu/java/beans/decoder/LongHandler.java
index d7bfa54e54e..13e0a8dde28 100644
--- a/libjava/classpath/gnu/java/beans/decoder/LongHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/LongHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/MethodContext.java b/libjava/classpath/gnu/java/beans/decoder/MethodContext.java
index bad0a213f7f..84eead7a025 100644
--- a/libjava/classpath/gnu/java/beans/decoder/MethodContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/MethodContext.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java b/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java
index 3968b173adb..82783fbdefd 100644
--- a/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java
+++ b/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java
@@ -7,7 +7,7 @@ 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
@@ -43,135 +43,135 @@ import java.util.HashMap;
class MethodFinder
{
- /** Provides a mapping between a wrapper class and its corresponding primitive's type. */
- private static HashMap typeMapping = new HashMap();
-
- static {
- typeMapping.put(Byte.class, Byte.TYPE);
- typeMapping.put(Short.class, Short.TYPE);
- typeMapping.put(Integer.class, Integer.TYPE);
- typeMapping.put(Long.class, Long.TYPE);
- typeMapping.put(Float.class, Float.TYPE);
- typeMapping.put(Double.class, Double.TYPE);
-
- typeMapping.put(Character.class, Character.TYPE);
- typeMapping.put(Boolean.class, Boolean.TYPE);
- }
-
- private MethodFinder()
- {
- }
-
- /** Searches a Method which can accept the given arguments.
- *
- * @param klass
- * @param name
- * @param arguments
- * @return
- * @throws NoSuchMethodException
- */
- static Method getMethod(Class klass, String name, Object[] arguments)
- throws NoSuchMethodException
- {
- // prepares array containing the types of the arguments
- Class[] argumentTypes = getArgumentTypes(arguments);
-
- Method[] methods = klass.getMethods();
-
- // iterates over all public methods
- for (int i = 0; i < methods.length; i++)
- {
- if (methods[i].getName().equals(name))
- {
- if (matchingArgumentTypes(methods[i].getParameterTypes(),
- argumentTypes))
- return methods[i];
- }
- }
-
- throw new NoSuchMethodException(
- "Could not find a matching method named "
- + name
- + "() in class "
- + klass);
- }
-
- static Constructor getConstructor(Class klass, Object[] arguments)
- throws NoSuchMethodException
- {
- Class[] argumentTypes = getArgumentTypes(arguments);
- Constructor[] constructors = klass.getConstructors();
-
- // iterates over all public methods
- for (int i = 0; i < constructors.length; i++)
- {
- if (matchingArgumentTypes(constructors[i].getParameterTypes(),
- argumentTypes))
- return constructors[i];
- }
-
- throw new NoSuchMethodException(
- "Could not find a matching constructor in class " + klass);
- }
-
- /** Transforms an array of argument objects into an array of argument types.
- * For each argument being null the argument is null, too. An argument type
- * being null means: Accepts everything (although this can be ambigous).
- *
- * @param arguments
- * @return
- */
- private static Class[] getArgumentTypes(Object[] arguments)
- {
- if (arguments == null)
- return new Class[0];
-
- // prepares array containing the types of the arguments
- Class[] argumentTypes = new Class[arguments.length];
- for (int i = 0; i < arguments.length; i++)
- argumentTypes[i] =
- (arguments[i] == null) ? null : arguments[i].getClass();
- return argumentTypes;
- }
-
- /** Tests whether the argument types supplied to the method argument types
- * are assignable. In addition to the assignment specifications this method
- * handles the primitive's wrapper classes as if they were of their
- * primitive type (e.g Boolean.class equals Boolean.TYPE).
- * When a supplied argument type is null it is assumed that no argument
- * object was supplied for it and the test for this particular parameter will
- * pass.
- *
- * @param methodArgTypes
- * @param suppliedArgTypes
- * @return
- */
- private static boolean matchingArgumentTypes(
- Class[] methodArgTypes,
- Class[] suppliedArgTypes)
- {
- if (methodArgTypes.length != suppliedArgTypes.length)
- return false;
-
- for (int i = 0; i < methodArgTypes.length; i++)
- {
- if (suppliedArgTypes[i] == null)
- {
- // by definition a non-existant argument type (null) can be converted to everything
- continue;
- }
- else if (typeMapping.containsKey(suppliedArgTypes[i]))
- {
- Class primitiveType =
- (Class) typeMapping.get(suppliedArgTypes[i]);
- if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])
- || methodArgTypes[i].isAssignableFrom(primitiveType)))
- return false;
- }
- else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]))
- return false;
- }
-
- return true;
- }
+ /** Provides a mapping between a wrapper class and its corresponding primitive's type. */
+ private static HashMap typeMapping = new HashMap();
+
+ static {
+ typeMapping.put(Byte.class, Byte.TYPE);
+ typeMapping.put(Short.class, Short.TYPE);
+ typeMapping.put(Integer.class, Integer.TYPE);
+ typeMapping.put(Long.class, Long.TYPE);
+ typeMapping.put(Float.class, Float.TYPE);
+ typeMapping.put(Double.class, Double.TYPE);
+
+ typeMapping.put(Character.class, Character.TYPE);
+ typeMapping.put(Boolean.class, Boolean.TYPE);
+ }
+
+ private MethodFinder()
+ {
+ }
+
+ /** Searches a Method which can accept the given arguments.
+ *
+ * @param klass
+ * @param name
+ * @param arguments
+ * @return
+ * @throws NoSuchMethodException
+ */
+ static Method getMethod(Class klass, String name, Object[] arguments)
+ throws NoSuchMethodException
+ {
+ // prepares array containing the types of the arguments
+ Class[] argumentTypes = getArgumentTypes(arguments);
+
+ Method[] methods = klass.getMethods();
+
+ // iterates over all public methods
+ for (int i = 0; i < methods.length; i++)
+ {
+ if (methods[i].getName().equals(name))
+ {
+ if (matchingArgumentTypes(methods[i].getParameterTypes(),
+ argumentTypes))
+ return methods[i];
+ }
+ }
+
+ throw new NoSuchMethodException(
+ "Could not find a matching method named "
+ + name
+ + "() in class "
+ + klass);
+ }
+
+ static Constructor getConstructor(Class klass, Object[] arguments)
+ throws NoSuchMethodException
+ {
+ Class[] argumentTypes = getArgumentTypes(arguments);
+ Constructor[] constructors = klass.getConstructors();
+
+ // iterates over all public methods
+ for (int i = 0; i < constructors.length; i++)
+ {
+ if (matchingArgumentTypes(constructors[i].getParameterTypes(),
+ argumentTypes))
+ return constructors[i];
+ }
+
+ throw new NoSuchMethodException(
+ "Could not find a matching constructor in class " + klass);
+ }
+
+ /** Transforms an array of argument objects into an array of argument types.
+ * For each argument being null the argument is null, too. An argument type
+ * being null means: Accepts everything (although this can be ambigous).
+ *
+ * @param arguments
+ * @return
+ */
+ private static Class[] getArgumentTypes(Object[] arguments)
+ {
+ if (arguments == null)
+ return new Class[0];
+
+ // prepares array containing the types of the arguments
+ Class[] argumentTypes = new Class[arguments.length];
+ for (int i = 0; i < arguments.length; i++)
+ argumentTypes[i] =
+ (arguments[i] == null) ? null : arguments[i].getClass();
+ return argumentTypes;
+ }
+
+ /** Tests whether the argument types supplied to the method argument types
+ * are assignable. In addition to the assignment specifications this method
+ * handles the primitive's wrapper classes as if they were of their
+ * primitive type (e.g Boolean.class equals Boolean.TYPE).
+ * When a supplied argument type is null it is assumed that no argument
+ * object was supplied for it and the test for this particular parameter will
+ * pass.
+ *
+ * @param methodArgTypes
+ * @param suppliedArgTypes
+ * @return
+ */
+ private static boolean matchingArgumentTypes(
+ Class[] methodArgTypes,
+ Class[] suppliedArgTypes)
+ {
+ if (methodArgTypes.length != suppliedArgTypes.length)
+ return false;
+
+ for (int i = 0; i < methodArgTypes.length; i++)
+ {
+ if (suppliedArgTypes[i] == null)
+ {
+ // by definition a non-existant argument type (null) can be converted to everything
+ continue;
+ }
+ else if (typeMapping.containsKey(suppliedArgTypes[i]))
+ {
+ Class primitiveType =
+ (Class) typeMapping.get(suppliedArgTypes[i]);
+ if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])
+ || methodArgTypes[i].isAssignableFrom(primitiveType)))
+ return false;
+ }
+ else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]))
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/NullHandler.java b/libjava/classpath/gnu/java/beans/decoder/NullHandler.java
index 549617db3cb..01c9727d415 100644
--- a/libjava/classpath/gnu/java/beans/decoder/NullHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/NullHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java b/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java
index cf88a2c2c5c..883c1d600a6 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java b/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java
index dc5b3290bb1..ececfbbe272 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java
@@ -7,7 +7,7 @@ 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
@@ -90,78 +90,78 @@ public class ObjectHandler extends AbstractElementHandler
// decides whether we are in a static (className present) or dynamic context
if (className != null)
{
- try
- {
- Class klass = instantiateClass(className);
-
- // class name exists which means that we are in a static context.
- // so we may want to ...
- // access a static field if the fieldName exists
- if (fieldName != null)
- {
- try
- {
- return new ObjectContext(id,
- klass.getField(fieldName).get(null));
- }
- catch (NoSuchFieldException nsfe)
- {
- throw new AssemblyException(nsfe);
- }
- catch (IllegalAccessException iae)
- {
- throw new AssemblyException(iae);
- }
- }
-
- // (falling through is important!)
- // run a constructor if methodName is "new" or null
- if (methodName == null || methodName.equals("new"))
- return new ConstructorContext(id, klass);
-
- // (falling through is important!)
- // run a static method on the given class (if methodName exists, which is implied already)
- return new StaticMethodContext(id, klass, methodName);
- // XXX: should fail if unexpected attributes are present?
- }
- catch (ClassNotFoundException cnfe)
- {
- throw new AssemblyException(cnfe);
- }
+ try
+ {
+ Class klass = instantiateClass(className);
+
+ // class name exists which means that we are in a static context.
+ // so we may want to ...
+ // access a static field if the fieldName exists
+ if (fieldName != null)
+ {
+ try
+ {
+ return new ObjectContext(id,
+ klass.getField(fieldName).get(null));
+ }
+ catch (NoSuchFieldException nsfe)
+ {
+ throw new AssemblyException(nsfe);
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new AssemblyException(iae);
+ }
+ }
+
+ // (falling through is important!)
+ // run a constructor if methodName is "new" or null
+ if (methodName == null || methodName.equals("new"))
+ return new ConstructorContext(id, klass);
+
+ // (falling through is important!)
+ // run a static method on the given class (if methodName exists, which is implied already)
+ return new StaticMethodContext(id, klass, methodName);
+ // XXX: should fail if unexpected attributes are present?
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new AssemblyException(cnfe);
+ }
}
else
{
- // className does not exist which means we are in the context of
- // some object and want to ...
- // access the get(int index) method if index != null
- if (index != null)
- {
- try
- {
- // Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says
- // that <void index="4"/> will make up a get()-call. But this is wrong because
- // <void/> tags never return values (to the surrounding context)
- return new IndexContext(id, Integer.parseInt(index));
- }
- catch (NumberFormatException nfe)
- {
- throw new AssemblyException(nfe);
- }
- }
-
- // access a method if methodName exists
- if (methodName != null)
- return new MethodContext(id, methodName);
-
- // (falling through is important!)
- // access a property if a propertyName exists
- if (propertyName != null && propertyName.length() > 0)
- // this is reported as an ordinary method access where the propertyName is
- // converted into a 'getter'-method name: convert first character of property name
- // to upper case and prepend 'get'
- // Note: This will be a getter-method because the <object> tag implies that a return
- // value is expected.
- return new PropertyContext(id, propertyName);
+ // className does not exist which means we are in the context of
+ // some object and want to ...
+ // access the get(int index) method if index != null
+ if (index != null)
+ {
+ try
+ {
+ // Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says
+ // that <void index="4"/> will make up a get()-call. But this is wrong because
+ // <void/> tags never return values (to the surrounding context)
+ return new IndexContext(id, Integer.parseInt(index));
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new AssemblyException(nfe);
+ }
+ }
+
+ // access a method if methodName exists
+ if (methodName != null)
+ return new MethodContext(id, methodName);
+
+ // (falling through is important!)
+ // access a property if a propertyName exists
+ if (propertyName != null && propertyName.length() > 0)
+ // this is reported as an ordinary method access where the propertyName is
+ // converted into a 'getter'-method name: convert first character of property name
+ // to upper case and prepend 'get'
+ // Note: This will be a getter-method because the <object> tag implies that a return
+ // value is expected.
+ return new PropertyContext(id, propertyName);
}
throw new AssemblyException(new IllegalArgumentException("Wrong or missing attributes for <object> tag."));
diff --git a/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java b/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java
index 4eb37abef97..c4c8866c3c7 100644
--- a/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java
+++ b/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java
@@ -62,424 +62,424 @@ import org.xml.sax.helpers.DefaultHandler;
*/
public class PersistenceParser extends DefaultHandler implements Context
{
- /** The ExceptionListener instance which is informed of non-critical parsing exceptions.
- */
- private ExceptionListener exceptionListener;
-
- /** When an element was not usable all elements inside it should be skipped.
- * This is done by skipping startElement() and endElement() invocations whenever
- * this value is above 0.
- */
- private int skipElement;
-
- /** Stores the Creator instances which can instantiate the appropriate handler implementation
- * for a given element.
- */
- private HashMap handlerCreators = new HashMap();
-
- /** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned
- * with a DummyHandler instance which must not be used but acts as a root element.
- */
- private ElementHandler currentHandler;
-
- /** The real root element that stores all objects created during parsing.
- * Package-private to avoid an accessor method.
- */
- JavaHandler javaHandler;
-
- /** Stores the decoded objects. */
- private List objects = new LinkedList();
-
- /** The XMLDecoder instance that started this PersistenceParser */
- private XMLDecoder decoder;
-
- /** Creates a PersistenceParser which reads XML data from the given InputStream, reports
- * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext
- * and uses the given ClassLoader to resolve classes.
- *
- * @param inputStream
- * @param exceptionListener
- * @param decoderContext
- * @param cl
- */
- public PersistenceParser(
- InputStream inputStream,
- ExceptionListener exceptionListener,
- ClassLoader cl,
- XMLDecoder decoder)
- {
-
- this.exceptionListener = exceptionListener;
- this.decoder = decoder;
-
- DummyHandler dummyHandler = new DummyHandler();
- currentHandler = dummyHandler;
- javaHandler = new JavaHandler(dummyHandler, this, cl);
-
- SAXParserFactory factory = SAXParserFactory.newInstance();
-
- SAXParser parser;
- try
- {
- parser = factory.newSAXParser();
- }
- catch (ParserConfigurationException pce)
- {
- // should not happen when a parser is available because we did
- // not request any requirements on the XML parser
- throw (InternalError) new InternalError(
- "No SAX Parser available.").initCause(
- pce);
- }
- catch (SAXException saxe)
- {
- // should not happen when a parser is available because we did
- // not request any requirements on the XML parser
- throw (InternalError) new InternalError(
- "No SAX Parser available.").initCause(
- saxe);
- }
-
- // prepares a map of Creator instances which can instantiate a handler which is
- // appropriate for the tag that is used as a key for the Creator
- handlerCreators.put("java", new JavaHandlerCreator());
-
- // calls methods (properties), constructors, access fields
- handlerCreators.put("object", new ObjectHandlerCreator());
- handlerCreators.put("void", new VoidHandlerCreator());
-
- handlerCreators.put("array", new ArrayHandlerCreator());
-
- // these handler directly create an Object (or null)
- handlerCreators.put("class", new ClassHandlerCreator());
- handlerCreators.put("null", new NullHandlerCreator());
-
- handlerCreators.put("char", new CharHandlerCreator());
- handlerCreators.put("string", new StringHandlerCreator());
- handlerCreators.put("boolean", new BooleanHandlerCreator());
- handlerCreators.put("byte", new ByteHandlerCreator());
- handlerCreators.put("short", new ShortHandlerCreator());
- handlerCreators.put("int", new IntHandlerCreator());
- handlerCreators.put("long", new LongHandlerCreator());
- handlerCreators.put("float", new FloatHandlerCreator());
- handlerCreators.put("double", new DoubleHandlerCreator());
-
- // parses the data and sends all exceptions to the ExceptionListener
- try
- {
- parser.parse(inputStream, this);
- }
- catch (SAXException saxe)
- {
- exceptionListener.exceptionThrown(
- new IllegalArgumentException("XML data not well-formed."));
- }
- catch (IOException ioe)
- {
- exceptionListener.exceptionThrown(ioe);
- }
- }
-
- public void startElement(
- String uri,
- String localName,
- String qName,
- Attributes attributes)
- throws SAXException
- {
- /* The element is skipped if
- * a) the current handler has already failed or a previous error occured
- * which makes all children obsolete
- */
- if (currentHandler.hasFailed() || skipElement > 0)
- {
- exceptionListener.exceptionThrown(
- new IllegalArgumentException(
- "Element unusable due to previous error: " + qName));
-
- skipElement++;
-
- return;
- }
-
- /* b) Subelements are not allowed within the current ElementHandler.
- */
- if (!currentHandler.isSubelementAllowed(qName))
- {
- exceptionListener.exceptionThrown(
- new IllegalArgumentException(
- "Element is not allowed here: " + qName));
-
- skipElement++;
-
- return;
- }
-
- /* c) The tag name is not a key in the map of Creator instances. This means that
- * either the XML data is of a newer version or simply contains a miss-spelled element.
- */
- if (!handlerCreators.containsKey(qName))
- {
- exceptionListener.exceptionThrown(
- new IllegalArgumentException(
- "Element unusable because tag is unknown: " + qName));
-
- skipElement++;
-
- return;
- }
-
- // creates a new handler for the new element
- AbstractElementHandler handler =
- ((Creator) handlerCreators.get(qName)).createHandler(
- currentHandler);
-
- // makes it the current handler to receive character data
- currentHandler = handler;
-
- // starts the handler
- currentHandler.start(attributes, exceptionListener);
- }
-
- public void endElement(String uri, String localName, String qName)
- throws SAXException
- {
- // skips processing the current handler if we are parsing an element
- // which was marked invalid (in startElement() )
- if (skipElement > 0)
- {
- skipElement--;
- return;
- }
-
- // invokes the handler's finishing method
- currentHandler.end(exceptionListener);
-
- // removes the current handler and reactivates its parent
- currentHandler = currentHandler.getParent();
- }
-
- /** Transfers character data to the current handler
- */
- public void characters(char[] ch, int start, int length)
- throws SAXException
- {
- // prevents sending character data of invalid elements
- if (skipElement > 0)
- return;
-
- currentHandler.characters(ch, start, length);
- }
-
- /** Creator interface provided a mechanism to instantiate ElementHandler instances
- * for the appropriate tag.
- *
- * @author Robert Schuster
- */
- interface Creator
- {
- /** Creates an ElementHandler instance using the given ElementHandler as its parent.
- *
- * @param parent The parent ElementHandler of the result.
- * @return A new ElementHandler instance.
- */
- AbstractElementHandler createHandler(ElementHandler parent);
- }
-
- class BooleanHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new BooleanHandler(parent);
- }
- }
-
- class ByteHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new ByteHandler(parent);
- }
- }
-
- class ShortHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new ShortHandler(parent);
- }
- }
-
- class IntHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new IntHandler(parent);
- }
- }
-
- class LongHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new LongHandler(parent);
- }
- }
-
- class FloatHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new FloatHandler(parent);
- }
- }
-
- class DoubleHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new DoubleHandler(parent);
- }
- }
-
- class CharHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new CharHandler(parent);
- }
- }
-
- class StringHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new StringHandler(parent);
- }
- }
-
- class JavaHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return javaHandler;
- }
- }
-
- class ObjectHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new ObjectHandler(parent);
- }
- }
-
- class VoidHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new VoidHandler(parent);
- }
- }
-
- class ClassHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new ClassHandler(parent);
- }
- }
-
- class NullHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new NullHandler(parent);
- }
- }
-
- class ArrayHandlerCreator implements Creator
- {
- public AbstractElementHandler createHandler(ElementHandler parent)
- {
- return new ArrayHandler(parent);
- }
- }
-
- /** Adds a decoded object to the Context. */
- public void addParameterObject(Object o) throws AssemblyException
- {
- objects.add(o);
- }
-
- public void notifyStatement(Context outerContext) throws AssemblyException
- {
- // can be ignored because theis Context does not react to statement and expressions
- // differently
- }
-
- public Object endContext(Context outerContext) throws AssemblyException
- {
- return null;
- }
-
- public boolean subContextFailed()
- {
- // failing of subcontexts is no problem for the mother of all contexts
- return false;
- }
-
- public void set(int index, Object o) throws AssemblyException
- {
- // not supported
- throw new AssemblyException(
- new IllegalArgumentException("Set method is not allowed in decoder context."));
- }
-
- public Object get(int index) throws AssemblyException
- {
- // not supported
- throw new AssemblyException(
- new IllegalArgumentException("Get method is not allowed in decoder context."));
- }
-
- public Object getResult()
- {
- // returns the XMLDecoder instance which is requested by child contexts this way.
- // That is needed to invoke methods on the decoder.
- return decoder;
- }
-
- public void setId(String id)
- {
- exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag."));
- }
-
- public String getId()
- {
- // appears to have no id
- return null;
- }
-
- public boolean isStatement()
- {
- // this context is a statement by definition because it never returns anything to a parent because
- // there is no such parent (DummyContext does not count!)
- return true;
- }
-
- public void setStatement(boolean b)
- {
- // ignores that because this Context is always a statement
- }
-
- /** Returns an Iterator instance which returns the decoded objects.
- *
- * This method is used by the XMLDecoder directly.
- */
- public Iterator iterator()
- {
- return objects.iterator();
- }
+ /** The ExceptionListener instance which is informed of non-critical parsing exceptions.
+ */
+ private ExceptionListener exceptionListener;
+
+ /** When an element was not usable all elements inside it should be skipped.
+ * This is done by skipping startElement() and endElement() invocations whenever
+ * this value is above 0.
+ */
+ private int skipElement;
+
+ /** Stores the Creator instances which can instantiate the appropriate handler implementation
+ * for a given element.
+ */
+ private HashMap handlerCreators = new HashMap();
+
+ /** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned
+ * with a DummyHandler instance which must not be used but acts as a root element.
+ */
+ private ElementHandler currentHandler;
+
+ /** The real root element that stores all objects created during parsing.
+ * Package-private to avoid an accessor method.
+ */
+ JavaHandler javaHandler;
+
+ /** Stores the decoded objects. */
+ private List objects = new LinkedList();
+
+ /** The XMLDecoder instance that started this PersistenceParser */
+ private XMLDecoder decoder;
+
+ /** Creates a PersistenceParser which reads XML data from the given InputStream, reports
+ * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext
+ * and uses the given ClassLoader to resolve classes.
+ *
+ * @param inputStream
+ * @param exceptionListener
+ * @param decoderContext
+ * @param cl
+ */
+ public PersistenceParser(
+ InputStream inputStream,
+ ExceptionListener exceptionListener,
+ ClassLoader cl,
+ XMLDecoder decoder)
+ {
+
+ this.exceptionListener = exceptionListener;
+ this.decoder = decoder;
+
+ DummyHandler dummyHandler = new DummyHandler();
+ currentHandler = dummyHandler;
+ javaHandler = new JavaHandler(dummyHandler, this, cl);
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+
+ SAXParser parser;
+ try
+ {
+ parser = factory.newSAXParser();
+ }
+ catch (ParserConfigurationException pce)
+ {
+ // should not happen when a parser is available because we did
+ // not request any requirements on the XML parser
+ throw (InternalError) new InternalError(
+ "No SAX Parser available.").initCause(
+ pce);
+ }
+ catch (SAXException saxe)
+ {
+ // should not happen when a parser is available because we did
+ // not request any requirements on the XML parser
+ throw (InternalError) new InternalError(
+ "No SAX Parser available.").initCause(
+ saxe);
+ }
+
+ // prepares a map of Creator instances which can instantiate a handler which is
+ // appropriate for the tag that is used as a key for the Creator
+ handlerCreators.put("java", new JavaHandlerCreator());
+
+ // calls methods (properties), constructors, access fields
+ handlerCreators.put("object", new ObjectHandlerCreator());
+ handlerCreators.put("void", new VoidHandlerCreator());
+
+ handlerCreators.put("array", new ArrayHandlerCreator());
+
+ // these handler directly create an Object (or null)
+ handlerCreators.put("class", new ClassHandlerCreator());
+ handlerCreators.put("null", new NullHandlerCreator());
+
+ handlerCreators.put("char", new CharHandlerCreator());
+ handlerCreators.put("string", new StringHandlerCreator());
+ handlerCreators.put("boolean", new BooleanHandlerCreator());
+ handlerCreators.put("byte", new ByteHandlerCreator());
+ handlerCreators.put("short", new ShortHandlerCreator());
+ handlerCreators.put("int", new IntHandlerCreator());
+ handlerCreators.put("long", new LongHandlerCreator());
+ handlerCreators.put("float", new FloatHandlerCreator());
+ handlerCreators.put("double", new DoubleHandlerCreator());
+
+ // parses the data and sends all exceptions to the ExceptionListener
+ try
+ {
+ parser.parse(inputStream, this);
+ }
+ catch (SAXException saxe)
+ {
+ exceptionListener.exceptionThrown(
+ new IllegalArgumentException("XML data not well-formed."));
+ }
+ catch (IOException ioe)
+ {
+ exceptionListener.exceptionThrown(ioe);
+ }
+ }
+
+ public void startElement(
+ String uri,
+ String localName,
+ String qName,
+ Attributes attributes)
+ throws SAXException
+ {
+ /* The element is skipped if
+ * a) the current handler has already failed or a previous error occured
+ * which makes all children obsolete
+ */
+ if (currentHandler.hasFailed() || skipElement > 0)
+ {
+ exceptionListener.exceptionThrown(
+ new IllegalArgumentException(
+ "Element unusable due to previous error: " + qName));
+
+ skipElement++;
+
+ return;
+ }
+
+ /* b) Subelements are not allowed within the current ElementHandler.
+ */
+ if (!currentHandler.isSubelementAllowed(qName))
+ {
+ exceptionListener.exceptionThrown(
+ new IllegalArgumentException(
+ "Element is not allowed here: " + qName));
+
+ skipElement++;
+
+ return;
+ }
+
+ /* c) The tag name is not a key in the map of Creator instances. This means that
+ * either the XML data is of a newer version or simply contains a miss-spelled element.
+ */
+ if (!handlerCreators.containsKey(qName))
+ {
+ exceptionListener.exceptionThrown(
+ new IllegalArgumentException(
+ "Element unusable because tag is unknown: " + qName));
+
+ skipElement++;
+
+ return;
+ }
+
+ // creates a new handler for the new element
+ AbstractElementHandler handler =
+ ((Creator) handlerCreators.get(qName)).createHandler(
+ currentHandler);
+
+ // makes it the current handler to receive character data
+ currentHandler = handler;
+
+ // starts the handler
+ currentHandler.start(attributes, exceptionListener);
+ }
+
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException
+ {
+ // skips processing the current handler if we are parsing an element
+ // which was marked invalid (in startElement() )
+ if (skipElement > 0)
+ {
+ skipElement--;
+ return;
+ }
+
+ // invokes the handler's finishing method
+ currentHandler.end(exceptionListener);
+
+ // removes the current handler and reactivates its parent
+ currentHandler = currentHandler.getParent();
+ }
+
+ /** Transfers character data to the current handler
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException
+ {
+ // prevents sending character data of invalid elements
+ if (skipElement > 0)
+ return;
+
+ currentHandler.characters(ch, start, length);
+ }
+
+ /** Creator interface provided a mechanism to instantiate ElementHandler instances
+ * for the appropriate tag.
+ *
+ * @author Robert Schuster
+ */
+ interface Creator
+ {
+ /** Creates an ElementHandler instance using the given ElementHandler as its parent.
+ *
+ * @param parent The parent ElementHandler of the result.
+ * @return A new ElementHandler instance.
+ */
+ AbstractElementHandler createHandler(ElementHandler parent);
+ }
+
+ class BooleanHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new BooleanHandler(parent);
+ }
+ }
+
+ class ByteHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new ByteHandler(parent);
+ }
+ }
+
+ class ShortHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new ShortHandler(parent);
+ }
+ }
+
+ class IntHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new IntHandler(parent);
+ }
+ }
+
+ class LongHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new LongHandler(parent);
+ }
+ }
+
+ class FloatHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new FloatHandler(parent);
+ }
+ }
+
+ class DoubleHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new DoubleHandler(parent);
+ }
+ }
+
+ class CharHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new CharHandler(parent);
+ }
+ }
+
+ class StringHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new StringHandler(parent);
+ }
+ }
+
+ class JavaHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return javaHandler;
+ }
+ }
+
+ class ObjectHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new ObjectHandler(parent);
+ }
+ }
+
+ class VoidHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new VoidHandler(parent);
+ }
+ }
+
+ class ClassHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new ClassHandler(parent);
+ }
+ }
+
+ class NullHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new NullHandler(parent);
+ }
+ }
+
+ class ArrayHandlerCreator implements Creator
+ {
+ public AbstractElementHandler createHandler(ElementHandler parent)
+ {
+ return new ArrayHandler(parent);
+ }
+ }
+
+ /** Adds a decoded object to the Context. */
+ public void addParameterObject(Object o) throws AssemblyException
+ {
+ objects.add(o);
+ }
+
+ public void notifyStatement(Context outerContext) throws AssemblyException
+ {
+ // can be ignored because theis Context does not react to statement and expressions
+ // differently
+ }
+
+ public Object endContext(Context outerContext) throws AssemblyException
+ {
+ return null;
+ }
+
+ public boolean subContextFailed()
+ {
+ // failing of subcontexts is no problem for the mother of all contexts
+ return false;
+ }
+
+ public void set(int index, Object o) throws AssemblyException
+ {
+ // not supported
+ throw new AssemblyException(
+ new IllegalArgumentException("Set method is not allowed in decoder context."));
+ }
+
+ public Object get(int index) throws AssemblyException
+ {
+ // not supported
+ throw new AssemblyException(
+ new IllegalArgumentException("Get method is not allowed in decoder context."));
+ }
+
+ public Object getResult()
+ {
+ // returns the XMLDecoder instance which is requested by child contexts this way.
+ // That is needed to invoke methods on the decoder.
+ return decoder;
+ }
+
+ public void setId(String id)
+ {
+ exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag."));
+ }
+
+ public String getId()
+ {
+ // appears to have no id
+ return null;
+ }
+
+ public boolean isStatement()
+ {
+ // this context is a statement by definition because it never returns anything to a parent because
+ // there is no such parent (DummyContext does not count!)
+ return true;
+ }
+
+ public void setStatement(boolean b)
+ {
+ // ignores that because this Context is always a statement
+ }
+
+ /** Returns an Iterator instance which returns the decoded objects.
+ *
+ * This method is used by the XMLDecoder directly.
+ */
+ public Iterator iterator()
+ {
+ return objects.iterator();
+ }
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java b/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java
index 838ef814b01..15751cdbcaa 100644
--- a/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java
@@ -7,7 +7,7 @@ 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
@@ -74,7 +74,7 @@ class PropertyContext extends AbstractObjectContext
throw new AssemblyException(new IllegalArgumentException("Property attribut allows zero or one argument only."));
argument = o;
- setStatement(true);
+ setStatement(true);
prefix = "set";
}
@@ -91,8 +91,8 @@ class PropertyContext extends AbstractObjectContext
if (outerObject == null)
throw new AssemblyException(new NullPointerException("No object to access property "
- + propertyName));
-
+ + propertyName));
+
// converts property name into a method name
String methodName = prefix + propertyName.substring(0, 1).toUpperCase()
@@ -103,23 +103,23 @@ class PropertyContext extends AbstractObjectContext
try
{
- Method method = MethodFinder.getMethod(outerObject.getClass(),
- methodName, args);
+ Method method = MethodFinder.getMethod(outerObject.getClass(),
+ methodName, args);
- // stores the result whether it is available or not
- setObject(method.invoke(outerObject, args));
+ // stores the result whether it is available or not
+ setObject(method.invoke(outerObject, args));
}
catch (NoSuchMethodException nsme)
{
- throw new AssemblyException(nsme);
+ throw new AssemblyException(nsme);
}
catch (InvocationTargetException ite)
{
- throw new AssemblyException(ite.getCause());
+ throw new AssemblyException(ite.getCause());
}
catch (IllegalAccessException iae)
{
- throw new AssemblyException(iae);
+ throw new AssemblyException(iae);
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java b/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java
index ab6ddbece26..c5de50ab97e 100644
--- a/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java b/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java
index bc187e8a052..1c43bb0c7e7 100644
--- a/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java
@@ -7,7 +7,7 @@ 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
@@ -65,7 +65,7 @@ abstract class SimpleHandler extends AbstractElementHandler
protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener)
throws AssemblyException
{
-
+
// note: simple elements should not have any attributes. We inform
// the user of this syntactical but uncritical problem by sending
// an IllegalArgumentException for each unneccessary attribute
@@ -79,7 +79,7 @@ abstract class SimpleHandler extends AbstractElementHandler
+ "' discarded.");
exceptionListener.exceptionThrown(e);
}
-
+
return context = new ObjectContext();
}
@@ -89,11 +89,11 @@ abstract class SimpleHandler extends AbstractElementHandler
// reports the number when the character data can be parsed
try
{
- context.setObject(parse(characters));
+ context.setObject(parse(characters));
}
catch (NumberFormatException nfe)
{
- throw new AssemblyException(nfe);
+ throw new AssemblyException(nfe);
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java b/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java
index 959c949f77b..b2cf0e6021e 100644
--- a/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java
+++ b/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java
@@ -7,7 +7,7 @@ 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
@@ -75,21 +75,21 @@ class StaticMethodContext extends AbstractCreatableObjectContext
try
{
- Method method = MethodFinder.getMethod(klass, methodName, args);
- return method.invoke(null, args);
+ Method method = MethodFinder.getMethod(klass, methodName, args);
+ return method.invoke(null, args);
}
catch (NoSuchMethodException nsme)
{
- throw new AssemblyException(nsme);
+ throw new AssemblyException(nsme);
}
catch (InvocationTargetException ite)
{
- // rethrows the reason for the InvocationTargetsException (ie. the exception in the called code)
- throw new AssemblyException(ite.getCause());
+ // rethrows the reason for the InvocationTargetsException (ie. the exception in the called code)
+ throw new AssemblyException(ite.getCause());
}
catch (IllegalAccessException iae)
{
- throw new AssemblyException(iae);
+ throw new AssemblyException(iae);
}
}
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/StringHandler.java b/libjava/classpath/gnu/java/beans/decoder/StringHandler.java
index 6f2311a9e62..97fc57efd91 100644
--- a/libjava/classpath/gnu/java/beans/decoder/StringHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/StringHandler.java
@@ -7,7 +7,7 @@ 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
diff --git a/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java b/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java
index ca3664bbed1..56f31563943 100644
--- a/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java
@@ -7,7 +7,7 @@ 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
@@ -86,7 +86,7 @@ public class VoidHandler extends AbstractElementHandler
return new ConstructorContext(id, klass);
// (falling through is important!)
- // run a static method on the given class (if methodName exists, which is implied already)
+ // run a static method on the given class (if methodName exists, which is implied already)
return new StaticMethodContext(id, klass, methodName);
}
catch (ClassNotFoundException cnfe)
OpenPOWER on IntegriCloud