You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/08/22 09:15:27 UTC
svn commit: r687988 [2/11] - in /harmony/enhanced/classlib/branches/java6:
./ depends/build/ depends/build/platform/ depends/jars/
depends/jars/icu4jni_3.4/ depends/manifests/bcel-5.2/
depends/manifests/bcel-5.2/META-INF/ make/ modules/accessibility/ m...
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/build.xml Fri Aug 22 00:15:00 2008
@@ -55,19 +55,21 @@
</copy>
</target>
- <target name="copy-zipsup-include" if="hy.skip.zip.api">
+ <target name="copy-zipsup-include" if="hy.skip.zip.api">
<copy todir="${hy.hdk}/include" overwrite="yes">
<fileset dir="${hy.archive.src.main.native}/include/shared">
<include name="zipsup.h" />
</fileset>
</copy>
- </target>
+ </target>
- <target name="overlay-oss" unless="hy.skip.zlib">
+ <target name="overlay-oss" depends="-unzip-oss,-ascii2ebcdic-conversion"
+ unless="hy.skip.zlib" />
+
+ <target name="-unzip-oss">
<mkdir dir="${hy.archive.src.main.native}/zlib_dist" />
<unzip src="${zlib.zip}" dest="${hy.archive.src.main.native}/zlib_dist" />
<chmod dir="${hy.archive.src.main.native}/zlib_dist" perm="ugo+r" />
- <antcall target="-ascii2ebcdic-conversion" />
</target>
<target name="-ascii2ebcdic-conversion" if="is.zos">
@@ -166,22 +168,21 @@
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build, compile-tests, prepare-exclude, run-tests" />
- <target name="clean">
+ <target name="clean" depends="clean-native-includes" >
<delete file="${hy.jdk}/jre/lib/boot/archive.jar" />
<delete file="${hy.jdk}/jre/lib/boot/archive-src.jar" />
<delete failonerror="false">
<fileset refid="classes" />
</delete>
<delete failonerror="false" dir="bin"/>
- <antcall target="clean-native-includes" />
</target>
<target name="clean-native-includes">
- <delete failonerror="false">
- <fileset dir="${hy.hdk}/include">
- <include name="zipsup.h" />
- </fileset>
- </delete>
+ <delete failonerror="false">
+ <fileset dir="${hy.hdk}/include">
+ <include name="zipsup.h" />
+ </fileset>
+ </delete>
</target>
<target name="compile-java">
@@ -285,6 +286,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<!-- Used by Support_Exec.execJava() -->
<jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java Fri Aug 22 00:15:00 2008
@@ -46,7 +46,7 @@
this.buf = buf;
// check a version attribute
- if (!readHeader() || !name.equals(ver)) {
+ if (!readHeader() || (ver != null && !name.equals(ver))) {
throw new IOException(Messages.getString(
"archive.2D", ver)); //$NON-NLS-1$
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java Fri Aug 22 00:15:00 2008
@@ -218,8 +218,9 @@
buf[buf.length - 1] = '\n';
}
- im = new InitManifest(buf, mainAttributes,
- Attributes.Name.MANIFEST_VERSION);
+ // Attributes.Name.MANIFEST_VERSION is not used for
+ // the second parameter for RI compatibility
+ im = new InitManifest(buf, mainAttributes, null);
mainEnd = im.getPos();
// FIXME
im.initEntries(entries, chunks);
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jarfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jarfile.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jarfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jarfile.c Fri Aug 22 00:15:00 2008
@@ -91,8 +91,6 @@
jbyteArray zipName)
{
-#define MAX_PATH_J 1024
-
#define RESULT_BUF_SIZE 256
PORT_ACCESS_FROM_ENV (env);
@@ -116,8 +114,8 @@
char metaInfName[10]; /* 10 == strlen("META-INF/") + 1 */
jobjectArray result = NULL;
char *nameBuf, *newNameBuf, *oldNameBuf = NULL;
- char startNameBuf[MAX_PATH_J];
- UDATA nameBufSize = MAX_PATH_J;
+ char startNameBuf[HyMaxPath];
+ UDATA nameBufSize = HyMaxPath;
IDATA rc;
#ifdef HY_ZIP_API
VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
@@ -225,6 +223,5 @@
}
return NULL;
-#undef MAX_PATH_J
#undef RESULT_BUF_SIZE
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jclcrc32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jclcrc32.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jclcrc32.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/native/archive/shared/jclcrc32.c Fri Aug 22 00:15:00 2008
@@ -17,6 +17,7 @@
#include "vmi.h"
#include "zconf.h"
+#include "exceptions.h"
uLong crc32 PROTOTYPE ((uLong crc, const Bytef * buf, uInt size));
@@ -29,8 +30,10 @@
jlong result;
b = ((*env)->GetPrimitiveArrayCritical (env, buf, 0));
- if (b == NULL)
+ if (b == NULL) {
+ throwNewOutOfMemoryError(env, "");
return -1;
+ }
result = crc32 ((uLong) crc, (Bytef *) (b + off), (uInt) len);
((*env)->ReleasePrimitiveArrayCritical (env, buf, b, JNI_ABORT));
return result;
Modified: harmony/enhanced/classlib/branches/java6/modules/auth/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/auth/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/auth/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/auth/build.xml Fri Aug 22 00:15:00 2008
@@ -215,6 +215,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<!-- Used by Support_Exec.execJava() -->
<jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/build.xml Fri Aug 22 00:15:00 2008
@@ -110,6 +110,12 @@
<target name="copy-resources" depends="-copy-win-resources">
<mkdir dir="${hy.build}" />
+ <copy todir="${hy.build}" includeemptydirs="false">
+ <fileset dir="${hy.awt.src.main.java}">
+ <exclude name="**/*.java" />
+ </fileset>
+ </copy>
+
<mkdir dir="${hy.jdk}/jre/lib/cmm" />
<copy todir="${hy.jdk}/jre/lib/cmm">
<fileset dir="${hy.awt.src.main.resources}/cmm"/>
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.common?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.common Fri Aug 22 00:15:00 2008
@@ -6,7 +6,6 @@
java/awt/ListTest.java
java/awt/WinWindowRTest.java
org/apache/harmony/awt/gl/render/JavaBlitterTest.java
-java/awt/image/RasterTest.java
# Intermittent failure, seems RobotTest depends on
# whether mouse or keyboard were touched during the test.
# However, it fails too often to be in the intermittent list
@@ -16,4 +15,4 @@
# Following tests fail if all AWT test are executed in a batch
org/apache/harmony/awt/wtk/ShutdownWatchdogTest.java
-java/awt/event/ContainerEventTest.java
\ No newline at end of file
+java/awt/event/ContainerEventTest.java
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp Fri Aug 22 00:15:00 2008
@@ -80,12 +80,12 @@
bool Font::canDisplay(ufshort c)
{
- return NULL;
+ return 0;
}
ufshort Font::getUnicodeByIndex(ufshort ind)
{
- return NULL;
+ return 0;
}
//unicode = 0 - default glyph
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/unix/makefile?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/gl/unix/makefile Fri Aug 22 00:15:00 2008
@@ -15,9 +15,11 @@
include $(HY_HDK)/build/make/defines.mk
-PNG_DIR=$(HY_HDK)/../depends/libs/build/png
+# TODO: Fix the warnings see HARMONY-5885
+WARNFLAGS :=
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include -I$(PNG_DIR) -I/usr/X11R6/include -I/usr/include -Iinclude
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include \
+ -I/usr/X11R6/include -I/usr/include -Iinclude
BUILDFILES = \
$(SHAREDSUB)/blitter.o \
@@ -28,8 +30,9 @@
gl.o \
XBlitter.o \
XGraphics2D.o \
- LockingKeys.o \
- libpng.a
+ LockingKeys.o
+
+OSLIBS += -lpng
ifneq ($(HY_ZIP_API),true)
MDLLIBFILES += $(LIBPATH)libhyzip.a
@@ -45,6 +48,3 @@
EXPNAME=HYGL_0.1
include $(HY_HDK)/build/make/rules.mk
-
-libpng.a: $(PNG_DIR)/libpng.$(HY_PLATFORM)
- cp $< $@
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/jpegdecoder/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/jpegdecoder/unix/makefile?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/jpegdecoder/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/jpegdecoder/unix/makefile Fri Aug 22 00:15:00 2008
@@ -15,13 +15,11 @@
include $(HY_HDK)/build/make/defines.mk
-JPEG_DIR=$(HY_HDK)/../depends/libs/build/jpeg/
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include -I$(JPEG_DIR)
+BUILDFILES = $(SHAREDSUB)JpegDecoder.o
-BUILDFILES = \
- $(SHAREDSUB)JpegDecoder.o \
- libjpeg.a
+OSLIBS += -ljpeg
ifneq ($(HY_ZIP_API),true)
MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
@@ -33,14 +31,4 @@
DLLNAME=../libjpegdecoder$(HY_SHLIB_SUFFIX)
EXPNAME=HYJPEGDECODER_0.1
-CLEANFILES=jconfig.h
-
include $(HY_HDK)/build/make/rules.mk
-
-$(SHAREDSUB)JpegDecoder.o: jconfig.h
-
-jconfig.h: $(JPEG_DIR)jconfig.lnx
- cp $< $@
-
-libjpeg.a: $(JPEG_DIR)libjpeg.$(HY_PLATFORM)
- cp $< $@
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/NativeCMM.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/NativeCMM.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/NativeCMM.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/NativeCMM.c Fri Aug 22 00:15:00 2008
@@ -21,6 +21,7 @@
*/
#include "NativeCMM.h"
+#include <string.h>
static LCMSBOOL cmsInitialized = FALSE;
static char *errMsg = NULL;
@@ -28,10 +29,10 @@
int gl_cmsErrorHandler(int errorCode, const char *msg) {
if(errorCode == LCMS_ERRC_ABORTED) {
// Throw exception later, after returning control from cmm
-#ifndef ZOS
- errMsg = _strdup(msg);
-#else
+#if defined(ZOS) || defined(LINUX)
errMsg = strdup(msg);
+#else
+ errMsg = _strdup(msg);
#endif
}
@@ -57,7 +58,7 @@
cmsInitialized = TRUE;
}
- hProfile = cmmOpenProfile(byteData, dataSize);
+ hProfile = cmmOpenProfile((LPBYTE)byteData, dataSize);
(*env)->ReleaseByteArrayElements (env, data, byteData, 0);
@@ -115,7 +116,7 @@
unsigned profileSize = (unsigned) (*env)->GetArrayLength (env, data);
jbyte *byteData = (*env)->GetByteArrayElements(env, data, 0);
- cmmGetProfile(hProfile, byteData, profileSize);
+ cmmGetProfile(hProfile, (LPBYTE)byteData, profileSize);
(*env)->ReleaseByteArrayElements (env, data, byteData, 0);
}
@@ -136,13 +137,13 @@
if(ts == HEADER_TAG_ID) {
- if(!cmmGetProfileHeader(hProfile, byteData, dataSize)) {
+ if(!cmmGetProfileHeader(hProfile, (LPBYTE)byteData, dataSize)) {
newCMMException(env, errMsg); // Throw java exception if error occured
free(errMsg);
errMsg = NULL;
}
} else {
- if(!cmmGetProfileElement(hProfile, ts, byteData, &dataSize)) {
+ if(!cmmGetProfileElement(hProfile, ts, (LPBYTE)byteData, &dataSize)) {
newCMMException(env, errMsg); // Throw java exception if error occured
free(errMsg);
errMsg = NULL;
@@ -194,7 +195,7 @@
if(dataSize != sizeof(icHeader))
newCMMException(env, "Invalid size of the data"); // Throw java exception
- if(!cmmSetProfileHeader(hProfile, byteData))
+ if(!cmmSetProfileHeader(hProfile, (LPBYTE)byteData))
newCMMException(env, "Invalid header data"); // Throw java exception if error occured
} else {
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/cmmxforms.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/cmmxforms.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/cmmxforms.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/shared/cmmxforms.c Fri Aug 22 00:15:00 2008
@@ -75,8 +75,9 @@
}
}
-int cmmMultiprofileSampler(WORD In[], WORD Out[], cmsHTRANSFORM* Transforms) {
+int cmmMultiprofileSampler(WORD In[], WORD Out[], LPVOID Cargo) {
int i;
+ cmsHTRANSFORM* Transforms = (cmsHTRANSFORM*)Cargo;
// Need to go from In to Out at least once
cmsDoTransform(Transforms[0], In, Out, 1);
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/unix/makefile?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/lcmm/unix/makefile Fri Aug 22 00:15:00 2008
@@ -15,17 +15,16 @@
include $(HY_HDK)/build/make/defines.mk
-LCMS_DIR=$(HY_HDK)/../depends/libs/build/lcms
-
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include -I$(LCMS_DIR)
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)/include $(LCMS_INCLUDES)
BUILDFILES = \
$(SHAREDSUB)/cmmerror.o \
$(SHAREDSUB)/cmmio.o \
$(SHAREDSUB)/cmmxforms.o \
$(SHAREDSUB)/NativeCMM.o \
- $(SHAREDSUB)/NativeImageFormat.o \
- liblcms.a
+ $(SHAREDSUB)/NativeImageFormat.o
+
+OSLIBS += -llcms
ifneq ($(HY_ZIP_API),true)
MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
@@ -38,6 +37,3 @@
EXPNAME=HYLCMM_0.1
include $(HY_HDK)/build/make/rules.mk
-
-liblcms.a: $(LCMS_DIR)/liblcms.$(HY_PLATFORM)
- cp $< $@
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/linuxfont/unix/LinuxNativeFont.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/linuxfont/unix/LinuxNativeFont.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/linuxfont/unix/LinuxNativeFont.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/linuxfont/unix/LinuxNativeFont.c Fri Aug 22 00:15:00 2008
@@ -126,10 +126,10 @@
printf (" %s", family);
#endif /* DEBUG */
- len = (strlen(family)+1);
+ len = (strlen((char *)family)+1);
famList[j] = (char*)malloc(sizeof(char) * len);
- strncpy(famList[j], family, len);
+ strncpy(famList[j], (char *)family, len);
} else {
/*
* TODO
@@ -189,7 +189,7 @@
}
char *path = (char *)(*env)->GetStringUTFChars(env, fName, 0);
- fontAdded = FcConfigAppFontAddFile(config, path);
+ fontAdded = FcConfigAppFontAddFile(config, (unsigned char*)path);
unsigned short *familyName = 0;
@@ -248,13 +248,13 @@
if (fid == 0) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
dpy = (Display *)(long)(*env)->GetLongField(env, linuxFont, fid);
if (dpy == NULL){
throwNPException(env, "Cannot connect to XServer");
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
if (jStyle & FONT_BOLD) {
@@ -281,7 +281,7 @@
if (fid == 0) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
scr = (*env)->GetIntField(env, linuxFont, fid);
@@ -299,7 +299,7 @@
(*env)->ReleaseStringUTFChars(env, jName, name);
}
if(faceStyle){
- (*env)->ReleaseStringUTFChars(env, jFaceStyle, faceStyle);
+ (*env)->ReleaseStringUTFChars(env, jFaceStyle, (char *)faceStyle);
}
XftPatternDestroy (pattern);
throwNPException(env, "Error during adding family name to XFTPattern structure");
@@ -312,7 +312,7 @@
if (faceStyle && !XftPatternAddString (pattern, XFT_STYLE, faceStyle)){
if(faceStyle){
- (*env)->ReleaseStringUTFChars(env, jFaceStyle, faceStyle);
+ (*env)->ReleaseStringUTFChars(env, jFaceStyle, (char *)faceStyle);
}
XftPatternDestroy (pattern);
throwNPException(env, "Error during adding style name to XFTPattern structure");
@@ -321,7 +321,7 @@
/* We do not need faceStyle any more */
if(faceStyle){
XftPatternDestroy (pattern);
- (*env)->ReleaseStringUTFChars(env, jFaceStyle, faceStyle);
+ (*env)->ReleaseStringUTFChars(env, jFaceStyle, (char *)faceStyle);
}
if (!XftPatternAddInteger(pattern, XFT_SLANT, slant)){
@@ -391,14 +391,14 @@
if (!matchPattern){
XftPatternDestroy (matchPattern);
- return (long)NULL;
+ return (jlong)(IDATA)NULL;
}
xftFnt = XftFontOpenPattern (dpy, matchPattern);
if (!xftFnt){
XftPatternDestroy (matchPattern);
- return (long)NULL;
+ return (jlong)(IDATA)NULL;
}
/* defining font type */
@@ -414,7 +414,7 @@
if (font_type == FONT_TYPE_UNDEF){
XftFontClose (dpy, xftFnt);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
/* Set Font type in LinuxFont object (upcall) */
@@ -426,7 +426,7 @@
#endif // DEBUG
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
(*env)->CallVoidMethod(env, linuxFont, mid, font_type);
@@ -437,10 +437,10 @@
#endif // DEBUG
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
- return (long)xftFnt;
+ return (jlong)(IDATA)xftFnt;
}
/*
@@ -484,13 +484,13 @@
if (fid == 0) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
dpy = (Display *)(long)(*env)->GetLongField(env, linuxFont, fid);
if (dpy == NULL){
throwNPException(env, "Cannot connect to XServer");
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
xlfd = (*env)->GetStringUTFChars(env, jXLFD, &iscopy);
@@ -505,7 +505,7 @@
if (fid == 0) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
scr = (*env)->GetIntField(env, linuxFont, fid);
@@ -517,7 +517,7 @@
if (n == 0){
free(buffer);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
/* Xft part */
@@ -589,7 +589,7 @@
if (font_type == FONT_TYPE_UNDEF){
XftFontClose (dpy, xftFnt);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
/* Set Font type in LinuxFont object (upcall) */
@@ -601,7 +601,7 @@
#endif // DEBUG
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
(*env)->CallVoidMethod(env, linuxFont, mid, font_type);
@@ -612,7 +612,7 @@
#endif // DEBUG
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
return (long)xftFnt;
@@ -937,14 +937,14 @@
fontStyle |= FONT_ITALIC;
}
- len = snprintf(font, BUF_SIZE, fstr, family, style, fontStyle);
+ len = snprintf((char *)font, BUF_SIZE, fstr, family, style, fontStyle);
if (len < 0){
len = BUF_SIZE;
}
fontList[j] = (char*)malloc(sizeof(char) * (len+1));
- strncpy(fontList[j], font, len);
+ strncpy(fontList[j], (char *)font, len);
fontList[j][len] = 0;
}
XftFontSetDestroy (fs);
@@ -966,7 +966,7 @@
free(fontList);
throwNPException(env, "Not enough memory to create families list");
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
for (i = 0;i < numFonts;i++){
@@ -1347,7 +1347,7 @@
FcStrSetDestroy (subdirs);
FcStrListDone (list);
- (*env)->ReleaseStringUTFChars(env, fName, dirName);
+ (*env)->ReleaseStringUTFChars(env, fName, (char *)dirName);
return result;
}
@@ -1387,7 +1387,7 @@
XftUnlockFace(font);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
error = FT_Get_Glyph( face->glyph, &glyph );
@@ -1396,7 +1396,7 @@
// throwNPException(env, "NativeInitGlyphBitmap 1 : FreeType error");
XftUnlockFace(font);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
// convert to a bitmap (default render mode + destroy old)
if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) {
@@ -1406,7 +1406,7 @@
// glyph unchanged
FT_Done_Glyph( glyph );
XftUnlockFace(font);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
}
@@ -1633,7 +1633,7 @@
throwNPException(env, "getGlyphOutline : FreeType error");
XftUnlockFace(font);
- return (jlong)NULL;
+ return (jlong)(IDATA)NULL;
}
if ((face->glyph->format & ft_glyph_format_outline) != 0){
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/test/impl/boot/java/awt/image/RasterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/test/impl/boot/java/awt/image/RasterTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/test/impl/boot/java/awt/image/RasterTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/test/impl/boot/java/awt/image/RasterTest.java Fri Aug 22 00:15:00 2008
@@ -108,7 +108,7 @@
// Regression test for HARMONY-2875
try {
Raster.createRaster(new BandedSampleModel(1, 2, 3, 4),
- new DataBufferByte(new byte[191], 5),
+ new DataBufferByte(new byte[191], 6),
new Point(new Point(28, 43))).getPixels(6,
Integer.MAX_VALUE, 1, 0, new int[] {});
fail("ArrayIndexOutOfBoundsException should be thrown"); //$NON-NLS-1$
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/build.xml Fri Aug 22 00:15:00 2008
@@ -214,6 +214,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<jvmarg value="-Xbootclasspath/a:${hy.beans.bin.internal}${path.separator}../../${junit.jar}"/>
@@ -251,6 +255,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ArrayPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ArrayPersistenceDelegate.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ArrayPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ArrayPersistenceDelegate.java Fri Aug 22 00:15:00 2008
@@ -71,25 +71,23 @@
@Override
protected boolean mutatesTo(Object oldInstance, Object newInstance) {
- assert oldInstance != null && oldInstance.getClass().isArray() : oldInstance;
-
- if (newInstance != null) {
- Class<? extends Object> newCl = newInstance.getClass();
-
- if (!newCl.isArray()) {
- return false;
- }
- // both are arrays
- int l1 = Array.getLength(oldInstance);
- int l2 = Array.getLength(newInstance);
- Class<?> cType1 = oldInstance.getClass().getComponentType();
- Class<?> cType2 = newCl.getComponentType();
-
- if (l1 == l2 && cType1.equals(cType2)) {
- return true;
- }
+ if(null == oldInstance || null == newInstance){
return false;
}
+
+ if(!oldInstance.getClass().isArray() || !newInstance.getClass().isArray()){
+ return false;
+ }
+
+ // both are array
+ int l1 = Array.getLength(oldInstance);
+ int l2 = Array.getLength(newInstance);
+ Class<?> cType1 = oldInstance.getClass().getComponentType();
+ Class<?> cType2 = newInstance.getClass().getComponentType();
+ if(l1 == l2 && cType1.equals(cType2)){
+ return true;
+ }
+
return false;
}
}
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?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- 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 Aug 22 00:15:00 2008
@@ -105,8 +105,7 @@
} catch (RuntimeException e) {
throw e;
} catch (Throwable t) {
- System.out
- .println(t.getClass() + ": " + t.getMessage()); //$NON-NLS-1$
+ throw new RuntimeException(t);
}
} else {
// in order to be compatible with RI
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java Fri Aug 22 00:15:00 2008
@@ -35,14 +35,15 @@
// check for consistency
assert oldInstance instanceof Proxy : oldInstance;
assert newInstance instanceof Proxy : newInstance;
- assert newInstance == oldInstance;
super.initialize(type, oldInstance, newInstance, out);
}
@Override
protected boolean mutatesTo(Object oldInstance, Object newInstance) {
- assert oldInstance instanceof Proxy : oldInstance;
- assert oldInstance == newInstance;
- return super.mutatesTo(oldInstance, newInstance);
+ if((oldInstance instanceof Proxy) && (newInstance instanceof Proxy)){
+ return super.mutatesTo(oldInstance, newInstance);
+ }
+
+ return false;
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/StandardBeanInfo.java Fri Aug 22 00:15:00 2008
@@ -95,7 +95,6 @@
StandardBeanInfo(Class<?> beanClass, BeanInfo explicitBeanInfo, Class<?> stopClass)
throws IntrospectionException {
- assert (beanClass != null);
this.beanClass = beanClass;
/*--------------------------------------------------------------------------------------
* There are 3 aspects of BeanInfo that must be supplied:
@@ -525,7 +524,7 @@
// Loop over the methods found, looking for public non-static methods
for (int i = 0; i < basicMethods.length; i++) {
int modifiers = basicMethods[i].getModifiers();
- if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
+ if (Modifier.isPublic(modifiers)) {
// Allocate a MethodDescriptor for this method
MethodDescriptor theDescriptor = new MethodDescriptor(
basicMethods[i]);
@@ -558,10 +557,32 @@
throws IntrospectionException {
// Get descriptors for the public methods
- MethodDescriptor[] theMethods = introspectMethods();
+ MethodDescriptor[] methodDescriptors = introspectMethods();
+ if (methodDescriptors == null) {
+ return null;
+ }
- if (theMethods == null)
+ ArrayList<MethodDescriptor> methodList = new ArrayList<MethodDescriptor>();
+
+ // Loop over the methods found, looking for public non-static methods
+ for (int index = 0; index < methodDescriptors.length; index++) {
+ int modifiers = methodDescriptors[index].getMethod().getModifiers();
+ if (!Modifier.isStatic(modifiers)) {
+ methodList.add(methodDescriptors[index]);
+ }
+ }
+
+ // Get the list of public non-static methods into an array
+ int methodCount = methodList.size();
+ MethodDescriptor[] theMethods = null;
+ if (methodCount > 0) {
+ theMethods = new MethodDescriptor[methodCount];
+ theMethods = methodList.toArray(theMethods);
+ }
+
+ if (theMethods == null) {
return null;
+ }
HashMap<String, HashMap> propertyTable = new HashMap<String, HashMap>(
theMethods.length);
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?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- 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 Aug 22 00:15:00 2008
@@ -133,6 +133,33 @@
} else {
throw new NoSuchMethodException(this.toString());
}
+ } else if (theMethodName.equals("newArray")) {//$NON-NLS-1$
+ // create a new array instance without length attribute
+ int length = theArguments.length;
+ Class clazz = (Class) theTarget;
+
+ // check the element types of array
+ for (int i = 0; i < length; i++) {
+ boolean isNull = theArguments[i] == null;
+ boolean isPrimitiveWrapper = isNull ? false
+ : isPrimitiveWrapper(theArguments[i].getClass(),
+ clazz);
+ boolean isAssignable = isNull ? false : clazz
+ .isAssignableFrom(theArguments[i].getClass());
+ if (!isNull && !isPrimitiveWrapper && !isAssignable) {
+ throw new IllegalArgumentException(Messages
+ .getString("beans.63")); //$NON-NLS-1$
+ }
+ }
+ result = Array.newInstance(clazz, length);
+ if (clazz.isPrimitive()) {
+ // Copy element according to primitive types
+ arrayCopy(clazz, theArguments, result, length);
+ } else {
+ // Copy element of Objects
+ System.arraycopy(theArguments, 0, result, 0, length);
+ }
+ return result;
} else if (theTarget instanceof Class) {
Method method = null;
boolean found = false;
@@ -197,6 +224,50 @@
}
return result;
}
+
+ private void arrayCopy(Class type, Object[] src, Object dest, int length) {
+ if (type == boolean.class) {
+ boolean[] destination = (boolean[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Boolean) src[i]).booleanValue();
+ }
+ } else if (type == short.class) {
+ short[] destination = (short[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Short) src[i]).shortValue();
+ }
+ } else if (type == byte.class) {
+ byte[] destination = (byte[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Byte) src[i]).byteValue();
+ }
+ } else if (type == char.class) {
+ char[] destination = (char[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Character) src[i]).charValue();
+ }
+ } else if (type == int.class) {
+ int[] destination = (int[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Integer) src[i]).intValue();
+ }
+ } else if (type == long.class) {
+ long[] destination = (long[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Long) src[i]).longValue();
+ }
+ } else if (type == float.class) {
+ float[] destination = (float[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Float) src[i]).floatValue();
+ }
+ } else if (type == double.class) {
+ double[] destination = (double[]) dest;
+ for (int i = 0; i < length; i++) {
+ destination[i] = ((Double) src[i]).doubleValue();
+ }
+ }
+ }
private Method findArrayMethod(String theMethodName, Object[] theArguments) throws NoSuchMethodException {
// the code below reproduces exact RI exception throwing behavior
@@ -297,8 +368,23 @@
for (int i = 1; i < foundMethodsArr.length; i++) {
int difference = comparator.compare(chosenOne, foundMethodsArr[i]);
//if 2 methods have same relevance, throw exception
- if(difference == 0){
- throw new NoSuchMethodException("Cannot decide which method to call: "+methodName); //$NON-NLS-1$
+ if (difference == 0) {
+ // if 2 methods have the same signature, check their return type
+ Class<?> oneReturnType = chosenOne.getReturnType();
+ Class<?> foundMethodReturnType = foundMethodsArr[i]
+ .getReturnType();
+ if (oneReturnType.equals(foundMethodReturnType)) {
+ // if 2 methods have the same signature and return type,
+ // throw NoSuchMethodException
+ throw new NoSuchMethodException(Messages.getString(
+ "beans.62", methodName)); //$NON-NLS-1$
+ }
+
+ if (oneReturnType.isAssignableFrom(foundMethodReturnType)) {
+ // if chosenOne is super class or interface of
+ // foundMethodReturnType, set chosenOne to foundMethodArr[i]
+ chosenOne = foundMethodsArr[i];
+ }
}
if(difference > 0){
chosenOne = foundMethodsArr[i];
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java Fri Aug 22 00:15:00 2008
@@ -197,19 +197,29 @@
}
}
- @SuppressWarnings("nls")
private void startArrayElem(Attributes attributes) {
Elem elem = new Elem();
elem.isExpression = true;
- elem.id = attributes.getValue("id");
+ elem.id = attributes.getValue("id"); //$NON-NLS-1$
try {
// find component class
- Class<?> compClass = classForName(attributes.getValue("class"));
- // find length
- int length = Integer.parseInt(attributes.getValue("length"));
- // execute, new array instance
- elem.result = Array.newInstance(compClass, length);
- elem.isExecuted = true;
+ Class<?> compClass = classForName(attributes.getValue("class")); //$NON-NLS-1$
+ String lengthValue = attributes.getValue("length"); //$NON-NLS-1$
+ if (lengthValue != null) {
+ // find length
+ int length = Integer
+ .parseInt(attributes.getValue("length")); //$NON-NLS-1$
+ // execute, new array instance
+ elem.result = Array.newInstance(compClass, length);
+ elem.isExecuted = true;
+ } else {
+ // create array without length attribute,
+ // delay the excution to the end,
+ // get array length from sub element
+ elem.target = compClass;
+ elem.methodName = "newArray"; //$NON-NLS-1$
+ elem.isExecuted = false;
+ }
} catch (Exception e) {
listener.exceptionThrown(e);
}
@@ -526,7 +536,7 @@
* an input stream of xml
*/
public XMLDecoder(InputStream inputStream) {
- this(inputStream, null, null);
+ this(inputStream, null, null, null);
}
/**
@@ -538,7 +548,7 @@
* the owner of this decoder
*/
public XMLDecoder(InputStream inputStream, Object owner) {
- this(inputStream, owner, null);
+ this(inputStream, owner, null, null);
}
/**
@@ -553,6 +563,11 @@
*/
public XMLDecoder(InputStream inputStream, Object owner,
ExceptionListener listener) {
+ this(inputStream, owner, listener, null);
+ }
+
+ public XMLDecoder(InputStream inputStream, Object owner,
+ ExceptionListener listener, ClassLoader cl) {
if (inputStream == null) {
throw new IllegalArgumentException("Input stream cannot be null"); //$NON-NLS-1$
}
@@ -560,7 +575,8 @@
this.owner = owner;
this.listener = (listener == null) ? new DefaultExceptionListener()
: listener;
-
+ defaultClassLoader = cl;
+
try {
SAXParserFactory.newInstance().newSAXParser().parse(inputStream,
new SAXHandler());
@@ -569,12 +585,6 @@
}
}
- public XMLDecoder(InputStream inputStream, Object owner,
- ExceptionListener listener, ClassLoader cl) {
- this(inputStream, owner, listener);
- defaultClassLoader = cl;
- }
-
/**
* Close the input stream of xml data.
*/
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties Fri Aug 22 00:15:00 2008
@@ -114,3 +114,4 @@
beans.60=Indexed write method must take an int as its first argument
beans.61=Indexed write method is not compatible with indexed read method
beans.62=Cannot decide which method to call to match {0}
+beans.63=The type of element is mismatch with the type of array
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java Fri Aug 22 00:15:00 2008
@@ -37,13 +37,90 @@
pd = new ArrayPersistenceDelegate();
}
+ @Override
+ protected void tearDown() throws Exception {
+ pd = null;
+ super.tearDown();
+ }
+
public void testMutates() {
assertFalse(pd.mutatesTo(new int[] { 1 }, null));
assertFalse(pd.mutatesTo(null, null));
assertFalse(pd.mutatesTo(new int[1], new int[2]));
assertTrue(pd.mutatesTo(new int[] { 1, 3 }, new int[] { 1, 2 }));
}
-
+
+ /*
+ * test mutates with wrapper array
+ */
+ public void test_MutatesTo_WrapperArray() {
+ // Regression for Harmony-4022
+ // one wrapper array and null
+ assertFalse(pd.mutatesTo(new Integer[] { 1, 2, 3 }, null));
+ assertFalse(pd.mutatesTo(new Boolean[] { true, false }, null));
+ assertFalse(pd.mutatesTo(new Short[] { 1, 2 }, null));
+ assertFalse(pd.mutatesTo(new Long[] { 23000000094382l, 23000000094383l }, null));
+ assertFalse(pd.mutatesTo(new Character[] { 'a', 'b', 'c'}, null));
+ assertFalse(pd.mutatesTo(new Float[] { 0.1f, 0.2f }, null));
+ assertFalse(pd.mutatesTo(new Double[] { 0.1, 0.2 }, null));
+
+ // two wrapper arries with the same component type but different length
+ assertFalse(pd.mutatesTo(new Integer[] { 1, 2, 3 }, new Integer[] { 1, 2}));
+ assertFalse(pd.mutatesTo(new Boolean[] { true, false }, new Boolean[] { true }));
+ assertFalse(pd.mutatesTo(new Short[] { 1, 2 }, new Short[] { 1, 2, 3}));
+ assertFalse(pd.mutatesTo(new Long[] { 23000000094382l, 23000000094383l }, new Long[] { 23000000094382l}));
+ assertFalse(pd.mutatesTo(new Character[] { 'a', 'b', 'c'}, new Character[] {}));
+ assertFalse(pd.mutatesTo(new Float[] { 0.1f, 0.2f }, new Float[] { 0.1f, 0.2f, 0.3f}));
+ assertFalse(pd.mutatesTo(new Double[] { 0.1, 0.2 }, new Double[] { 0.1 }));
+
+ // two wrapper arries with the same length but different component types
+ assertFalse(pd.mutatesTo(new Integer[] { 1, 2, 3 }, new Boolean[] { true, false }));
+ assertFalse(pd.mutatesTo(new Boolean[] { true, false }, new Short[] { 1, 2 }));
+ assertFalse(pd.mutatesTo(new Short[] { 1, 2 }, new Long[] { 23000000094382l, 23000000094383l }));
+ assertFalse(pd.mutatesTo(new Long[] { 23000000094382l, 23000000094383l }, new Character[] { 'a', 'b', 'c'}));
+ assertFalse(pd.mutatesTo(new Character[] { 'a', 'b', 'c'}, new Float[] { 0.1f, 0.2f }));
+ assertFalse(pd.mutatesTo(new Float[] { 0.1f, 0.2f }, new Double[] { 0.1 }));
+
+ // two wrapper arries with the same length and component type but different internal values
+ assertTrue(pd.mutatesTo(new Integer[] { 1, 2, 3 }, new Integer[] { 5, 6, 7 }));
+ assertTrue(pd.mutatesTo(new Boolean[] { true, false, false}, new Boolean[] { false, true, true}));
+ assertTrue(pd.mutatesTo(new Short[] { 1, 2 }, new Short[] { 4, 5 }));
+ assertTrue(pd.mutatesTo(new Long[] { 23000000094382l, 23000000094383l }, new Long[] { 534300002l, 23020094383l }));
+ assertTrue(pd.mutatesTo(new Character[] { 'a', 'b', 'c'}, new Character[] { 'd', 'e', 'f'}));
+ assertTrue(pd.mutatesTo(new Float[] { 0.1f, 0.2f }, new Float[] { 0.4f, 0.6f }));
+ assertTrue(pd.mutatesTo(new Double[] { 0.1, 0.2 }, new Double[] { 0.3, 0.343 }));
+ }
+
+ /*
+ * test mutatesTo with object array
+ */
+ public void test_MutatesTo_ObjectArray(){
+ // Regression for Harmony-4022
+ // one object array and null
+ assertFalse(pd.mutatesTo(new MockAObject[] { new MockAObject() }, null));
+ assertFalse(pd.mutatesTo(new MockBObject[] { new MockBObject() }, null));
+ assertFalse(pd.mutatesTo(new MockObject[] { new MockAObject(), new MockBObject()}, null));
+
+ // two wrapper arries with the same component type but different length
+ assertFalse(pd.mutatesTo(new MockObject[1], new MockObject[2]));
+ assertFalse(pd.mutatesTo(new MockAObject[1], new MockAObject[2]));
+ assertFalse(pd.mutatesTo(new MockBObject[1], new MockBObject[2]));
+
+ // two object array with the same length but different component types
+ assertFalse(pd.mutatesTo(new MockAObject[] { new MockAObject() }, new MockBObject[] { new MockBObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockObject()}, new MockAObject[] { new MockAObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockAObject()}, new MockAObject[] { new MockAObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockBObject()}, new MockAObject[] { new MockAObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockObject()}, new MockBObject[] { new MockBObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockBObject()}, new MockBObject[] { new MockBObject() }));
+ assertFalse(pd.mutatesTo(new MockObject[] {new MockAObject()}, new MockBObject[] { new MockBObject() }));
+
+ // two object array with the same length and component type but differnt internal values
+ assertTrue(pd.mutatesTo(new MockObject[] { new MockAObject() }, new MockObject[] { new MockBObject() }));
+ assertTrue(pd.mutatesTo(new MockAObject[] { new MockAObject(1) }, new MockAObject[] { new MockAObject(2) }));
+ assertTrue(pd.mutatesTo(new MockBObject[] { new MockBObject(1) }, new MockBObject[] { new MockBObject(2) }));
+ }
+
public void testInitialize() {
// TBD
}
@@ -58,5 +135,35 @@
assertSame(Integer.TYPE, exp.getArguments()[0]);
assertEquals(new Integer(3), exp.getArguments()[1]);
}
+
+ public class MockObject {
+
+ }
+
+ public class MockAObject extends MockObject {
+ String name = "A Object";
+ int id = 0x01;
+
+ public MockAObject() {
+
+ }
+
+ public MockAObject(int idValue){
+ id = idValue;
+ }
+ }
+
+ public class MockBObject extends MockObject {
+ String name = "B Object";
+ int id = 0x02;
+
+ public MockBObject(){
+
+ }
+
+ public MockBObject(int idValue){
+ id = idValue;
+ }
+ }
}
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?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- 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 Aug 22 00:15:00 2008
@@ -220,6 +220,21 @@
assertEquals("setSomeValue", getMethodName());
}
+
+ /**
+ * fileSampleEvent scenario by throwing RuntimeException
+ */
+ public void test_Create_WithThrowRuntimeException() {
+ // Regression for Harmony-2434
+ InvocationObject invocationObject = new InvocationObject();
+ SampleListener listener = EventHandler.create(SampleListener.class,invocationObject, "throwRuntimeException");
+ try {
+ listener.fireSampleEvent(new SampleEvent("bean"));
+ fail("Expected RuntimeException thrown");
+ } catch (RuntimeException re) {
+ // Expected
+ }
+ }
/**
*
@@ -1256,5 +1271,9 @@
logMethodCall(this, "setSomeValue", new Object[] { new Integer(
intValue) });
}
+
+ public void throwRuntimeException() {
+ throw new RuntimeException("forced throw RuntimeException");
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java Fri Aug 22 00:15:00 2008
@@ -450,7 +450,65 @@
} catch (IntrospectionException e) {
}
}
+
+ /*
+ * Introspect static methods
+ */
+ public void testGetBeanInfo_StaticMethods() throws Exception {
+ BeanInfo beanInfo = Introspector.getBeanInfo(StaticClazz.class);
+ PropertyDescriptor[] propertyDescriptors = beanInfo
+ .getPropertyDescriptors();
+ assertEquals(1, propertyDescriptors.length);
+ assertTrue(contains("class", Class.class, propertyDescriptors));
+ MethodDescriptor[] methodDescriptors = beanInfo.getMethodDescriptors();
+ assertTrue(contains("getStaticMethod", methodDescriptors));
+ assertTrue(contains("setStaticMethod", methodDescriptors));
+
+ beanInfo = Introspector.getBeanInfo(StaticClazzWithProperty.class);
+ propertyDescriptors = beanInfo.getPropertyDescriptors();
+ assertEquals(1, propertyDescriptors.length);
+ methodDescriptors = beanInfo.getMethodDescriptors();
+ assertTrue(contains("getStaticName", methodDescriptors));
+ assertTrue(contains("setStaticName", methodDescriptors));
+ }
+
+ public static class StaticClazz {
+
+ /*
+ * public static get method
+ */
+ public static String getStaticMethod() {
+ return "static class";
+ }
+
+ /*
+ * public static set method
+ */
+ public static void setStaticMethod(String content) {
+ // do nothing
+ }
+ }
+
+ public static class StaticClazzWithProperty {
+
+ private static String staticName = "Static Clazz";
+
+ /*
+ * public static get method
+ */
+ public static String getStaticName() {
+ return staticName;
+ }
+
+ /*
+ * public static set method
+ */
+ public static void setStaticName(String name) {
+ staticName = name;
+ }
+ }
+
public void testGetBeanInfoClassClass_StopNull()
throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(MockFoo.class);// , null);
Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java Fri Aug 22 00:15:00 2008
@@ -28,6 +28,19 @@
import junit.textui.TestRunner;
import org.apache.harmony.beans.tests.support.SampleException;
+import org.apache.harmony.beans.tests.support.TInspectorCluster;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.Ancestor;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.BooleanInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.CharacterInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.DoubleInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.FloatInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.IntegerInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.LongInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.ObjectInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.ObjectListInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.Offspring;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.ShortInspector;
+import org.apache.harmony.beans.tests.support.TInspectorCluster.StringInspector;
/**
* Test the class java.beans.Statement.
@@ -871,6 +884,139 @@
t.execute();
MockObject.assertCalled("overloadedmethodB", arguments);
}
+
+ /*
+ * Test for special case of the same signature but differnt return type
+ */
+ public void testExecute_SameSignatureDifferentReturn() throws Exception {
+ // Regression for Harmony-5854
+ Object[] ancestorArguments = new Object[] { new Ancestor() {
+ } };
+ Object[] offspringArguments = new Object[] { new Offspring() {
+ } };
+ String methodName = "visit";
+ Statement statement = null;
+
+ statement = new Statement(new StringInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_STRING);
+
+ statement = new Statement(new StringInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_STRING);
+
+ statement = new Statement(new BooleanInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_BOOLEAN);
+
+ statement = new Statement(new BooleanInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_BOOLEAN);
+
+ statement = new Statement(new CharacterInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_CHARACTER);
+
+ statement = new Statement(new CharacterInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_CHARACTER);
+
+ statement = new Statement(new ShortInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_SHORT);
+
+ statement = new Statement(new ShortInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_SHORT);
+
+ statement = new Statement(new IntegerInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_INTEGER);
+
+ statement = new Statement(new IntegerInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_INTEGER);
+
+ statement = new Statement(new LongInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_LONG);
+
+ statement = new Statement(new LongInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_LONG);
+
+ statement = new Statement(new FloatInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_FLOAT);
+
+ statement = new Statement(new FloatInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_FLOAT);
+
+ statement = new Statement(new DoubleInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_DOUBLE);
+
+ statement = new Statement(new DoubleInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_DOUBLE);
+
+ statement = new Statement(new ObjectInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_OBJECT);
+
+ statement = new Statement(new ObjectInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_OBJECT);
+
+ statement = new Statement(new ObjectListInspector(), "visit",
+ ancestorArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, ancestorArguments,
+ TInspectorCluster.ANCESTOR_OBJECT_LIST);
+
+ statement = new Statement(new ObjectListInspector(), "visit",
+ offspringArguments);
+ statement.execute();
+ TInspectorCluster.assertMethodCalled(methodName, offspringArguments,
+ TInspectorCluster.OFFSPRING_OBJECT_LIST);
+ }
/*
* Super class of MockObject.
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?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- 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 Aug 22 00:15:00 2008
@@ -74,6 +74,58 @@
}
}
+
+ /*
+ * test XMLDecoder constructor with null inputStream argument
+ */
+ public void test_Constructor_NullInputStream() {
+ XMLDecoder xmlDecoder;
+ try {
+ xmlDecoder = new XMLDecoder(null);
+ fail("Expected IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ // Expected
+ }
+
+ try{
+ xmlDecoder = new XMLDecoder(null, null);
+ }catch(IllegalArgumentException iae){
+ // Expected
+ }
+
+ try{
+ xmlDecoder = new XMLDecoder(null, null, null);
+ }catch(IllegalArgumentException iae){
+ // Expected
+ }
+
+ try{
+ xmlDecoder = new XMLDecoder(null, null, null, null);
+ }catch(IllegalArgumentException iae){
+ // Expected
+ }
+
+ }
+
+ /*
+ * test XMLDecoder constructor
+ */
+ public void test_Constructor_Normal() throws Exception {
+ XMLDecoder xmlDecoder;
+ xmlDecoder = new XMLDecoder(new ByteArrayInputStream(xml123bytes));
+ assertEquals(null, xmlDecoder.getOwner());
+
+ final Vector<Exception> exceptions = new Vector<Exception>();
+ ExceptionListener el = new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ exceptions.addElement(e);
+ }
+ };
+
+ xmlDecoder = new XMLDecoder(new ByteArrayInputStream(xml123bytes), this, el);
+ assertEquals(el, xmlDecoder.getExceptionListener());
+ assertEquals(this, xmlDecoder.getOwner());
+ }
public void testConstructor_ClassLoader() {
XMLDecoder dec;
@@ -166,6 +218,89 @@
assertEquals(2, ints[1]);
assertEquals(3, ints[2]);
}
+
+ public void testReadObject_Array_WithoutLength() {
+ // Read array of primitive types without length attribute
+ XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
+ "/xml/Array_Primitive.xml"));
+ Object[] arrays = (Object[]) dec.readObject();
+
+ boolean[] booleanArray = (boolean[]) arrays[0];
+ assertTrue(booleanArray[0]);
+ assertFalse(booleanArray[1]);
+
+ short[] shortArray = (short[]) arrays[1];
+ assertEquals(1, shortArray[0]);
+ assertEquals(1, shortArray[1]);
+
+ byte[] byteArray = (byte[]) arrays[2];
+ assertEquals(2, byteArray[0]);
+ assertEquals(2, byteArray[1]);
+
+ char[] charArray = (char[]) arrays[3];
+ assertEquals('c', charArray[0]);
+ assertEquals('c', charArray[1]);
+
+ int[] intArray = (int[]) arrays[4];
+ assertEquals(4, intArray[0]);
+ assertEquals(4, intArray[1]);
+ assertEquals(4, intArray[2]);
+ assertEquals(4, intArray[3]);
+
+ long[] longArray = (long[]) arrays[5];
+ assertEquals(5l, longArray[0]);
+ assertEquals(5l, longArray[1]);
+ assertEquals(5l, longArray[2]);
+ assertEquals(5l, longArray[3]);
+ assertEquals(5l, longArray[4]);
+
+ float[] floatArray = (float[]) arrays[6];
+ assertEquals(6f, floatArray[0]);
+ assertEquals(6f, floatArray[1]);
+
+ double[] doubleArray = (double[]) arrays[7];
+ assertEquals(7d, doubleArray[0]);
+ assertEquals(7d, doubleArray[1]);
+
+ // Read array of Object types without length attribute
+ dec = new XMLDecoder(this.getClass().getResourceAsStream(
+ "/xml/Array_Object.xml"));
+ Object[] array = (Object[]) dec.readObject();
+
+ assertTrue((Boolean) array[0]);
+ assertEquals(new Short((short) 1), (Short) array[1]);
+ assertEquals(new Byte((byte) 2), (Byte) array[2]);
+ assertEquals(new Character('c'), (Character) array[3]);
+ assertEquals(new Integer(4), (Integer) array[4]);
+ assertEquals(new Long(5), (Long) array[5]);
+ assertEquals(new Float(6), (Float) array[6]);
+ assertEquals(new Double(7), (Double) array[7]);
+ assertEquals("string", (String) array[8]);
+
+ // Read wrapper element in array of primitive types
+ dec = new XMLDecoder(this.getClass().getResourceAsStream(
+ "/xml/Array_Wrapper.xml"));
+ int[] integers = (int[]) dec.readObject();
+ assertEquals(11, integers[0]);
+ assertEquals(22, integers[1]);
+ }
+
+ public void testReadObject_Array_Special() {
+ // Read array of Object types in special case without length attribute
+ XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
+ "/xml/Array_Null.xml"));
+ Object[] array = (Object[]) dec.readObject();
+ assertNull(array[0]);
+ assertNull(array[1]);
+ assertEquals("", (String) array[2]);
+
+ // Read array with wrong type, it should return null,
+ // and throw a java.lang.IllegalArgumentException
+ dec = new XMLDecoder(this.getClass().getResourceAsStream(
+ "/xml/Array_Illegal.xml"));
+ array = (Object[]) dec.readObject();
+ assertNull(array);
+ }
public void testReadObject_PropertyDependency() {
XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
Propchange: harmony/enhanced/classlib/branches/java6/modules/concurrent/
------------------------------------------------------------------------------
--- svn:externals (original)
+++ svn:externals Fri Aug 22 00:15:00 2008
@@ -1 +1 @@
-standard http://svn.apache.org/repos/asf/harmony/standard/classlib/trunk/modules/concurrent
+standard http://svn.apache.org/repos/asf/harmony/standard/classlib/branches/java5/modules/concurrent
Modified: harmony/enhanced/classlib/branches/java6/modules/concurrent/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/concurrent/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/concurrent/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/concurrent/build.xml Fri Aug 22 00:15:00 2008
@@ -168,6 +168,11 @@
showoutput="on"
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/crypto/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/crypto/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/crypto/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/crypto/build.xml Fri Aug 22 00:15:00 2008
@@ -323,6 +323,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<junit-elements />
Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/build.xml Fri Aug 22 00:15:00 2008
@@ -206,6 +206,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/shared/JpegEncoder.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/shared/JpegEncoder.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/shared/JpegEncoder.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/shared/JpegEncoder.c Fri Aug 22 00:15:00 2008
@@ -264,7 +264,7 @@
JNIEXPORT void JNICALL
Java_org_apache_harmony_x_imageio_plugins_jpeg_JPEGImageWriter_dispose(JNIEnv *env, jobject obj, jlong handle) {
- struct jpeg_compress_struct * cinfo = (struct jpeg_compress_struct *) handle;
+ struct jpeg_compress_struct * cinfo = (struct jpeg_compress_struct *) (IDATA)handle;
enc_client_data_ptr cdata = (enc_client_data_ptr) cinfo->client_data;
if (cdata->ios != NULL) {
@@ -307,7 +307,7 @@
*/
JNIEXPORT jlong JNICALL
Java_org_apache_harmony_x_imageio_plugins_jpeg_JPEGImageWriter_initCompressionObj(JNIEnv *env, jobject encoder) {
- return (jlong) ios_create_compress(env);
+ return (jlong) (IDATA)ios_create_compress(env);
}
/*
@@ -318,7 +318,7 @@
JNIEXPORT void JNICALL
Java_org_apache_harmony_x_imageio_plugins_jpeg_JPEGImageWriter_setIOS(JNIEnv *env, jobject encoder, jobject iosObj, jlong handle) {
- struct jpeg_compress_struct * cinfo = (struct jpeg_compress_struct *) handle;
+ struct jpeg_compress_struct * cinfo = (struct jpeg_compress_struct *) (IDATA)handle;
enc_client_data_ptr cdata = (enc_client_data_ptr) cinfo->client_data;
if (cdata->ios != NULL) {
@@ -365,13 +365,13 @@
}
- cinfo = (struct jpeg_compress_struct *) handle;
+ cinfo = (struct jpeg_compress_struct *) (IDATA)handle;
err_mgr = (enc_error_mgr_ptr) cinfo->err;
if (setjmp(err_mgr->jmp_buffer)) {
if (!(*env)->ExceptionOccurred(env)) {
char msg_buffer[JMSG_LENGTH_MAX];
- cinfo->err->format_message(cinfo, msg_buffer);
+ cinfo->err->format_message((j_common_ptr)cinfo, msg_buffer);
throwNewExceptionByName(env, "javax/imageio/IIOException",
msg_buffer);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/unix/makefile?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/jpegencoder/unix/makefile Fri Aug 22 00:15:00 2008
@@ -15,13 +15,11 @@
include $(HY_HDK)/build/make/defines.mk
-JPEG_DIR=$(HY_HDK)/../depends/libs/build/jpeg/
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include -I$(JPEG_DIR)
+BUILDFILES = $(SHAREDSUB)JpegEncoder.o
-BUILDFILES = \
- $(SHAREDSUB)JpegEncoder.o \
- libjpeg.a
+OSLIBS += -ljpeg
ifneq ($(HY_ZIP_API),true)
MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
@@ -33,15 +31,4 @@
DLLNAME=../libjpegencoder$(HY_SHLIB_SUFFIX)
EXPNAME=HYJPEGENCODER_0.1
-CLEANFILES=jconfig.h
-
include $(HY_HDK)/build/make/rules.mk
-
-$(SHAREDSUB)JpegEncoder.o: jconfig.h
-
-jconfig.h: $(JPEG_DIR)jconfig.lnx
- cp $< $@
-
-libjpeg.a: $(JPEG_DIR)libjpeg.$(HY_PLATFORM)
- cp $< $@
-
Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/shared/pngencoder.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/shared/pngencoder.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/shared/pngencoder.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/shared/pngencoder.c Fri Aug 22 00:15:00 2008
@@ -161,8 +161,10 @@
for (i = 0; i < paletteSize; i ++) {
//printf("n%u = %u\n", i, (tmpPalette[i] & 0xff000000));
- (pngPalette + i)->red = (png_byte) tmpPalette[i] & 0x00ff0000;
- (pngPalette + i)->green = (png_byte) tmpPalette[i] & 0x000000ff00;
+ (pngPalette + i)->red =
+ (png_byte) ((tmpPalette[i] & 0x00ff0000) >> 16);
+ (pngPalette + i)->green =
+ (png_byte) ((tmpPalette[i] & 0x0000ff00) >> 8);
(pngPalette + i)->blue = (png_byte) tmpPalette[i] & 0x000000ff;
//alpha[i] = 256 - (tmpPalette[i] & 0xff000000);
Modified: harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/imageio/src/main/native/pngencoder/unix/makefile Fri Aug 22 00:15:00 2008
@@ -15,13 +15,11 @@
include $(HY_HDK)/build/make/defines.mk
-PNG_DIR=$(HY_HDK)/../depends/libs/build/png/
+INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include
-INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include -I$(PNG_DIR)
+BUILDFILES = $(SHAREDSUB)pngencoder.o
-BUILDFILES = \
- $(SHAREDSUB)pngencoder.o \
- libpng.a
+OSLIBS += -lpng
ifneq ($(HY_ZIP_API),true)
MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
@@ -39,9 +37,4 @@
DLLNAME=../libpngencoder$(HY_SHLIB_SUFFIX)
EXPNAME=HYPNGENCODER_0.1
-CLEANFILES=jconfig.h
-
include $(HY_HDK)/build/make/rules.mk
-
-libpng.a: $(PNG_DIR)libpng.$(HY_PLATFORM)
- cp $< $@
Modified: harmony/enhanced/classlib/branches/java6/modules/instrument/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/instrument/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/instrument/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/instrument/build.xml Fri Aug 22 00:15:00 2008
@@ -190,6 +190,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<!-- Used by Support_Exec.execJava() -->
<jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
Modified: harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/inst_agt.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/inst_agt.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/inst_agt.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/inst_agt.c Fri Aug 22 00:15:00 2008
@@ -57,8 +57,8 @@
jbyteArray jname_bytes = (*jni_env)->NewByteArray(jni_env, name_len);
//construct java byteArray for old class data and class name
- (*jni_env)->SetByteArrayRegion(jni_env, jold_bytes, 0, class_data_len, (unsigned char *)class_data);
- (*jni_env)->SetByteArrayRegion(jni_env, jname_bytes, 0, name_len, (char *)name);
+ (*jni_env)->SetByteArrayRegion(jni_env, jold_bytes, 0, class_data_len, (jbyte *)class_data);
+ (*jni_env)->SetByteArrayRegion(jni_env, jname_bytes, 0, name_len, (jbyte *)name);
//invoke transform method
jnew_bytes = (jbyteArray)(*jni_env)->CallObjectMethod(jni_env, *(gdata->inst), transform_method, loader, jname_bytes, class_being_redefined, protection_domain, jold_bytes);
@@ -133,13 +133,13 @@
jbyteArray joptions=NULL, jclass_name;
if(class_name){
jclass_name = (*env)->NewByteArray(env, strlen(class_name));
- (*env)->SetByteArrayRegion(env, jclass_name, 0, strlen(class_name), class_name);
+ (*env)->SetByteArrayRegion(env, jclass_name, 0, strlen(class_name), (jbyte*)class_name);
}else{
goto DEALLOCATE;
}
if(agent_options){
joptions = (*env)->NewByteArray(env, strlen(agent_options));
- (*env)->SetByteArrayRegion(env, joptions, 0, strlen(agent_options), agent_options);
+ (*env)->SetByteArrayRegion(env, joptions, 0, strlen(agent_options), (jbyte*)agent_options);
}
(*env)->CallObjectMethod(env, *(gdata->inst), *(gdata->premain_method), jclass_name, joptions);
@@ -208,7 +208,7 @@
size = zipEntry.uncompressedSize;
result = (char *)hymem_allocate_memory(size*sizeof(char));
#ifndef HY_ZIP_API
- retval = zip_getZipEntryData(privatePortLibrary, &zipFile, &zipEntry, result, size);
+ retval = zip_getZipEntryData(privatePortLibrary, &zipFile, &zipEntry, (unsigned char*)result, size);
#else /* HY_ZIP_API */
retval = zipFuncs->zip_getZipEntryData(VMI, &zipFile, &zipEntry, result, size);
#endif /* HY_ZIP_API */
@@ -370,7 +370,7 @@
if(!gdata){
jvmtiCapabilities capabilities;
- jvmtiError err;
+ jvmtiError jvmti_err;
jvmtiEventCallbacks callbacks;
JNIEnv *env = NULL;
static jvmtiEnv *jvmti;
@@ -390,19 +390,20 @@
capabilities.can_redefine_classes = 1;
//FIXME VM doesnot support the capbility right now.
//capabilities.can_redefine_any_class = 1;
- err = (*jvmti)->AddCapabilities(jvmti, &capabilities);
- check_jvmti_error(env, err, "Cannot add JVMTI capabilities.");
+ jvmti_err = (*jvmti)->AddCapabilities(jvmti, &capabilities);
+ check_jvmti_error(env, jvmti_err,
+ "Cannot add JVMTI capabilities.");
//set events callback function
(void)memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &callbackClassFileLoadHook;
callbacks.VMInit = &callbackVMInit;
- err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(jvmtiEventCallbacks));
- check_jvmti_error(env, err, "Cannot set JVMTI event callback functions.");
+ jvmti_err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(jvmtiEventCallbacks));
+ check_jvmti_error(env, jvmti_err, "Cannot set JVMTI event callback functions.");
//enable classfileloadhook event
- err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
- check_jvmti_error(env, err, "Cannot set JVMTI VMInit event notification mode.");
+ jvmti_err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+ check_jvmti_error(env, jvmti_err, "Cannot set JVMTI VMInit event notification mode.");
}
return Parse_Options(vm,jnienv, gdata->jvmti,options);
Modified: harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/instrument.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/instrument.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/instrument.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/instrument/src/main/native/instrument/shared/instrument.c Fri Aug 22 00:15:00 2008
@@ -252,7 +252,7 @@
//construct a jvmtiClassDefinition element
class_definitions[index].klass=klass;
- class_definitions[index].class_bytes=class_bytes;
+ class_definitions[index].class_bytes=(unsigned char*)class_bytes;
class_definitions[index].class_byte_count=class_byte_count;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/build.xml Fri Aug 22 00:15:00 2008
@@ -165,6 +165,10 @@
dir="${basedir}"
jvm="${test.jre.home}/bin/java">
+ <assertions enableSystemAssertions="true">
+ <enable />
+ </assertions>
+
<jvmarg line="${hy.test.vmargs}" />
<classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties Fri Aug 22 00:15:00 2008
@@ -219,3 +219,5 @@
ldap.37=Can't delete schema root
ldap.38=Can't modify schema root
ldap.39=Can't rename schema
+ldap.3A=Can't rename empty name
+ldap.3B=Can't rename across contexts