harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r576185 [2/4] - in /harmony/enhanced/classlib/branches/java6/modules: archive/src/main/native/archive/shared/ auth/ auth/src/main/java/common/org/apache/harmony/auth/module/ auth/src/test/java/common/org/apache/harmony/auth/tests/module/ au...
Date Sun, 16 Sep 2007 21:56:47 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/windows/include/org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D.h Sun Sep 16 14:56:42 2007
@@ -49,162 +49,190 @@
 /* Native methods */
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.setNativeTransform(J[D)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    gdiPlusStartup
+ * Signature: ()J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setNativeTransform(JNIEnv *, jobject, 
-    jlong, jdoubleArray);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_gdiPlusStartup
+  (JNIEnv *, jclass);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.resetClip(J)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    gdiPlusShutdown
+ * Signature: (J)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_resetClip(JNIEnv *, jobject, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_gdiPlusShutdown
+  (JNIEnv *, jclass, jlong);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.setClip(J[II)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    createGraphicsInfo
+ * Signature: (JIIII)J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setClip(JNIEnv *, jobject, 
-    jlong, jintArray, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createGraphicsInfo
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.fillRect(JIIII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    createCompatibleImageInfo
+ * Signature: (JII)J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillRect(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createCompatibleImageInfo__JII
+  (JNIEnv *, jclass, jlong, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.drawRect(JIIII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    createCompatibleImageInfo
+ * Signature: ([BII)J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawRect(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createCompatibleImageInfo___3BII
+  (JNIEnv *, jclass, jbyteArray, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.drawLine(JIIII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    copyImageInfo
+ * Signature: (J)J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawLine(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_copyImageInfo
+  (JNIEnv *, jobject, jlong);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.fillShape(J[FII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    disposeGraphicsInfo
+ * Signature: (J)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillShape(JNIEnv *, jobject, 
-    jlong, jfloatArray, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_disposeGraphicsInfo
+  (JNIEnv *, jclass, jlong);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.drawShape(J[FII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    copyArea
+ * Signature: (JIIIIII)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawShape(JNIEnv *, jobject, 
-    jlong, jfloatArray, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_copyArea
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.deletePen(J)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    setSolidBrush
+ * Signature: (JIIII)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_deletePen(JNIEnv *, jobject, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setSolidBrush
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.setPen(JFIIF[FIF)Z
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    setLinearGradientBrush
+ * Signature: (JIIIIIIIIIIIIZ)V
  */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setPen(JNIEnv *, jobject, 
-    jlong, jfloat, jint, jint, jfloat, jfloatArray, jint, jfloat);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setLinearGradientBrush
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.getDC(J)J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    fillRects
+ * Signature: (J[II)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_getDC(JNIEnv *, jobject, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillRects
+  (JNIEnv *, jobject, jlong, jintArray, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.fillRects(J[II)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    getDC
+ * Signature: (J)J
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillRects(JNIEnv *, jobject, 
-    jlong, jintArray, jint);
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_getDC
+  (JNIEnv *, jobject, jlong);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.setLinearGradientBrush(JIIIIIIIIIIIIZ)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    setPen
+ * Signature: (JFIIF[FIF)Z
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setLinearGradientBrush(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
+JNIEXPORT jboolean JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setPen
+  (JNIEnv *, jobject, jlong, jfloat, jint, jint, jfloat, jfloatArray, jint, jfloat);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.setSolidBrush(JIIII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    deletePen
+ * Signature: (J)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setSolidBrush(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_deletePen
+  (JNIEnv *, jobject, jlong);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.copyArea(JIIIIII)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    drawShape
+ * Signature: (J[FII)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_copyArea(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawShape
+  (JNIEnv *, jobject, jlong, jfloatArray, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.copyImageInfo(J)J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    fillShape
+ * Signature: (J[FII)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_copyImageInfo(JNIEnv *, jobject, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillShape
+  (JNIEnv *, jobject, jlong, jfloatArray, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.createGraphicsInfo(JIIII)J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    drawLine
+ * Signature: (JIIII)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createGraphicsInfo(JNIEnv *, jobject, 
-    jlong, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawLine
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.disposeGraphicsInfo(J)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    drawRect
+ * Signature: (JIIII)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_disposeGraphicsInfo(JNIEnv *, jclass, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawRect
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.createCompatibleImageInfo([BII)J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    drawOval
+ * Signature: (JIIII)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createCompatibleImageInfo___3BII(JNIEnv *, jclass, 
-    jbyteArray, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_drawOval
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.createCompatibleImageInfo(JII)J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    fillRect
+ * Signature: (JIIII)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_createCompatibleImageInfo__JII(JNIEnv *, jclass, 
-    jlong, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_fillRect
+  (JNIEnv *, jobject, jlong, jint, jint, jint, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.gdiPlusShutdown(J)V
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    setClip
+ * Signature: (J[II)V
  */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_gdiPlusShutdown(JNIEnv *, jclass, 
-    jlong);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setClip
+  (JNIEnv *, jobject, jlong, jintArray, jint);
 
 /*
- * Method: org.apache.harmony.awt.gl.windows.WinGDIPGraphics2D.gdiPlusStartup()J
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    resetClip
+ * Signature: (J)V
  */
-JNIEXPORT jlong JNICALL
-Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_gdiPlusStartup(JNIEnv *, jclass);
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_resetClip
+  (JNIEnv *, jobject, jlong);
 
+/*
+ * Class:     org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D
+ * Method:    setNativeTransform
+ * Signature: (J[D)V
+ */
+JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_windows_WinGDIPGraphics2D_setNativeTransform
+  (JNIEnv *, jobject, jlong, jdoubleArray);
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _ORG_APACHE_HARMONY_AWT_GL_WINDOWS_WINGDIPGRAPHICS2D_H */
-
+#endif

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/exports.txt?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/exports.txt (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/exports.txt Sun Sep 16 14:56:42 2007
@@ -114,6 +114,7 @@
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetInputFocus
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetSelectionOwner
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetStandardProperties
+Java_org_apache_harmony_awt_nativebridge_linux_X11_Xutf8SetWMProperties
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetTransientForHint
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetWMHints
 Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetWMNormalHints

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp Sun Sep 16 14:56:42 2007
@@ -774,6 +774,15 @@
     return (jint) (* p_nbridge_XSetStandardProperties)((void *) param_0, (long) param_1, (void *) param_2, (void *) param_3, (long) param_4, (void *) param_5, (int) param_6, (void *) param_7);
 }
 
+void (* p_nbridge_Xutf8SetWMProperties) (void *, long, void *, void *, void *, int, void *, void*, void*) = NULL;
+
+JNIEXPORT void  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_Xutf8SetWMProperties( JNIEnv *env, jobject self, jlong param_0, jlong param_1, jlong param_2, jlong param_3, jlong param_4, jint param_5, jlong param_6, jlong param_7, jlong param_8) {
+    if (p_nbridge_Xutf8SetWMProperties == NULL) {
+        p_nbridge_Xutf8SetWMProperties = (void (*) (void *, long, void *, void *, void*, int, void*, void*, void*)) FindFunction(libX11, "Xutf8SetWMProperties");
+    }
+   (* p_nbridge_Xutf8SetWMProperties)((void *) param_0, (long) param_1, (void *) param_2, (void *) param_3, (void *) param_4, (int) param_5, (void *) param_6, (void *) param_7, (void *) param_8);
+}
+
 unsigned long  (* p_nbridge_XDefaultColormap) (void *, int) = NULL;
 
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_XDefaultColormap( JNIEnv *env, jobject self, jlong param_0, jint param_1) {

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.h?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.h Sun Sep 16 14:56:42 2007
@@ -195,6 +195,8 @@
 
 JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_XSetStandardProperties(JNIEnv *, jobject, jlong, jlong, jlong, jlong, jlong, jlong, jint, jlong);
 
+JNIEXPORT void  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_Xutf8SetWMProperties(JNIEnv *, jobject, jlong, jlong, jlong, jlong, jlong, jint, jlong, jlong, jlong);
+
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_XDefaultColormap(JNIEnv *, jobject, jlong, jint);
 
 JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_X11_XAllocSizeHints(JNIEnv *, jobject);

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventSetDescriptor.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventSetDescriptor.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventSetDescriptor.java Sun Sep 16 14:56:42 2007
@@ -233,7 +233,7 @@
      * @param fullClassName full name of the class
      * @return name with package and encapsulating class info omitted 
      */
-    static String extractShortClassName(String fullClassName) {
+    private static String extractShortClassName(String fullClassName) {
         int k = fullClassName.lastIndexOf('$');
         
         k = (k == -1 ? fullClassName.lastIndexOf('.') : k);

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java Sun Sep 16 14:56:42 2007
@@ -20,8 +20,7 @@
 class NullPersistenceDelegate extends PersistenceDelegate {
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        assert oldInstance == null;
-        return new Expression(null, null, null, null);
+        return null;
     }
 
     @Override
@@ -36,7 +35,6 @@
 
     @Override
     public void writeObject(Object oldInstance, Encoder out) {
-        assert oldInstance == null;
-        out.writeExpression(instantiate(null, out));
+        // do nothing
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java Sun Sep 16 14:56:42 2007
@@ -22,6 +22,7 @@
 import java.awt.font.TextAttribute;
 import java.awt.dnd.DropTarget;
 import java.beans.*;
+import java.beans.beancontext.BeanContextSupport;
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
@@ -212,6 +213,43 @@
         assertFalse(pd.mutatesTo(null, "test"));
     }
 
+    public void test_writeObject_LInteger_LXMLEncoder() {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+                byteArrayOutputStream));
+
+        encoder.writeObject(1);
+        encoder.writeObject(Integer.SIZE);
+        encoder.writeObject(Integer.MAX_VALUE);
+        encoder.writeObject(Integer.MIN_VALUE);
+        encoder.close();
+
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Integer one  = (Integer) decoder.readObject();
+        Integer size = (Integer) decoder.readObject();
+        Integer max  = (Integer) decoder.readObject();
+        Integer min  = (Integer) decoder.readObject();
+        assertEquals(new Integer(1), one);
+        assertEquals(new Integer(Integer.SIZE), size);
+        assertEquals(new Integer(Integer.MAX_VALUE), max);
+        assertEquals(new Integer(Integer.MIN_VALUE), min);
+
+        stream = new DataInputStream(
+                PersistenceDelegateTest.class
+                        .getResourceAsStream("/xml/Integer.xml"));
+        decoder = new XMLDecoder(stream);
+        one  = (Integer) decoder.readObject();
+        size = (Integer) decoder.readObject();
+        max  = (Integer) decoder.readObject();
+        min  = (Integer) decoder.readObject();
+        assertEquals(new Integer(1), one);
+        assertEquals(new Integer(Integer.SIZE), size);
+        assertEquals(new Integer(Integer.MAX_VALUE), max);
+        assertEquals(new Integer(Integer.MIN_VALUE), min);
+    }
+    
     public void test_writeObject_Null_LXMLEncoder() throws Exception {
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
@@ -229,6 +267,114 @@
         assertNull(decoder.readObject());
     }
 
+    public void test_writeObject_LArray_LXMLEncoder() {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+                byteArrayOutputStream));
+        int[] intArray = new int[2];
+        intArray[0] = 1;
+        
+        encoder.writeObject(intArray);
+        encoder.close();
+        
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        
+        XMLDecoder decoder = new XMLDecoder(stream);
+        int[] array =  (int[]) decoder.readObject();
+        assertEquals(2, array.length);
+        assertEquals(1, array[0]);
+        
+        stream = new DataInputStream(PersistenceDelegateTest.class
+                .getResourceAsStream("/xml/Array.xml"));
+        
+        decoder = new XMLDecoder(stream);
+        array =  (int[]) decoder.readObject();
+        assertEquals(2, array.length);
+        assertEquals(1, array[0]);
+    }
+
+    public static interface Foo {
+        void say();
+        String toString();
+    };
+
+    public void test_writeObject_Ljava_Lang_reflect_Proxy() {
+        InvocationHandler handler = new InvocationHandler() {
+
+            public Object invoke(Object proxy, Method method, Object[] params)
+                    throws Throwable {
+                if(method.getName().contains("toString")) {
+                    return "FooProxy";
+                }
+                System.out.println(method.getName());
+                return null;
+            }
+
+        };
+        Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
+                new Class[] { Foo.class }, handler);
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+                byteArrayOutputStream));
+        
+        encoder.writeObject(f);
+        encoder.close();
+
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+
+        XMLDecoder decoder = new XMLDecoder(stream);
+        try {
+            decoder.readObject();
+            fail("Should throw Exception");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        stream = new DataInputStream(PersistenceDelegateTest.class
+                .getResourceAsStream("/xml/Proxy.xml"));
+
+        decoder = new XMLDecoder(stream);
+        try {
+            decoder.readObject();
+            fail("Should throw Exception");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    public void test_writeObject_java_lang_string(){
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+
+        encoder.writeObject("test");
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Object object = decoder.readObject();
+        assertEquals("test", object);
+    }
+
+    public void test_writeObject_java_lang_class(){
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+
+        encoder.writeObject(Class.class);
+        encoder.writeObject(2);
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Class clz = (Class) decoder.readObject();
+        assertEquals(Class.class, clz);
+        Integer number = (Integer) decoder.readObject();
+        assertEquals(new Integer(2), number);
+    }
+
     class Bar {
         public int value;
 
@@ -238,7 +384,7 @@
     }
 
     public void test_writeObject_java_lang_reflect_Field()
-            throws SecurityException, NoSuchFieldException, IOException {
+            throws SecurityException, NoSuchFieldException {
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
                 byteArrayOutputStream));
@@ -282,7 +428,6 @@
         LinkedList<Integer> list = new LinkedList<Integer>();
         list.add(10);
         list.addFirst(2);
-        System.out.println(encoder.getPersistenceDelegate(LinkedList.class));
 
         encoder.writeObject(list);
         encoder.close();
@@ -363,7 +508,7 @@
             }
         };
         choice.addPropertyChangeListener(pcl);
-        System.out.println(encoder.getPersistenceDelegate(Choice.class));
+
         encoder.writeObject(choice);
         encoder.close();
         DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
@@ -428,6 +573,40 @@
         assertEquals(choice.getItem(0), aChoice.getItem(0));
     }
     
+    
+    public void test_writeObject_java_util_HashTable(){
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+
+        Hashtable<Integer, String> hTable = new Hashtable<Integer, String>();
+        hTable.put(1, "1");
+
+        encoder.writeObject(hTable);
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Hashtable aHtable = (Hashtable) decoder.readObject();
+        assertEquals(hTable.size(), aHtable.size());
+        assertEquals(hTable.get(1), aHtable.get(1));
+    }
+
+    public void test_writeObject_java_beans_beancontext_BeanContextSupport() throws PropertyVetoException{
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+        BeanContextSupport support = new BeanContextSupport();
+
+        encoder.writeObject(support);
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        BeanContextSupport aSupport = (BeanContextSupport) decoder.readObject();
+        assertEquals(Locale.getDefault(), aSupport.getLocale());
+    }
+    
     public void test_writeObject_java_awt_SystemColor() {
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
@@ -972,6 +1151,61 @@
         ToolTipManager aManager = (ToolTipManager) decoder.readObject();
         assertEquals(manager, aManager);
         assertEquals(manager.getDismissDelay(), aManager.getDismissDelay());
+    }
+    
+    public void test_writeObject_javax_swing_Box() {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+        Box box = new Box(1);
+        box.setAlignmentX(12.21f);
+
+        encoder.writeObject(box);
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Box aBox = (Box) decoder.readObject();
+        assertEquals(box.getAlignmentX(), aBox.getAlignmentX());
+    }
+
+    public void test_writeObject_javax_swing_JMenu(){
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+            byteArrayOutputStream));
+        JMenu menu = new JMenu("menu");
+
+        encoder.writeObject(menu);
+        encoder.close();
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        JMenu aMenu = (JMenu) decoder.readObject();
+        assertEquals(menu.getVerifyInputWhenFocusTarget(), aMenu
+                .getVerifyInputWhenFocusTarget());
+        assertEquals(menu.getName(), aMenu.getName());
+    }
+    
+    public void test_writeObject_Integer_Class() {
+        
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        System.err.println("Test 5");
+        Object[] objects5 = { Integer.class, Integer.TYPE };
+        XMLEncoder xmlEnc5 = new XMLEncoder(os);
+        for (int i = 0; i < objects5.length; i++) {
+            xmlEnc5.writeObject(objects5[i]);
+        }
+        xmlEnc5.flush();
+        xmlEnc5.close();
+        
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+                os.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        Class intClass = (Class) decoder.readObject();
+        Class aIntClass = (Class) decoder.readObject();
+        assertEquals(Integer.class, intClass);
+        assertEquals(Integer.TYPE, aIntClass);
     }
     
     public static class DummyBean {

Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java Sun Sep 16 14:56:42 2007
@@ -14,328 +14,444 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
+
 package javax.imageio.stream;
 
 import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteOrder;
 
+import org.apache.harmony.luni.util.Util;
+
 public abstract class ImageInputStreamImpl implements ImageInputStream {
 
-    protected ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+	protected ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
 
-    protected long streamPos = 0;
-    protected long flushedPos = 0;
-    protected int bitOffset = 0;
-
-    private boolean closed = false;
-
-    private final PositionStack posStack = new PositionStack();
-
-    public ImageInputStreamImpl() {}
-
-    protected final void checkClosed() throws IOException {
-        if (closed) {
-            throw new IOException("stream is closed");
-        }
-    }
-
-    public void setByteOrder(ByteOrder byteOrder) {
-        this.byteOrder = byteOrder;
-    }
-
-    public ByteOrder getByteOrder() {
-        return byteOrder;
-    }
-
-    public abstract int read() throws IOException;
-
-    public int read(byte[] b) throws IOException {
-        return read(b, 0, b.length);
-    }
-
-    public abstract int read(byte[] b, int off, int len) throws IOException;
-
-    public void readBytes(IIOByteBuffer buf, int len) throws IOException {
-        if (buf == null) {
-            throw new NullPointerException("buffer is NULL");
-        }
-
-        byte[] b = new byte[len];
-        len = read(b, 0, b.length);
-
-        buf.setData(b);
-        buf.setOffset(0);
-        buf.setLength(len);
-    }
-
-    public boolean readBoolean() throws IOException {
-        int b = read();
-        if (b < 0) {
-            throw new EOFException("EOF reached");
-        }
-        return b != 0;
-    }
-
-    public byte readByte() throws IOException {
-        int b = read();
-        if (b < 0) {
-            throw new EOFException("EOF reached");
-        }
-        return (byte) b;
-    }
-
-    public int readUnsignedByte() throws IOException {
-        int b = read();
-        if (b < 0) {
-            throw new EOFException("EOF reached");
-        }
-        return b;
-    }
-
-    public short readShort() throws IOException {
-        int b1 = read();
-        int b2 = read();
-
-        if (b1 < 0 || b2 < 0) {
-            throw new EOFException("EOF reached");
-        }
-
-        return byteOrder == ByteOrder.BIG_ENDIAN ?
-                (short) ((b1 << 8) | (b2 & 0xff)) :
-                (short) ((b2 << 8) | (b1 & 0xff));
-    }
-
-    public int readUnsignedShort() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public char readChar() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public int readInt() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long readUnsignedInt() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long readLong() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public float readFloat() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public double readDouble() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public String readLine() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public String readUTF() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(byte[] b, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(byte[] b) throws IOException {
-        readFully(b, 0, b.length);
-    }
-
-    public void readFully(short[] s, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(char[] c, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(int[] i, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(long[] l, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(float[] f, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void readFully(double[] d, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long getStreamPosition() throws IOException {
-        checkClosed();
-        return streamPos;
-    }
-
-    public int getBitOffset() throws IOException {
-        checkClosed();
-        return bitOffset;
-    }
-
-    public void setBitOffset(int bitOffset) throws IOException {
-        checkClosed();
-        this.bitOffset = bitOffset;
-    }
-
-    public int readBit() throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long readBits(int numBits) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long length() {
-        return -1L;
-    }
-
-    public int skipBytes(int n) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public long skipBytes(long n) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void seek(long pos) throws IOException {
-        checkClosed();
-        if (pos < getFlushedPosition()) {
-            throw new IllegalArgumentException("trying to seek before flushed pos");
-        }
-        bitOffset = 0;
-        streamPos = pos;
-    }
-
-    public void mark() {
-        try {
-            posStack.push(getStreamPosition());
-        } catch (IOException e) {
-            e.printStackTrace();
-            throw new RuntimeException("Stream marking error");
-        }
-    }
-
-    public void reset() throws IOException {
-        //-- TODO bit pos
-        if (!posStack.isEmpty()) {
-            long p = posStack.pop();
-            if (p < flushedPos) {
-                throw new IOException("marked position lies in the flushed portion of the stream");
-            }
-            seek(p);
-        }
-    }
-
-    public void flushBefore(long pos) throws IOException {
-        if (pos > getStreamPosition()) {
-            throw new IndexOutOfBoundsException("Trying to flush outside of current position");
-        }
-        if (pos < flushedPos) {
-            throw new IndexOutOfBoundsException("Trying to flush within already flushed portion");
-        }
-        flushedPos = pos;
-        //-- TODO implement
-    }
-
-    public void flush() throws IOException {
-        flushBefore(getStreamPosition());
-    }
-
-    public long getFlushedPosition() {
-        return flushedPos;
-    }
-
-    public boolean isCached() {
-        return false; //def
-    }
-
-    public boolean isCachedMemory() {
-        return false; //def
-    }
-
-    public boolean isCachedFile() {
-        return false; //def
-    }
-
-    public void close() throws IOException {
-        checkClosed();
-        closed = true;
-
-    }
-
-    @Override
-    protected void finalize() throws Throwable {
-        if (!closed) {
-            try {
-                close();
-            } finally {
-                super.finalize();
-            }
-        }
-    }
-
-    private static class PositionStack {
-        private static final int SIZE = 10;
-
-        private long[] values = new long[SIZE];
-        private int pos = 0;
-
-
-        void push(long v) {
-            if (pos >= values.length) {
-                ensure(pos+1);
-            }
-            values[pos++] = v;
-        }
-
-        long pop() {
-            return values[--pos];
-        }
-
-        boolean isEmpty() {
-            return pos == 0;
-        }
-
-        private void ensure(int size) {
-            long[] arr = new long[Math.max(2 * values.length, size)];
-            System.arraycopy(values, 0, arr, 0, values.length);
-            values = arr;
-        }
-    }
+	protected long streamPos = 0;
+	protected long flushedPos = 0;
+	protected int bitOffset = 0;
+
+	private boolean closed = false;
+
+	private final PositionStack posStack = new PositionStack();
+	private final byte[] buff = new byte[8];
+
+	public ImageInputStreamImpl() {
+	}
+
+	protected final void checkClosed() throws IOException {
+		if (closed) {
+			throw new IOException("stream is closed");
+		}
+	}
+
+	public void setByteOrder(ByteOrder byteOrder) {
+		this.byteOrder = byteOrder;
+	}
+
+	public ByteOrder getByteOrder() {
+		return byteOrder;
+	}
+
+	public abstract int read() throws IOException;
+
+	public int read(byte[] b) throws IOException {
+		return read(b, 0, b.length);
+	}
+
+	public abstract int read(byte[] b, int off, int len) throws IOException;
+
+	public void readBytes(IIOByteBuffer buf, int len) throws IOException {
+		if (buf == null) {
+			throw new NullPointerException("buffer is NULL");
+		}
+
+		byte[] b = new byte[len];
+		len = read(b, 0, b.length);
+
+		buf.setData(b);
+		buf.setOffset(0);
+		buf.setLength(len);
+	}
+
+	public boolean readBoolean() throws IOException {
+		int b = read();
+		if (b < 0) {
+			throw new EOFException("EOF reached");
+		}
+		return b != 0;
+	}
+
+	public byte readByte() throws IOException {
+		int b = read();
+		if (b < 0) {
+			throw new EOFException("EOF reached");
+		}
+		return (byte) b;
+	}
+
+	public int readUnsignedByte() throws IOException {
+		int b = read();
+		if (b < 0) {
+			throw new EOFException("EOF reached");
+		}
+		return b;
+	}
+
+	public short readShort() throws IOException {
+		if (read(buff, 0, 2) < 0) {
+			throw new EOFException();
+		}
+
+		return byteOrder == ByteOrder.BIG_ENDIAN ? 
+				(short) ((buff[0] << 8) | (buff[1] & 0xff)) :
+				(short) ((buff[1] << 8) | (buff[0] & 0xff));
+	}
+
+	public int readUnsignedShort() throws IOException {
+		return ((int) readShort()) & 0xffff;
+	}
+
+	public char readChar() throws IOException {
+		return (char) readShort();
+	}
+
+	public int readInt() throws IOException {
+		if (read(buff, 0, 4) < 0) {
+			throw new EOFException();
+		}
+
+		return byteOrder == ByteOrder.BIG_ENDIAN ? ((buff[0] & 0xff) << 24)
+				| ((buff[1] & 0xff) << 16) | ((buff[2] & 0xff) << 8)
+				| (buff[3] & 0xff) : ((buff[3] & 0xff) << 24)
+				| ((buff[2] & 0xff) << 16) | ((buff[1] & 0xff) << 8)
+				| (buff[0] & 0xff);
+	}
+
+	public long readUnsignedInt() throws IOException {
+		return ((long) readInt()) & 0xffffffffL;
+	}
+
+	public long readLong() throws IOException {
+		if (read(buff, 0, 8) < 0) {
+			throw new EOFException();
+		}
+
+		if (byteOrder == ByteOrder.BIG_ENDIAN) {
+			int i1 = ((buff[0] & 0xff) << 24) | ((buff[1] & 0xff) << 16)
+					| ((buff[2] & 0xff) << 8) | (buff[3] & 0xff);
+			int i2 = ((buff[4] & 0xff) << 24) | ((buff[5] & 0xff) << 16)
+					| ((buff[6] & 0xff) << 8) | (buff[7] & 0xff);
+
+			return ((i1 & 0xffffffffL) << 32) | (i2 & 0xffffffffL);
+		} else {
+			int i1 = ((buff[3] & 0xff) << 24) | ((buff[2] & 0xff) << 16)
+					| ((buff[1] & 0xff) << 8) | (buff[0] & 0xff);
+			int i2 = ((buff[7] & 0xff) << 24) | ((buff[6] & 0xff) << 16)
+					| ((buff[5] & 0xff) << 8) | (buff[4] & 0xff);
+
+			return ((i2 & 0xffffffffL) << 32) | (i1 & 0xffffffffL);
+		}
+	}
+
+	public float readFloat() throws IOException {
+		return Float.intBitsToFloat(readInt());
+	}
+
+	public double readDouble() throws IOException {
+		return Double.longBitsToDouble(readLong());
+	}
+
+	public String readLine() throws IOException {
+		final StringBuffer line = new StringBuffer(80);
+		boolean isEmpty = true;
+		int c = -1;
+
+		while ((c = read()) != -1) {
+			isEmpty = false;
+			if (c == '\n') {
+				break;
+			} else if (c == '\r') {
+				c = read();
+				if ((c != '\n') && (c != -1)) {
+					seek(getStreamPosition() - 1);
+				}
+				break;
+			}
+			line.append((char) c);
+		}
+
+		return isEmpty ? null : line.toString();
+	}
+
+	public String readUTF() throws IOException {
+		final int size = readUnsignedShort();
+		final byte[] buf = new byte[size];
+		final char[] out = new char[size];
+
+		readFully(buf, 0, size);
+		//return new DataInputStream(new ByteArrayInputStream(buff)).readUTF();
+		return Util.convertUTF8WithBuf(buf, out, 0, size);
+	}
+
+	public void readFully(byte[] b, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > b.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		while (len > 0) {
+			int i = read(b, off, len);
+
+			if (i == -1) {
+				throw new EOFException();
+			}
+
+			off += i;
+			len -= i;
+		}
+	}
+
+	public void readFully(byte[] b) throws IOException {
+		readFully(b, 0, b.length);
+	}
+
+	public void readFully(short[] s, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > s.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			s[off + i] = readShort();
+		}
+	}
+
+	public void readFully(char[] c, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > c.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			c[off + i] = readChar();
+		}
+	}
+
+	public void readFully(int[] i, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > i.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int k = 0; k < len; k++) {
+			i[off + k] = readInt();
+		}
+	}
+
+	public void readFully(long[] l, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > l.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			l[off + i] = readLong();
+		}
+	}
+
+	public void readFully(float[] f, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > f.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			f[off + i] = readFloat();
+		}
+	}
+
+	public void readFully(double[] d, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > d.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			d[off + i] = readFloat();
+		}
+	}
+
+	public long getStreamPosition() throws IOException {
+		checkClosed();
+		return streamPos;
+	}
+
+	public int getBitOffset() throws IOException {
+		checkClosed();
+		return bitOffset;
+	}
+
+	public void setBitOffset(int bitOffset) throws IOException {
+		checkClosed();
+		if ((bitOffset < 0) || (bitOffset > 7)) {
+			throw new IllegalArgumentException();
+		}
+		this.bitOffset = bitOffset;
+	}
+
+	int currentByte;
+
+	public int readBit() throws IOException {
+		checkClosed();
+
+		int offset = bitOffset;
+		int currentByte = read();
+
+		if (currentByte == -1) {
+			throw new EOFException();
+		}
+
+		offset = (offset + 1) & 7;
+
+		if (offset != 0) {
+			currentByte >>= 8 - offset;
+			seek(getStreamPosition() - 1);
+		}
+
+		bitOffset = offset;
+		return currentByte & 1;
+	}
+
+	public long readBits(int numBits) throws IOException {
+		checkClosed();
+
+		if ((numBits < 0) || (numBits > 64)) {
+			throw new IllegalArgumentException();
+		}
+
+		long res = 0;
+
+		for (int i = 0; i < numBits; i++) {
+			res <<= 1;
+			res |= readBit();
+		}
+
+		return res;
+	}
+
+	public long length() {
+		return -1L;
+	}
+
+	public int skipBytes(int n) throws IOException {
+		return (int) skipBytes((long) n);
+	}
+
+	public long skipBytes(long n) throws IOException {
+		seek(getStreamPosition() + n);
+		return n;
+	}
+
+	public void seek(long pos) throws IOException {
+		checkClosed();
+		if (pos < getFlushedPosition()) {
+			throw new IllegalArgumentException(
+					"trying to seek before flushed pos");
+		}
+		bitOffset = 0;
+		streamPos = pos;
+	}
+
+	public void mark() {
+		try {
+			posStack.push(getStreamPosition());
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw new RuntimeException("Stream marking error");
+		}
+	}
+
+	public void reset() throws IOException {
+		// -- TODO bit pos
+		if (!posStack.isEmpty()) {
+			long p = posStack.pop();
+			if (p < flushedPos) {
+				throw new IOException(
+						"marked position lies in the flushed portion of the stream");
+			}
+			seek(p);
+		}
+	}
+
+	public void flushBefore(long pos) throws IOException {
+		if (pos > getStreamPosition()) {
+			throw new IndexOutOfBoundsException(
+					"Trying to flush outside of current position");
+		}
+		if (pos < flushedPos) {
+			throw new IndexOutOfBoundsException(
+					"Trying to flush within already flushed portion");
+		}
+		flushedPos = pos;
+		// -- TODO implement
+	}
+
+	public void flush() throws IOException {
+		flushBefore(getStreamPosition());
+	}
+
+	public long getFlushedPosition() {
+		return flushedPos;
+	}
+
+	public boolean isCached() {
+		return false; // def
+	}
+
+	public boolean isCachedMemory() {
+		return false; // def
+	}
+
+	public boolean isCachedFile() {
+		return false; // def
+	}
+
+	public void close() throws IOException {
+		checkClosed();
+		closed = true;
+
+	}
+
+	@Override
+	protected void finalize() throws Throwable {
+		if (!closed) {
+			try {
+				close();
+			} finally {
+				super.finalize();
+			}
+		}
+	}
+
+	private static class PositionStack {
+		private static final int SIZE = 10;
+
+		private long[] values = new long[SIZE];
+		private int pos = 0;
+
+		void push(long v) {
+			if (pos >= values.length) {
+				ensure(pos + 1);
+			}
+			values[pos++] = v;
+		}
+
+		long pop() {
+			return values[--pos];
+		}
+
+		boolean isEmpty() {
+			return pos == 0;
+		}
+
+		private void ensure(int size) {
+			long[] arr = new long[Math.max(2 * values.length, size)];
+			System.arraycopy(values, 0, arr, 0, values.length);
+			values = arr;
+		}
+	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java Sun Sep 16 14:56:42 2007
@@ -20,136 +20,191 @@
  */
 package javax.imageio.stream;
 
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
 import java.io.IOException;
 import java.nio.ByteOrder;
 
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
 public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl
-        implements ImageOutputStream {
+		implements ImageOutputStream {
 
-    public ImageOutputStreamImpl() {}
+	private final byte[] buff = new byte[8];
 
-    public abstract void write(int b) throws IOException;
+	public ImageOutputStreamImpl() {
+	}
 
-    public void write(byte[] b) throws IOException {
-        write(b, 0, b.length);
-    }
-
-    public abstract void write(byte[] b, int off, int len) throws IOException;
-
-    public void writeBoolean(boolean v) throws IOException {
-        write(v ? 1 : 0);
-    }
-
-    public void writeByte(int v) throws IOException {
-        write(v);
-    }
-
-    public void writeShort(int v) throws IOException {
-        if (byteOrder == ByteOrder.BIG_ENDIAN) {
-
-        } else {
-
-        }
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeChar(int v) throws IOException {
-        writeShort(v);
-    }
-
-    public void writeInt(int v) throws IOException {
-        if (byteOrder == ByteOrder.BIG_ENDIAN) {
-
-        } else {
-
-        }
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeLong(long v) throws IOException {
-        if (byteOrder == ByteOrder.BIG_ENDIAN) {
-
-        } else {
-
-        }
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeFloat(float v) throws IOException {
-        writeInt(Float.floatToIntBits(v));
-    }
-
-    public void writeDouble(double v) throws IOException {
-        writeLong(Double.doubleToLongBits(v));
-    }
-
-    public void writeBytes(String s) throws IOException {
-        write(s.getBytes());
-    }
-
-    public void writeChars(String s) throws IOException {
-        char[] chs = s.toCharArray();
-        writeChars(chs, 0, chs.length);
-    }
-
-    public void writeUTF(String s) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeShorts(short[] s, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeChars(char[] c, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeInts(int[] i, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeLongs(long[] l, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeFloats(float[] f, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeDoubles(double[] d, int off, int len) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeBit(int bit) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    public void writeBits(long bits, int numBits) throws IOException {
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
-
-    protected final void flushBits() throws IOException {
-        if (bitOffset == 0) {
-            return;
-        }
-        
-        //-- TODO implement
-        throw new UnsupportedOperationException("Not implemented yet");
-    }
+	public abstract void write(int b) throws IOException;
+
+	public void write(byte[] b) throws IOException {
+		write(b, 0, b.length);
+	}
+
+	public abstract void write(byte[] b, int off, int len) throws IOException;
+
+	public void writeBoolean(boolean v) throws IOException {
+		write(v ? 1 : 0);
+	}
+
+	public void writeByte(int v) throws IOException {
+		write(v);
+	}
+
+	public void writeShort(int v) throws IOException {
+		if (byteOrder == ByteOrder.BIG_ENDIAN) {
+			buff[0] = (byte) (v >> 8);
+			buff[1] = (byte) v;
+		} else {
+			buff[1] = (byte) (v >> 8);
+			buff[0] = (byte) v;
+		}
+
+		write(buff, 0, 2);
+	}
+
+	public void writeChar(int v) throws IOException {
+		writeShort(v);
+	}
+
+	public void writeInt(int v) throws IOException {
+		if (byteOrder == ByteOrder.BIG_ENDIAN) {
+			buff[0] = (byte) (v >> 24);
+			buff[1] = (byte) (v >> 16);
+			buff[2] = (byte) (v >> 8);
+			buff[3] = (byte) v;
+		} else {
+			buff[3] = (byte) (v >> 24);
+			buff[2] = (byte) (v >> 16);
+			buff[1] = (byte) (v >> 8);
+			buff[0] = (byte) v;
+		}
+
+		write(buff, 0, 4);
+	}
+
+	public void writeLong(long v) throws IOException {
+		if (byteOrder == ByteOrder.BIG_ENDIAN) {
+			buff[0] = (byte) (v >> 56);
+			buff[1] = (byte) (v >> 48);
+			buff[2] = (byte) (v >> 40);
+			buff[3] = (byte) (v >> 32);
+			buff[4] = (byte) (v >> 24);
+			buff[5] = (byte) (v >> 16);
+			buff[6] = (byte) (v >> 8);
+			buff[7] = (byte) (v);
+		} else {
+			buff[7] = (byte) (v >> 56);
+			buff[6] = (byte) (v >> 48);
+			buff[5] = (byte) (v >> 40);
+			buff[4] = (byte) (v >> 32);
+			buff[3] = (byte) (v >> 24);
+			buff[2] = (byte) (v >> 16);
+			buff[1] = (byte) (v >> 8);
+			buff[0] = (byte) (v);
+		}
+
+		write(buff, 0, 8);
+	}
+
+	public void writeFloat(float v) throws IOException {
+		writeInt(Float.floatToIntBits(v));
+	}
+
+	public void writeDouble(double v) throws IOException {
+		writeLong(Double.doubleToLongBits(v));
+	}
+
+	public void writeBytes(String s) throws IOException {
+		write(s.getBytes());
+	}
+
+	public void writeChars(String s) throws IOException {
+		char[] chs = s.toCharArray();
+		writeChars(chs, 0, chs.length);
+	}
+
+	public void writeUTF(String s) throws IOException {
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+		new DataOutputStream(baos).writeUTF(s);
+		write(baos.toByteArray(), 0, baos.size());
+	}
+
+	public void writeShorts(short[] s, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > s.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			writeShort(s[off + i]);
+		}
+	}
+
+	public void writeChars(char[] c, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > c.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			writeShort(c[off + i]);
+		}
+	}
+
+	public void writeInts(int[] i, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > i.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int n = 0; n < len; n++) {
+			writeInt(i[off + n]);
+		}
+	}
+
+	public void writeLongs(long[] l, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > l.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			writeLong(l[off + i]);
+		}
+	}
+
+	public void writeFloats(float[] f, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > f.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			writeFloat(f[off + i]);
+		}
+	}
+
+	public void writeDoubles(double[] d, int off, int len) throws IOException {
+		if ((off < 0) || (len < 0) || (off + len > d.length)) {
+			throw new IndexOutOfBoundsException();
+		}
+
+		for (int i = 0; i < len; i++) {
+			writeDouble(d[off + i]);
+		}
+	}
+
+	public void writeBit(int bit) throws IOException {
+		// -- TODO implement
+		throw new UnsupportedOperationException("Not implemented yet");
+	}
+
+	public void writeBits(long bits, int numBits) throws IOException {
+		// -- TODO implement
+		throw new UnsupportedOperationException("Not implemented yet");
+	}
+
+	protected final void flushBits() throws IOException {
+		if (bitOffset == 0) {
+			return;
+		}
+
+		// -- TODO implement
+		throw new UnsupportedOperationException("Not implemented yet");
+	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/InitialContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/InitialContext.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/InitialContext.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/InitialContext.java Sun Sep 16 14:56:42 2007
@@ -17,6 +17,7 @@
 
 package javax.naming;
 
+import java.util.HashMap;
 import java.util.Hashtable;
 import javax.naming.spi.NamingManager;
 
@@ -396,10 +397,21 @@
         String scheme = UrlParser.getScheme(name);
         Context ctx = null;
         if (null != scheme) {
-            // So the first component is a valid URL
-            ctx = NamingManager.getURLContext(scheme, myProps);
+            synchronized (contextCache) {
+                if (contextCache.containsKey(scheme)) {
+                    return contextCache.get(scheme);
+                }
+
+                // So the first component is a valid URL
+                ctx = NamingManager.getURLContext(scheme, myProps);
+                if (null == ctx) {
+                    ctx = getDefaultInitCtx();
+                }
+                contextCache.put(scheme, ctx);               
+            }
+            return ctx;
         }
-        return null == ctx ? getDefaultInitCtx() : ctx;
+        return getDefaultInitCtx();
     }
 
     public Object lookup(Name name) throws NamingException {
@@ -538,13 +550,19 @@
     }
 
     public Object addToEnvironment(String propName, Object propVal)
-            throws NamingException {
-        this.myProps.put(propName, propVal);
+            throws NamingException {        
+        synchronized (contextCache) {
+            myProps.put(propName, propVal);
+            contextCache.clear();
+        }
         return getDefaultInitCtx().addToEnvironment(propName, propVal);
     }
 
     public Object removeFromEnvironment(String propName) throws NamingException {
-        this.myProps.remove(propName);
+        synchronized (contextCache) {
+            myProps.remove(propName);
+            contextCache.clear();
+        }
         return getDefaultInitCtx().removeFromEnvironment(propName);
     }
 
@@ -561,5 +579,7 @@
     public String getNameInNamespace() throws NamingException {
         return getDefaultInitCtx().getNameInNamespace();
     }
-
+    
+    
+    private HashMap<String, Context> contextCache = new HashMap<String, Context>();   
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl Sun Sep 16 14:56:42 2007
@@ -2,3 +2,5 @@
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 tests/api/java/net/SocketTest.java
 
+# HARMONY-4753
+org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl Sun Sep 16 14:56:42 2007
@@ -3,3 +3,6 @@
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 tests/api/java/net/SocketTest.java
 tests/api/java/net/MulticastSocketTest.java
+
+# HARMONY-4753
+org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl Sun Sep 16 14:56:42 2007
@@ -0,0 +1,2 @@
+# HARMONY-4753
+org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl Sun Sep 16 14:56:42 2007
@@ -1,2 +1,5 @@
 tests/api/java/net/MulticastSocketTest.java
 tests/api/java/util/ArrayListTest.java
+
+# HARMONY-4753
+org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java

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?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- 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 Sun Sep 16 14:56:42 2007
@@ -23,7 +23,8 @@
 import java.lang.reflect.Array;
 
 public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V> implements
-        Map<K, V>, Serializable, Cloneable {
+        Serializable, Cloneable {
+
     private static final long serialVersionUID = 458661240069192865L;
 
     private Class<K> keyType;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java Sun Sep 16 14:56:42 2007
@@ -43,18 +43,28 @@
     private static final int DEFAULT_SIZE = 16;
 
     static class Entry<K, V> extends MapEntry<K, V> {
-        final int origKeyHash;
+        final int storedKeyHash;
 
         Entry<K, V> next;
 
         Entry(K theKey, int hash) {
             super(theKey, null);
-            this.origKeyHash = hash;
+            if (theKey instanceof Integer) {
+                this.storedKeyHash = hash | 0x00000001;
+            } else {
+                this.storedKeyHash = hash & 0xFFFFFFFE;
+            }
         }
 
         Entry(K theKey, V theValue) {
             super(theKey, theValue);
-            origKeyHash = (theKey == null ? 0 : theKey.hashCode());
+            if (theKey == null) {
+                storedKeyHash = 0;
+            } else if (theKey instanceof Integer) {
+                storedKeyHash = theKey.hashCode() | 0x00000001;
+            } else {
+                storedKeyHash = theKey.hashCode() & 0xFFFFFFFE;
+            }
         }
 
         @Override
@@ -194,7 +204,7 @@
                     int index = hash & (associatedMap.elementData.length - 1);
                     entry = associatedMap.findNonNullKeyEntry(key, index, hash);
                 }
-                return object.equals(entry);
+                return entry == null ? false : entry.equals(object);
             }
             return false;
         }
@@ -251,13 +261,16 @@
     }
     
     private static final int calculateCapacity(int x) {
-        if(x >= 1 << 30){
+        if (x >= 1 << 30) {
             return 1 << 30;
         }
-        if(x == 0){
+        if (x == 0) {
             return 16;
         }
-        x = x -1;
+        if (x == 1) {
+            return 2;
+        }
+        x = x - 1;
         x |= x >> 1;
         x |= x >> 2;
         x |= x >> 4;
@@ -445,16 +458,25 @@
 
     final Entry<K,V> findNonNullKeyEntry(Object key, int index, int keyHash) {
         Entry<K,V> m = elementData[index];
-        while (m != null && (m.origKeyHash != keyHash || !key.equals(m.key))) {
-            m = m.next;
+        if (key instanceof Integer) {
+            int storedKeyHash = keyHash | 0x00000001;
+            while (m != null && (m.storedKeyHash != storedKeyHash)) {
+                m = m.next;
+            }
+        } else {
+            int storedKeyHash = keyHash & 0xFFFFFFFE;
+            while (m != null && (m.storedKeyHash != storedKeyHash || !key.equals(m.key))) {
+                m = m.next;
+            }
         }
         return m;
     }
   
     final Entry<K,V> findNullKeyEntry() {
         Entry<K,V> m = elementData[0];
-        while (m != null && m.key != null)
+        while (m != null && m.key != null) {
             m = m.next;
+        }
         return m;
     }
 
@@ -569,7 +591,7 @@
     }
 
     Entry<K,V> createHashedEntry(K key, int index, int hash) {
-        Entry<K,V> entry = new Entry<K,V>(key,hash);
+        Entry<K,V> entry = new Entry<K,V>(key, hash);
         entry.next = elementData[index];
         elementData[index] = entry;
         return entry;
@@ -609,7 +631,8 @@
         for (int i = 0; i < elementData.length; i++) {
             Entry<K, V> entry = elementData[i];
             while (entry != null) {
-                int index = entry.origKeyHash & (length - 1);
+                int actualHash = (i & 0x00000001) | (entry.storedKeyHash & 0xFFFFFFFE);
+                int index = actualHash & (length - 1);
                 Entry<K, V> next = entry.next;
                 entry.next = newData[index];
                 newData[index] = entry;
@@ -646,12 +669,22 @@
         Entry<K, V> entry;
         Entry<K, V> last = null;
         if (key != null) {
-            int hash = key.hashCode();
-            index = hash & (elementData.length - 1);
+            int keyHash = key.hashCode();
+            index = keyHash & (elementData.length - 1);
             entry = elementData[index];
-            while (entry != null && !(entry.origKeyHash == hash && key.equals(entry.key))) {
-                last = entry;
-                entry = entry.next;
+
+            if (key instanceof Integer) {
+                int storedKeyHash = keyHash | 0x00000001;
+                while (entry != null && (entry.storedKeyHash != storedKeyHash)) {
+                    last = entry;
+                    entry = entry.next;
+                }
+            } else {
+                int storedKeyHash = keyHash & 0xFFFFFFFE;
+                while (entry != null && (entry.storedKeyHash != storedKeyHash || !key.equals(entry.key))) {
+                    last = entry;
+                    entry = entry.next;
+                }
             }
         } else {
             entry = elementData[0];

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Map.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Map.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Map.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Map.java Sun Sep 16 14:56:42 2007
@@ -17,224 +17,223 @@
 
 package java.util;
 
-
 /**
  * Map has a set of keys, each key is mapped to a single value.
  */
-public interface Map<K,V> {
-	/**
-	 * Map.Entry is a key/value mapping which is contained in a Map.
-	 * 
-	 */
-	public abstract static interface Entry<K,V> {
-		/**
-		 * Compares the specified object to this Map.Entry and answer if they
-		 * are equal. The object must be an instance of Map.Entry and have the
-		 * same key and value.
-		 * 
-		 * @param object
-		 *            the object to compare with this object
-		 * @return true if the specified object is equal to this Map.Entry,
-		 *         false otherwise
-		 * 
-		 * @see #hashCode
-		 */
-		public boolean equals(Object object);
-
-		/**
-		 * Gets the key.
-		 * 
-		 * @return the key
-		 */
-		public K getKey();
-
-		/**
-		 * Gets the value.
-		 * 
-		 * @return the value
-		 */
-		public V getValue();
-
-		/**
-		 * Answers an integer hash code for the receiver. Objects which are
-		 * equal answer the same value for this method.
-		 * 
-		 * @return the receiver's hash
-		 * 
-		 * @see #equals
-		 */
-		public int hashCode();
-
-		/**
-		 * Sets the value.
-		 * 
-		 * @param object
-		 *            the new value
-		 * @return object
-		 */
-		public V setValue(V object);
-	};
-
-	/**
-	 * Removes all elements from this Map, leaving it empty.
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Map is not supported
-	 * 
-	 * @see #isEmpty
-	 * @see #size
-	 */
-	public void clear();
-
-	/**
-	 * Searches this Map for the specified key.
-	 * 
-	 * @param key
-	 *            the object to search for
-	 * @return true if <code>key</code> is a key of this Map, false otherwise
-	 */
-	public boolean containsKey(Object key);
-
-	/**
-	 * Searches this Map for the specified value.
-	 * 
-	 * @param value
-	 *            the object to search for
-	 * @return true if <code>value</code> is a value of this Map, false
-	 *         otherwise
-	 */
-	public boolean containsValue(Object value);
-
-	/**
-	 * Returns a <code>Set</code> whose elements comprise all of the mappings
-	 * that are to be found in this <code>Map</code>. Information on each of
-	 * the mappings is encapsulated in a separate {@link Map.Entry} instance. As
-	 * the <code>Set</code> is backed by this <code>Map</code>, users
-	 * should be aware that changes in one will be immediately visible in the
-	 * other.
-	 * 
-	 * @return a <code>Set</code> of the mappings
-	 */
-	public Set<Map.Entry<K,V>> entrySet();
-
-	/**
-	 * Compares the argument to the receiver, and answers true if they represent
-	 * the <em>same</em> object using a class specific comparison.
-	 * 
-	 * @param object
-	 *            Object the object to compare with this object.
-	 * @return boolean <code>true</code> if the object is the same as this
-	 *         object <code>false</code> if it is different from this object.
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object);
-
-	/**
-	 * Answers the value of the mapping with the specified key.
-	 * 
-	 * @param key
-	 *            the key
-	 * @return the value of the mapping with the specified key
-	 */
-	public V get(Object key);
-
-	/**
-	 * Answers an integer hash code for the receiver. Objects which are equal
-	 * answer the same value for this method.
-	 * 
-	 * @return the receiver's hash
-	 * 
-	 * @see #equals
-	 */
-	public int hashCode();
-
-	/**
-	 * Answers if this Map has no elements, a size of zero.
-	 * 
-	 * @return true if this Map has no elements, false otherwise
-	 * 
-	 * @see #size
-	 */
-	public boolean isEmpty();
-
-	/**
-	 * Answers a Set of the keys contained in this Map. The set is backed by
-	 * this Map so changes to one are relected by the other. The set does not
-	 * support adding.
-	 * 
-	 * @return a Set of the keys
-	 */
-	public Set<K> keySet();
-
-	/**
-	 * Maps the specified key to the specified value.
-	 * 
-	 * @param key
-	 *            the key
-	 * @param value
-	 *            the value
-	 * @return the value of any previous mapping with the specified key or null
-	 *         if there was no mapping
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when adding to this Map is not supported
-	 * @exception ClassCastException
-	 *                when the class of the key or value is inappropriate for
-	 *                this Map
-	 * @exception IllegalArgumentException
-	 *                when the key or value cannot be added to this Map
-	 * @exception NullPointerException
-	 *                when the key or value is null and this Map does not
-	 *                support null keys or values
-	 */
-	public V put(K key, V value);
-
-	/**
-	 * Copies every mapping in the specified Map to this Map.
-	 * 
-	 * @param map
-	 *            the Map to copy mappings from
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when adding to this Map is not supported
-	 * @exception ClassCastException
-	 *                when the class of a key or value is inappropriate for this
-	 *                Map
-	 * @exception IllegalArgumentException
-	 *                when a key or value cannot be added to this Map
-	 * @exception NullPointerException
-	 *                when a key or value is null and this Map does not support
-	 *                null keys or values
-	 */
-	public void putAll(Map<? extends K,? extends V> map);
-
-	/**
-	 * Removes a mapping with the specified key from this Map.
-	 * 
-	 * @param key
-	 *            the key of the mapping to remove
-	 * @return the value of the removed mapping or null if key is not a key in
-	 *         this Map
-	 * 
-	 * @exception UnsupportedOperationException
-	 *                when removing from this Map is not supported
-	 */
-	public V remove(Object key);
-
-	/**
-	 * Answers the number of elements in this Map.
-	 * 
-	 * @return the number of elements in this Map
-	 */
-	public int size();
-
-	/**
-	 * Returns all of the current <code>Map</code> values in a
-	 * <code>Collection</code>. As the returned <code>Collection</code> is
-	 * backed by this <code>Map</code>, users should be aware that changes in
-	 * one will be immediately visible in the other.
-	 * 
-	 * @return a Collection of the values
-	 */
-	public Collection<V> values();
+public interface Map<K, V> {
+
+    /**
+     * Map.Entry is a key/value mapping which is contained in a Map.
+     */
+    public static interface Entry<K, V> {
+        /**
+         * Compares the specified object to this Map.Entry and answer if they
+         * are equal. The object must be an instance of Map.Entry and have the
+         * same key and value.
+         * 
+         * @param object
+         *            the object to compare with this object
+         * @return true if the specified object is equal to this Map.Entry,
+         *         false otherwise
+         * 
+         * @see #hashCode
+         */
+        public boolean equals(Object object);
+
+        /**
+         * Gets the key.
+         * 
+         * @return the key
+         */
+        public K getKey();
+
+        /**
+         * Gets the value.
+         * 
+         * @return the value
+         */
+        public V getValue();
+
+        /**
+         * Answers an integer hash code for the receiver. Objects which are
+         * equal answer the same value for this method.
+         * 
+         * @return the receiver's hash
+         * 
+         * @see #equals
+         */
+        public int hashCode();
+
+        /**
+         * Sets the value.
+         * 
+         * @param object
+         *            the new value
+         * @return object
+         */
+        public V setValue(V object);
+    }
+
+    /**
+     * Removes all elements from this Map, leaving it empty.
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Map is not supported
+     * 
+     * @see #isEmpty
+     * @see #size
+     */
+    public void clear();
+
+    /**
+     * Searches this Map for the specified key.
+     * 
+     * @param key
+     *            the object to search for
+     * @return true if <code>key</code> is a key of this Map, false otherwise
+     */
+    public boolean containsKey(Object key);
+
+    /**
+     * Searches this Map for the specified value.
+     * 
+     * @param value
+     *            the object to search for
+     * @return true if <code>value</code> is a value of this Map, false
+     *         otherwise
+     */
+    public boolean containsValue(Object value);
+
+    /**
+     * Returns a <code>Set</code> whose elements comprise all of the mappings
+     * that are to be found in this <code>Map</code>. Information on each of
+     * the mappings is encapsulated in a separate {@link Map.Entry} instance. As
+     * the <code>Set</code> is backed by this <code>Map</code>, users
+     * should be aware that changes in one will be immediately visible in the
+     * other.
+     * 
+     * @return a <code>Set</code> of the mappings
+     */
+    public Set<Map.Entry<K, V>> entrySet();
+
+    /**
+     * Compares the argument to the receiver, and answers true if they represent
+     * the <em>same</em> object using a class specific comparison.
+     * 
+     * @param object
+     *            Object the object to compare with this object.
+     * @return boolean <code>true</code> if the object is the same as this
+     *         object <code>false</code> if it is different from this object.
+     * @see #hashCode
+     */
+    public boolean equals(Object object);
+
+    /**
+     * Answers the value of the mapping with the specified key.
+     * 
+     * @param key
+     *            the key
+     * @return the value of the mapping with the specified key
+     */
+    public V get(Object key);
+
+    /**
+     * Answers an integer hash code for the receiver. Objects which are equal
+     * answer the same value for this method.
+     * 
+     * @return the receiver's hash
+     * 
+     * @see #equals
+     */
+    public int hashCode();
+
+    /**
+     * Answers if this Map has no elements, a size of zero.
+     * 
+     * @return true if this Map has no elements, false otherwise
+     * 
+     * @see #size
+     */
+    public boolean isEmpty();
+
+    /**
+     * Answers a Set of the keys contained in this Map. The set is backed by
+     * this Map so changes to one are reflected by the other. The set does not
+     * support adding.
+     * 
+     * @return a Set of the keys
+     */
+    public Set<K> keySet();
+
+    /**
+     * Maps the specified key to the specified value.
+     * 
+     * @param key
+     *            the key
+     * @param value
+     *            the value
+     * @return the value of any previous mapping with the specified key or null
+     *         if there was no mapping
+     * 
+     * @exception UnsupportedOperationException
+     *                when adding to this Map is not supported
+     * @exception ClassCastException
+     *                when the class of the key or value is inappropriate for
+     *                this Map
+     * @exception IllegalArgumentException
+     *                when the key or value cannot be added to this Map
+     * @exception NullPointerException
+     *                when the key or value is null and this Map does not
+     *                support null keys or values
+     */
+    public V put(K key, V value);
+
+    /**
+     * Copies every mapping in the specified Map to this Map.
+     * 
+     * @param map
+     *            the Map to copy mappings from
+     * 
+     * @exception UnsupportedOperationException
+     *                when adding to this Map is not supported
+     * @exception ClassCastException
+     *                when the class of a key or value is inappropriate for this
+     *                Map
+     * @exception IllegalArgumentException
+     *                when a key or value cannot be added to this Map
+     * @exception NullPointerException
+     *                when a key or value is null and this Map does not support
+     *                null keys or values
+     */
+    public void putAll(Map<? extends K, ? extends V> map);
+
+    /**
+     * Removes a mapping with the specified key from this Map.
+     * 
+     * @param key
+     *            the key of the mapping to remove
+     * @return the value of the removed mapping or null if key is not a key in
+     *         this Map
+     * 
+     * @exception UnsupportedOperationException
+     *                when removing from this Map is not supported
+     */
+    public V remove(Object key);
+
+    /**
+     * Answers the number of elements in this Map.
+     * 
+     * @return the number of elements in this Map
+     */
+    public int size();
+
+    /**
+     * Returns all of the current <code>Map</code> values in a
+     * <code>Collection</code>. As the returned <code>Collection</code> is
+     * backed by this <code>Map</code>, users should be aware that changes in
+     * one will be immediately visible in the other.
+     * 
+     * @return a Collection of the values
+     */
+    public Collection<V> values();
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java Sun Sep 16 14:56:42 2007
@@ -149,6 +149,14 @@
 		}
 		long bytesRead = readImpl(fileDescriptor, bytes, offset, length);
 		if (bytesRead < -1) {
+                        /*
+                         * TODO: bytesRead is never less than -1 so this code
+                         * does nothing?
+                         * The native code throws an exception in only one case
+                         * so perhaps this should be 'bytesRead < 0' to handle
+                         * any other cases.  But the other cases have been
+                         * ignored until now so fixing this could break things
+                         */
 			throw new IOException();
 		}
 		return bytesRead;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSFileSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSFileSystem.c?rev=576185&r1=576184&r2=576185&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSFileSystem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSFileSystem.c Sun Sep 16 14:56:42 2007
@@ -74,7 +74,8 @@
   if(result == -1 && hyerror_last_error_number() == HYPORT_ERROR_FILE_LOCKED){
     throwNewExceptionByName(env, "java/io/IOException", netLookupErrorString(env, HYPORT_ERROR_FILE_LOCKED));
   }
-  (*env)->ReleaseByteArrayElements (env, byteArray, bytes, 0);
+  (*env)->ReleaseByteArrayElements (env, byteArray, bytes,
+                                    result==0 || result==-1 ? JNI_ABORT : 0);
 
   return result;
 }



Mime
View raw message