You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/06/22 12:44:26 UTC
svn commit: r549772 [1/3] - in
/harmony/enhanced/classlib/branches/java6/modules:
awt/src/main/java/common/org/apache/harmony/awt/gl/font/
awt/src/main/native/fontlib/unix/ awt/src/main/native/fontlib/windows/
awt/src/main/native/oglwrapper/unix/ beans...
Author: pyang
Date: Fri Jun 22 03:44:22 2007
New Revision: 549772
URL: http://svn.apache.org/viewvc?view=rev&rev=549772
Log:
Merge updates from classlib trunk@549762 since r549309
Added:
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/shared/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/shared/hyfiletext.c
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/shared/hyfiletext.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/unix/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/unix/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/windows/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/windows/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyfiletext/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/shared/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/shared/hynls.c
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/shared/hynls.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/unix/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/unix/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/windows/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/windows/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hynls/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/shared/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/shared/hyport.c
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/shared/hyport.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/unix/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/unix/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/windows/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/windows/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hyport/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/shared/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/shared/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/shared/hystr.c
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/shared/hystr.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/unix/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/unix/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/unix/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/windows/
- copied from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/windows/
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/windows/makefile
- copied unchanged from r549762, harmony/enhanced/classlib/trunk/modules/portlib/src/test/native/hystr/windows/makefile
Removed:
harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/resources/prefs/java/util/prefs/preferences.dtd
Modified:
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/oglwrapper/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventHandler.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Command.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Handler.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java
harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/windows/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectInputStream.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/ProxySelectorImpl.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HugeEnumSet.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/TwoKeyHashMap.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/hyzip/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/hyzip/windows/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileTest.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml
harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/shared/hythread.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/unix/makefile (contents, props changed)
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/init/unix/makefile (props changed)
harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java Fri Jun 22 03:44:22 2007
@@ -39,6 +39,10 @@
public abstract class FontManager {
+
+ static {
+ java.awt.Toolkit.getDefaultToolkit();
+ }
public static final boolean IS_FONTLIB = "true".equals(System.getProperty("java.awt.fontlib")) ||
GraphicsEnvironment.isHeadless();
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/oglwrapper/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventHandler.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventHandler.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventHandler.java Fri Jun 22 03:44:22 2007
@@ -157,12 +157,11 @@
} else if (listenerMethodName.equals(method.getName())) {
// method's name matches
// no arguments in call are valid
- if ((eventPropertyName == null)
- && ((arguments == null) || (arguments.length == 0))) {
+ if (eventPropertyName == null
+ && (arguments == null || arguments.length == 0)) {
result = true;
- // one-argument call is value
- } else if ((eventPropertyName != null) && (arguments != null)
- && (arguments.length == 1)) {
+ // one-argument call is also valid
+ } else if (arguments != null && arguments.length == 1) {
result = true;
} else {
result = false;
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java Fri Jun 22 03:44:22 2007
@@ -73,6 +73,12 @@
}
out.writeExpression(instantiate(oldInstance, out));
+ newInstance = out.get(oldInstance);
+
+ if (newInstance != null) {
+ initialize(oldInstance.getClass(), oldInstance,
+ newInstance, out);
+ }
}
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Statement.java Fri Jun 22 03:44:22 2007
@@ -50,10 +50,12 @@
public String toString() {
StringBuilder sb = new StringBuilder();
String targetVar = target != null ? convertClassName(target.getClass()) : "null"; //$NON-NLS-1$
+
sb.append(targetVar);
sb.append('.');
sb.append(methodName);
sb.append('(');
+
if (arguments != null) {
for (int i = 0; i < arguments.length; ++i) {
if (i > 0) {
@@ -72,6 +74,7 @@
}
sb.append(')');
sb.append(';');
+
return sb.toString();
}
@@ -93,6 +96,7 @@
Object invokeMethod() throws Exception {
Object result = null;
+
try {
if (target.getClass().isArray()) {
Method method = findArrayMethod();
@@ -101,21 +105,27 @@
} else if (methodName.equals("newInstance") //$NON-NLS-1$
&& target == Array.class) {
Class<?> componentType = (Class) arguments[0];
- int length = ((Integer) arguments[1]).intValue();
+ int length = (Integer) arguments[1];
result = Array.newInstance(componentType, length);
- } else if (methodName.equals("new") //$NON-NLS-1$
- || methodName.equals("newInstance")) { //$NON-NLS-1$
- if (target instanceof Class) {
- Constructor<?> constructor = findConstructor();
- result = constructor.newInstance(arguments);
+ } else if (target instanceof Class &&
+ (methodName.equals("new") || //$NON-NLS-1$
+ methodName.equals("newInstance"))) { //$NON-NLS-1$
+ Constructor<?> constructor;
+ Class<?> clazz = (Class <?>) target;
+
+ if (clazz.isArray()) {
+ // special form for constructing arrays,
+ // can be passed from decoder
+ result = Array.newInstance(clazz.getComponentType(),
+ (Integer) arguments[0]);
} else {
- // XXX should be investigated, dead code?
- Constructor<?> constructor = findConstructor();
+ constructor = findConstructor();
result = constructor.newInstance(arguments);
}
} else if (target instanceof Class) {
Method method = null;
boolean found = false;
+
try {
/*
* Try to look for a static method of class described by the
@@ -129,6 +139,7 @@
}
} catch (NoSuchMethodException e) {
}
+
if (!found) {
// static method was not found
// try to invoke method of Class object
@@ -187,6 +198,7 @@
private Object[] getArrayMethodArguments() {
Object[] args = new Object[arguments.length + 1];
+
args[0] = target;
for (int i = 0; i < arguments.length; ++i) {
args[i + 1] = arguments[i];
@@ -199,10 +211,13 @@
Class<?> targetClass = (Class) target;
Constructor<?> result = null;
Constructor<?>[] constructors = targetClass.getConstructors();
+
for (Constructor<?> constructor : constructors) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
+
if (parameterTypes.length == argClasses.length) {
boolean found = true;
+
for (int j = 0; j < parameterTypes.length; ++j) {
boolean argIsNull = argClasses[j] == null;
boolean argIsPrimitiveWrapper = isPrimitiveWrapper(argClasses[j],
@@ -210,6 +225,7 @@
boolean paramIsPrimitive = parameterTypes[j].isPrimitive();
boolean paramIsAssignable = argIsNull ? false : parameterTypes[j]
.isAssignableFrom(argClasses[j]);
+
if (!argIsNull && !paramIsAssignable && !argIsPrimitiveWrapper || argIsNull
&& paramIsPrimitive) {
found = false;
@@ -238,13 +254,17 @@
Method[] methods = targetClass.getMethods();
Vector<Method> foundMethods = new Vector<Method>();
Method[] foundMethodsArr;
+
for (Method method : methods) {
int mods = method.getModifiers();
+
if (method.getName().equals(methodName)
&& (methodIsStatic ? Modifier.isStatic(mods) : true)) {
Class<?>[] parameterTypes = method.getParameterTypes();
+
if (parameterTypes.length == argClasses.length) {
boolean found = true;
+
for (int j = 0; j < parameterTypes.length; ++j) {
boolean argIsNull = (argClasses[j] == null);
boolean argIsPrimitiveWrapper = isPrimitiveWrapper(argClasses[j],
@@ -252,6 +272,7 @@
boolean paramIsPrimitive = parameterTypes[j].isPrimitive();
boolean paramIsAssignable = argIsNull ? false : parameterTypes[j]
.isAssignableFrom(argClasses[j]);
+
if (!argIsNull && !paramIsAssignable && !argIsPrimitiveWrapper
|| argIsNull && paramIsPrimitive) {
found = false;
@@ -275,9 +296,11 @@
static boolean isStaticMethodCall(Statement stmt) {
Object target = stmt.getTarget();
String mName = stmt.getMethodName();
+
if (!(target instanceof Class)) {
return false;
}
+
try {
Statement.findMethod((Class) target, mName, stmt.getArguments(), true);
return true;
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Command.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Command.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Command.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Command.java Fri Jun 22 03:44:22 2007
@@ -486,8 +486,12 @@
}
if (className != null) {
- target = Class.forName(className, true, Thread
- .currentThread().getContextClassLoader());
+ try {
+ target = Class.forName(className, true, Thread
+ .currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException e) {
+ target = Class.forName(className);
+ }
if (isField()) {
String fieldName = getAttr("field"); //$NON-NLS-1$
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Handler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Handler.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Handler.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/Handler.java Fri Jun 22 03:44:22 2007
@@ -110,7 +110,10 @@
try {
cmd.exec(references);
} catch (Exception e) {
- throw new SAXException(e);
+ SAXException e2 = new SAXException(e.getMessage());
+
+ e2.initCause(e);
+ throw e2;
}
if (--tabCount < 0) {
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java Fri Jun 22 03:44:22 2007
@@ -61,30 +61,29 @@
}
public Object getObjectValue() throws Exception {
- if (objectValue == null) {
- objectValue = initializer.getValue();
+ if (objectValue != null) {
+ return objectValue;
}
- // XXX We probably don't need this. Investigate.
-// if (nodes != null) {
-// Object[] oldArgs = initializer.getArguments();
-// Object[] newArgs = new Object[oldArgs.length];
-//
-// for (int i = 0; i < oldArgs.length; ++i) {
-// if (oldArgs[i] != null) {
-// ObjectNode node = nodes.get(oldArgs[i]);
-//
-// newArgs[i] = node.getObjectValue();
-// } else {
-// newArgs[i] = null;
-// }
-// }
-//
-// objectValue = (new Expression(initializer.getTarget(), initializer
-// .getMethodName(), newArgs)).getValue();
-// } else {
-// objectValue = initializer.getValue();
-// }
+ if (nodes != null) {
+ Object[] oldArgs = initializer.getArguments();
+ Object[] newArgs = new Object[oldArgs.length];
+
+ for (int i = 0; i < oldArgs.length; ++i) {
+ if (oldArgs[i] != null) {
+ ObjectNode node = nodes.get(oldArgs[i]);
+
+ newArgs[i] = node.getObjectValue();
+ } else {
+ newArgs[i] = null;
+ }
+ }
+
+ objectValue = (new Expression(initializer.getTarget(), initializer
+ .getMethodName(), newArgs)).getValue();
+ } else {
+ objectValue = initializer.getValue();
+ }
return objectValue;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java Fri Jun 22 03:44:22 2007
@@ -126,6 +126,13 @@
assertEquals(invocationObject, handler.getTarget());
assertEquals("doSomething", getMethodName());
+
+ // Regression test for HARMONY-4033
+ m = FredListener.class.getMethod("fireFredEvent",
+ new Class[] { FredEvent.class });
+ proxy = EventHandler.create(FredListener.class, invocationObject,
+ "doSomething", null, "fireFredEvent");
+ m.invoke(proxy, new Object[] { null });
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLDecoderTest.java Fri Jun 22 03:44:22 2007
@@ -25,6 +25,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Vector;
+import java.lang.reflect.Array;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -378,6 +379,29 @@
decode("xml/Test7.xml");
}
+
+ /**
+ * Regression test for HARMONY-1890
+ */
+ public void testDecodeEmptyStringArray1890() {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ XMLEncoder encoder = new XMLEncoder(out);
+ XMLDecoder decoder;
+ Object obj;
+
+ encoder.writeObject(new String[10]);
+ encoder.close();
+
+ decoder = new XMLDecoder(new ByteArrayInputStream(out.toByteArray()));
+ obj = decoder.readObject();
+ decoder.close();
+
+ assertTrue("Returned object is not array", obj.getClass().isArray());
+ assertSame("String type expected", String.class,
+ obj.getClass().getComponentType());
+ assertEquals("Size mismatch", 10, Array.getLength(obj));
+ }
+
/*
* The test checks the code generation for XML from MainTest.xml
*
Propchange: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/File.java Fri Jun 22 03:44:22 2007
@@ -396,7 +396,7 @@
security.checkDelete(path);
}
- DeleteOnExit.addFile(Util.toString(properPath(true)));
+ DeleteOnExit.addFile(Util.toUTF8String(properPath(true)));
}
/**
@@ -452,7 +452,7 @@
*/
public String getAbsolutePath() {
byte[] absolute = properPath(false);
- return Util.toString(absolute);
+ return Util.toUTF8String(absolute);
}
/**
@@ -577,7 +577,7 @@
newResult[newLength] = 0;
newResult = getCanonImpl(newResult);
newLength = newResult.length;
- return Util.toString(newResult, 0, newLength);
+ return Util.toUTF8String(newResult, 0, newLength);
}
/**
@@ -1179,7 +1179,7 @@
if (properPath != null) {
return properPath;
}
- byte[] pathBytes = Util.getBytes(path);
+ byte[] pathBytes = Util.getUTF8Bytes(path);
if (isAbsoluteImpl(pathBytes)) {
return properPath = pathBytes;
}
@@ -1195,23 +1195,32 @@
return properPath;
}
if (path.length() == 0) {
- return properPath = Util.getBytes(userdir);
+ return properPath = Util.getUTF8Bytes(userdir);
}
int length = userdir.length();
+
+ // Handle windows-like path
if (path.charAt(0) == '\\') {
if (length > 1 && userdir.charAt(1) == ':') {
- return properPath = Util.getBytes(userdir.substring(0, 2)
+ return properPath = Util.getUTF8Bytes(userdir.substring(0, 2)
+ path);
+ } else {
+ path = path.substring(1);
}
- if (length > 0 && userdir.charAt(length - 1) == separatorChar) {
- return properPath = Util.getBytes(userdir + path.substring(1));
- }
- return properPath = Util.getBytes(userdir + path);
}
- if (length > 0 && userdir.charAt(length - 1) == separatorChar) {
- return properPath = Util.getBytes(userdir + path);
+
+ // Handle separator
+ String result = userdir;
+ if (userdir.charAt(length - 1) != separatorChar) {
+ if (path.charAt(0) != separatorChar) {
+ result += separator;
+ }
+ } else if (path.charAt(0) == separatorChar) {
+ result = result.substring(0, length - 2);
+
}
- return properPath = Util.getBytes(userdir + separator + path);
+ result += path;
+ return properPath = Util.getUTF8Bytes(result);
}
private static native byte[] properPathImpl(byte[] path);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectInputStream.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectInputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectInputStream.java Fri Jun 22 03:44:22 2007
@@ -28,7 +28,6 @@
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.IdentityHashMap;
import java.util.Iterator;
import org.apache.harmony.kernel.vm.VM;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java Fri Jun 22 03:44:22 2007
@@ -20,11 +20,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import java.security.AccessController;
import java.util.IdentityHashMap;
-import org.apache.harmony.luni.util.PriviAction;
-
/**
* An ObjectOutputStream can be used to save Java objects into a stream where
* the objects can be loaded later with an ObjectInputStream. Primitive data
@@ -1297,7 +1294,6 @@
// See if the object has a writeObject method. If so, run it
boolean executed = false;
- Class<?> targetClass = classDesc.forClass();
try {
if (classDesc.hasMethodWriteObject()){
final Method method = classDesc.getMethodWriteObject();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/ProxySelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/ProxySelectorImpl.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/ProxySelectorImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/ProxySelectorImpl.java Fri Jun 22 03:44:22 2007
@@ -31,6 +31,7 @@
/**
* Default implementation for ProxySelector
*/
+@SuppressWarnings("unchecked")
class ProxySelectorImpl extends ProxySelector {
private static final int HTTP_PROXY_PORT = 80;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/URLClassLoader.java Fri Jun 22 03:44:22 2007
@@ -17,16 +17,16 @@
package java.net;
+import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FilePermission;
import java.io.IOException;
import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.BufferedReader;
import java.io.InputStreamReader;
-import java.io.FileNotFoundException;
+import java.io.UnsupportedEncodingException;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.CodeSource;
@@ -38,15 +38,14 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import org.apache.harmony.luni.util.InvalidJarIndexException;
import org.apache.harmony.luni.util.Msg;
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumMap.java Fri Jun 22 03:44:22 2007
@@ -52,6 +52,7 @@
ordinal = ((Enum) theKey).ordinal();
}
+ @SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
if (!enumMap.hasMapping[ordinal]) {
@@ -78,18 +79,21 @@
: enumMap.values[ordinal].hashCode());
}
+ @SuppressWarnings("unchecked")
@Override
public KT getKey() {
checkEntryStatus();
return (KT) enumMap.keys[ordinal];
}
+ @SuppressWarnings("unchecked")
@Override
public VT getValue() {
checkEntryStatus();
return (VT) enumMap.values[ordinal];
}
+ @SuppressWarnings("unchecked")
@Override
public VT setValue(VT value) {
checkEntryStatus();
@@ -280,6 +284,7 @@
super(value, em);
}
+ @SuppressWarnings("unchecked")
@Override
public E next() {
if (!hasNext()) {
@@ -349,6 +354,7 @@
return toArray(entryArray);
}
+ @SuppressWarnings("unchecked")
@Override
public Object[] toArray(Object[] array) {
int size = enumMap.size();
@@ -411,6 +417,7 @@
* @throws NullPointerException
* if the map is null
*/
+ @SuppressWarnings("unchecked")
public EnumMap(Map<K, ? extends V> map) {
if (map instanceof EnumMap) {
initialization((EnumMap<K, V>) map);
@@ -445,6 +452,7 @@
*
* @return a shallow copy of this map
*/
+ @SuppressWarnings("unchecked")
@Override
public EnumMap<K, V> clone() {
try {
@@ -524,6 +532,7 @@
* the object
* @return true if this EnumMap is equal to the given object.
*/
+ @SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
if (this == object) {
@@ -662,6 +671,7 @@
return valuesCollection;
}
+ @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream stream) throws IOException,
ClassNotFoundException {
stream.defaultReadObject();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HugeEnumSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HugeEnumSet.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HugeEnumSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HugeEnumSet.java Fri Jun 22 03:44:22 2007
@@ -176,6 +176,7 @@
}
}
+ @SuppressWarnings("unchecked")
@Override
public boolean contains(Object object) {
if (null == object) {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Stack.java Fri Jun 22 03:44:22 2007
@@ -51,7 +51,8 @@
* when empty() is true
* @see #pop
*/
- public synchronized E peek() {
+ @SuppressWarnings("unchecked")
+ public synchronized E peek() {
try {
return (E)elementData[elementCount - 1];
} catch (IndexOutOfBoundsException e) {
@@ -68,7 +69,8 @@
* @see #peek
* @see #push
*/
- public synchronized E pop() {
+ @SuppressWarnings("unchecked")
+ public synchronized E pop() {
try {
int index = elementCount - 1;
E obj = (E)elementData[index];
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java Fri Jun 22 03:44:22 2007
@@ -25,7 +25,6 @@
import java.net.SocketImpl;
import java.net.UnknownHostException;
import java.nio.channels.Channel;
-import java.nio.channels.SelectableChannel;
/*
* The interface for network methods.
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java Fri Jun 22 03:44:22 2007
@@ -25,7 +25,6 @@
import java.net.SocketImpl;
import java.net.UnknownHostException;
import java.nio.channels.Channel;
-import java.nio.channels.SelectableChannel;
/*
*
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java Fri Jun 22 03:44:22 2007
@@ -17,8 +17,6 @@
package org.apache.harmony.luni.util;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* Used to parse a string and return either a single or double precision
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/TwoKeyHashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/TwoKeyHashMap.java?view=diff&rev=549772&r1=549771&r2=549772
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/TwoKeyHashMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/util/TwoKeyHashMap.java Fri Jun 22 03:44:22 2007
@@ -69,6 +69,7 @@
* @param initialCapacity
* @param initialLoadFactor
*/
+ @SuppressWarnings("unchecked")
public TwoKeyHashMap(int initialCapacity, float initialLoadFactor) {
if (initialCapacity < 0) {
throw new IllegalArgumentException("initialCapacity should be >= 0");
@@ -174,6 +175,7 @@
* Rehash the map
*
*/
+ @SuppressWarnings("unchecked")
void rehash() {
int newArrSize = (arrSize + 1) * 2 + 1;
if (newArrSize < 0) {
Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/hyzip/unix/makefile
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/hyzip/windows/makefile
------------------------------------------------------------------------------
svn:eol-style = native