You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/05/25 23:21:10 UTC
svn commit: r948210 - in /harmony/enhanced/java/branches/mrh: ./ classlib/
classlib/make/ classlib/modules/awt/
classlib/modules/awt/src/main/native/gl/windows/
classlib/modules/awt/src/main/native/jpegdecoder/windows/
classlib/modules/awt/src/main/nat...
Author: hindessm
Date: Tue May 25 21:21:09 2010
New Revision: 948210
URL: http://svn.apache.org/viewvc?rev=948210&view=rev
Log:
Merging changes from trunk@946978.
Modified:
harmony/enhanced/java/branches/mrh/ (props changed)
harmony/enhanced/java/branches/mrh/build.xml
harmony/enhanced/java/branches/mrh/classlib/ (props changed)
harmony/enhanced/java/branches/mrh/classlib/build.xml
harmony/enhanced/java/branches/mrh/classlib/make/run-test.xml
harmony/enhanced/java/branches/mrh/classlib/modules/awt/build.xml
harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/gl/windows/makefile
harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile
harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/lcmm/windows/makefile
harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/main/java/java/beans/Introspector.java
harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
harmony/enhanced/java/branches/mrh/classlib/modules/imageio/build.xml
harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile
harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/InetAddress.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/Socket.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Inet6Util.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
harmony/enhanced/java/branches/mrh/common_resources/ (props changed)
harmony/enhanced/java/branches/mrh/drlvm/ (props changed)
harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_field_access.h
harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_method_access.h
harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/src/main/native/jdwp/common/transport/dt_socket/SocketTransport.cpp
Propchange: harmony/enhanced/java/branches/mrh/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 21:21:09 2010
@@ -1 +1,2 @@
-/harmony/enhanced/java/trunk:935751-940795
+/harmony/enhanced/java/branches/mrh:935751
+/harmony/enhanced/java/trunk:935751-946978
Modified: harmony/enhanced/java/branches/mrh/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/build.xml?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/build.xml (original)
+++ harmony/enhanced/java/branches/mrh/build.xml Tue May 25 21:21:09 2010
@@ -183,12 +183,20 @@ Usage:
prefix="${archive.dir.prefix}hdk-${harmony.version}"
mode="755">
<include name="jdk/jre/bin/java"/>
+ <include name="jdk/jre/bin/keytool"/>
+ <include name="jdk/jre/bin/pack200"/>
+ <include name="jdk/jre/bin/policytool"/>
+ <include name="jdk/jre/bin/unpack200"/>
<include name="jdk/bin/*"/>
</tarfileset>
<tarfileset dir="${target.dir}/hdk"
prefix="${archive.dir.prefix}hdk-${harmony.version}">
<include name="**"/>
<exclude name="jdk/jre/bin/java"/>
+ <exclude name="jdk/jre/bin/keytool"/>
+ <exclude name="jdk/jre/bin/pack200"/>
+ <exclude name="jdk/jre/bin/policytool"/>
+ <exclude name="jdk/jre/bin/unpack200"/>
<exclude name="jdk/bin/*"/>
<exclude name="jdk/jre/README"/>
</tarfileset>
@@ -212,6 +220,10 @@ Usage:
filemode="755">
<include name="jdk/jre/bin/java.exe"/>
<include name="jdk/jre/bin/javaw.exe"/>
+ <include name="jdk/jre/bin/keytool.exe"/>
+ <include name="jdk/jre/bin/pack200.exe"/>
+ <include name="jdk/jre/bin/policytool.exe"/>
+ <include name="jdk/jre/bin/unpack200.exe"/>
<include name="jdk/bin/*"/>
</zipfileset>
<zipfileset dir="${target.dir}/hdk"
@@ -219,6 +231,10 @@ Usage:
<include name="**"/>
<exclude name="jdk/jre/bin/java.exe"/>
<exclude name="jdk/jre/bin/javaw.exe"/>
+ <exclude name="jdk/jre/bin/keytool.exe"/>
+ <exclude name="jdk/jre/bin/pack200.exe"/>
+ <exclude name="jdk/jre/bin/policytool.exe"/>
+ <exclude name="jdk/jre/bin/unpack200.exe"/>
<exclude name="jdk/bin/*"/>
<exclude name="jdk/jre/README"/>
</zipfileset>
@@ -247,12 +263,20 @@ Usage:
prefix="${archive.dir.prefix}jdk-${harmony.version}"
mode="755">
<include name="jre/bin/java"/>
+ <include name="jre/bin/keytool"/>
+ <include name="jre/bin/pack200"/>
+ <include name="jre/bin/policytool"/>
+ <include name="jre/bin/unpack200"/>
<include name="bin/*"/>
</tarfileset>
<tarfileset dir="${target.dir}/hdk/jdk"
prefix="${archive.dir.prefix}jdk-${harmony.version}">
<include name="**"/>
<exclude name="jre/bin/java"/>
+ <exclude name="jre/bin/keytool"/>
+ <exclude name="jre/bin/pack200"/>
+ <exclude name="jre/bin/policytool"/>
+ <exclude name="jre/bin/unpack200"/>
<exclude name="bin/*"/>
<exclude name="jre/README"/>
</tarfileset>
@@ -274,6 +298,10 @@ Usage:
filemode="755">
<include name="jre/bin/java.exe"/>
<include name="jre/bin/javaw.exe"/>
+ <include name="jre/bin/keytool.exe"/>
+ <include name="jre/bin/pack200.exe"/>
+ <include name="jre/bin/policytool.exe"/>
+ <include name="jre/bin/unpack200.exe"/>
<include name="bin/*"/>
</zipfileset>
<zipfileset dir="${target.dir}/hdk/jdk"
@@ -281,6 +309,10 @@ Usage:
<include name="**"/>
<exclude name="jre/bin/java.exe"/>
<exclude name="jre/bin/javaw.exe"/>
+ <exclude name="jre/bin/keytool.exe"/>
+ <exclude name="jre/bin/pack200.exe"/>
+ <exclude name="jre/bin/policytool.exe"/>
+ <exclude name="jre/bin/unpack200.exe"/>
<exclude name="bin/*"/>
<exclude name="jre/README"/>
</zipfileset>
@@ -309,11 +341,19 @@ Usage:
prefix="${archive.dir.prefix}jre-${harmony.version}"
mode="755">
<include name="bin/java"/>
+ <include name="bin/keytool"/>
+ <include name="bin/pack200"/>
+ <include name="bin/policytool"/>
+ <include name="bin/unpack200"/>
</tarfileset>
<tarfileset dir="${target.dir}/hdk/jdk/jre"
prefix="${archive.dir.prefix}jre-${harmony.version}">
<include name="**"/>
<exclude name="bin/java"/>
+ <exclude name="bin/keytool"/>
+ <exclude name="bin/pack200"/>
+ <exclude name="bin/policytool"/>
+ <exclude name="bin/unpack200"/>
</tarfileset>
</tar>
@@ -329,12 +369,20 @@ Usage:
filemode="755">
<include name="bin/java.exe"/>
<include name="bin/javaw.exe"/>
+ <include name="bin/keytool.exe"/>
+ <include name="bin/pack200.exe"/>
+ <include name="bin/policytool.exe"/>
+ <include name="bin/unpack200.exe"/>
</zipfileset>
<zipfileset dir="${target.dir}/hdk/jdk/jre"
prefix="${archive.dir.prefix}jre-${harmony.version}">
<include name="**"/>
<exclude name="bin/java.exe"/>
<exclude name="bin/javaw.exe"/>
+ <exclude name="bin/keytool.exe"/>
+ <exclude name="bin/pack200.exe"/>
+ <exclude name="bin/policytool.exe"/>
+ <exclude name="bin/unpack200.exe"/>
</zipfileset>
</zip>
<chksum dir="${target.dir}" file="${deploy.jre.zip}" />
Propchange: harmony/enhanced/java/branches/mrh/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 21:21:09 2010
@@ -1,2 +1,4 @@
/harmony/enhanced/classlib/trunk:926318-926838
-/harmony/enhanced/java/trunk/classlib:935751-940795
+/harmony/enhanced/java/branches/mrh/classlib:935751
+/harmony/enhanced/java/trunk/classlib:935751-946978
+/harmony/enhanced/trunk/classlib:476395-926317
Modified: harmony/enhanced/java/branches/mrh/classlib/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/build.xml?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/build.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/build.xml Tue May 25 21:21:09 2010
@@ -80,6 +80,10 @@ module:
<property name="tests.report.dir" value="${tests.output}/html"/>
<property file="make/depends.properties" />
+ <!-- import properties for snapshot targets -->
+ <import file="make/properties.xml" />
+ <import file="make/depends.xml" />
+
<condition property="needs.vme.v3.hack" value="true">
<or>
<equals arg1="${hy.platform}" arg2="windows.x86" />
@@ -87,10 +91,6 @@ module:
</or>
</condition>
- <!-- import properties for snapshot targets -->
- <import file="make/properties.xml" />
- <import file="make/depends.xml" />
-
<!-- ================================
target : rebuild
@@ -385,7 +385,9 @@ ${built.files.list}
<target name="test"
depends="-test-init-hdk,clean-test-output"
description="Runs all tests">
- <ant dir="${hy.hdk}/build/test" inheritall="false" target="test">
+ <mkdir dir="${tests.output}" />
+ <ant antfile="${hy.hdk}/build/test/build.xml"
+ inheritall="false" target="test">
<property name="tests.output" value="${tests.output}"/>
</ant>
</target>
Modified: harmony/enhanced/java/branches/mrh/classlib/make/run-test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/make/run-test.xml?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/make/run-test.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/make/run-test.xml Tue May 25 21:21:09 2010
@@ -139,7 +139,7 @@
</junitreport>
</target>
- <target name="-short-report" unless="do.full.report">
+ <target name="-short-report" if="do.short.report">
<mkdir dir="${report.dir}" />
<junitreport todir="${report.dir}">
<fileset dir="${tests.output}" includes="TEST*-*.xml">
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/awt/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/awt/build.xml?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/awt/build.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/awt/build.xml Tue May 25 21:21:09 2010
@@ -229,19 +229,22 @@ ${line.separator}For Fedora try: yum ins
<target name="-build-native-common" unless="skip.native.build">
<make dir="src/main/native/lcmm/${hy.os.family}">
<make-elements>
- <env key="HY_LCMS_VER" value="${lcms.ver}" />
+ <env key="HY_LCMS_DIR" value="${lcms.dir}" />
</make-elements>
</make>
+ <pathconvert targetos="windows" property="jpeg.dir.win">
+ <path location="${jpeg.dir}" />
+ </pathconvert>
<make dir="src/main/native/jpegdecoder/${hy.os.family}">
<make-elements>
- <env key="HY_JPEG_VER" value="${jpeg.ver}" />
+ <env key="HY_JPEG_DIR" value="${jpeg.dir.win}" />
</make-elements>
</make>
<make dir="src/main/native/gl/${hy.os.family}">
<make-elements>
- <env key="HY_PNG_VER" value="${png.ver}" />
+ <env key="HY_PNG_DIR" value="${png.dir}" />
</make-elements>
</make>
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/gl/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/gl/windows/makefile?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/gl/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/gl/windows/makefile Tue May 25 21:21:09 2010
@@ -16,7 +16,7 @@
APPVER = 5.0 # Need WINVER=0x0500 to get HMONITOR defined.
!include <$(HY_HDK)\build\make\defines.mak>
-PNG_DIR=$(HY_HDK)\..\depends\libs\$(HY_PLATFORM)\libpng-$(HY_PNG_VER)\# avoid continuation
+PNG_DIR=$(HY_PNG_DIR)\# avoid continuation
LIBBASE=gl
DLLNAME=$(DLLPATH)$(LIBBASE).dll
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/jpegdecoder/windows/makefile Tue May 25 21:21:09 2010
@@ -15,7 +15,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
-JPEG_DIR=$(HY_HDK)\..\depends\libs\$(HY_PLATFORM)\jpeg-$(HY_JPEG_VER)\# avoid continuation
+JPEG_DIR=$(HY_JPEG_DIR)\# avoid continuation
LIBBASE=jpegdecoder
DLLNAME=$(DLLPATH)$(LIBBASE).dll
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/lcmm/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/lcmm/windows/makefile?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/lcmm/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/awt/src/main/native/lcmm/windows/makefile Tue May 25 21:21:09 2010
@@ -15,7 +15,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
-LCMS_DIR=$(HY_HDK)\..\depends\libs\$(HY_PLATFORM)\lcms-$(HY_LCMS_VER)\# avoid continuation
+LCMS_DIR=$(HY_LCMS_DIR)\# avoid continuation
LIBBASE=lcmm
DLLNAME=$(DLLPATH)$(LIBBASE).dll
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/main/java/java/beans/Introspector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/main/java/java/beans/Introspector.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/main/java/java/beans/Introspector.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/main/java/java/beans/Introspector.java Tue May 25 21:21:09 2010
@@ -286,36 +286,42 @@ public class Introspector extends java.l
}
private static BeanInfo getExplicitBeanInfo(Class<?> beanClass) {
- BeanInfo theBeanInfo = null;
String beanInfoClassName = beanClass.getName() + "BeanInfo"; //$NON-NLS-1$
- try{
- theBeanInfo = loadBeanInfo(beanInfoClassName, beanClass);
- return theBeanInfo;
- }catch(Exception e){
- //fall through
+ try {
+ return loadBeanInfo(beanInfoClassName, beanClass);
+ } catch (Exception e) {
+ // fall through
}
+
int index = beanInfoClassName.lastIndexOf('.');
- String beanInfoName = index>=0? beanInfoClassName.substring(index+1):beanInfoClassName;
+ String beanInfoName = index >= 0 ? beanInfoClassName
+ .substring(index + 1) : beanInfoClassName;
+ BeanInfo theBeanInfo = null;
+ BeanDescriptor beanDescriptor = null;
for (int i = 0; i < searchPath.length; i++) {
beanInfoClassName = searchPath[i] + "." + beanInfoName; //$NON-NLS-1$
- try{
+ try {
theBeanInfo = loadBeanInfo(beanInfoClassName, beanClass);
-
- // find the beanInfo of the given beanClass, check whether the
- // beanInfo is consistent with the given beanClass
- Class<?> beanClassOfBeanInfo = theBeanInfo.getBeanDescriptor()
- .getBeanClass();
- if (beanClassOfBeanInfo.equals(beanClass)) {
- break;
- }
- }catch(Exception e){
- //ignore, try next one
+ } catch (Exception e) {
+ // ignore, try next one
+ continue;
+ }
+ beanDescriptor = theBeanInfo.getBeanDescriptor();
+ if (beanDescriptor != null
+ && beanClass == beanDescriptor.getBeanClass()) {
+ return theBeanInfo;
}
}
- return theBeanInfo;
+ if (BeanInfo.class.isAssignableFrom(beanClass)) {
+ try {
+ return loadBeanInfo(beanClass.getName(), beanClass);
+ } catch (Exception e) {
+ // fall through
+ }
+ }
+ return null;
}
-
/*
* Method which attempts to instantiate a BeanInfo object of the supplied
* classname
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java Tue May 25 21:21:09 2010
@@ -450,7 +450,60 @@ public class IntrospectorTest extends Te
} catch (IntrospectionException e) {
}
}
-
+
+ /*
+ * BeanClass provide bean info about itself
+ */
+ public static class MockBeanInfo4BeanClassSelf implements BeanInfo {
+
+ public void setValue(String v) throws Exception {
+ }
+
+ public int getValue() {
+ return 0;
+ }
+
+ public BeanDescriptor getBeanDescriptor() {
+ return null;
+ }
+
+ public EventSetDescriptor[] getEventSetDescriptors() {
+ return new EventSetDescriptor[0];
+ }
+
+ public int getDefaultEventIndex() {
+ return -1;
+ }
+
+ public int getDefaultPropertyIndex() {
+ return -1;
+ }
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ return new PropertyDescriptor[0];
+ }
+
+ public MethodDescriptor[] getMethodDescriptors() {
+ return new MethodDescriptor[0];
+ }
+
+ public BeanInfo[] getAdditionalBeanInfo() {
+ return null;
+ }
+
+ public Image getIcon(int iconKind) {
+ return null;
+ }
+ }
+
+ public void test_BeanInfo_Self() throws Exception {
+ BeanInfo info = Introspector
+ .getBeanInfo(MockBeanInfo4BeanClassSelf.class);
+ assertEquals(0, info.getMethodDescriptors().length);
+ assertEquals(0, info.getPropertyDescriptors().length);
+ assertEquals(0, info.getEventSetDescriptors().length);
+ }
+
/*
* Introspect static methods
*/
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/build.xml?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/build.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/build.xml Tue May 25 21:21:09 2010
@@ -135,15 +135,18 @@ ${line.separator}For Fedora try: yum ins
</target>
<target name="-build-native" unless="skip.native.build">
+ <pathconvert targetos="windows" property="jpeg.dir.win">
+ <path location="${jpeg.dir}" />
+ </pathconvert>
<make dir="src/main/native/jpegencoder/${hy.os.family}">
<make-elements>
- <env key="HY_JPEG_VER" value="${jpeg.ver}" />
+ <env key="HY_JPEG_DIR" value="${jpeg.dir.win}" />
</make-elements>
</make>
<make dir="src/main/native/pngencoder/${hy.os.family}">
<make-elements>
- <env key="HY_PNG_VER" value="${png.ver}" />
+ <env key="HY_PNG_DIR" value="${png.dir}" />
</make-elements>
</make>
</target>
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/jpegencoder/windows/makefile Tue May 25 21:21:09 2010
@@ -15,7 +15,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
-JPEG_DIR=$(HY_HDK)\..\depends\libs\$(HY_PLATFORM)\jpeg-$(HY_JPEG_VER)\# avoid continuation
+JPEG_DIR=$(HY_JPEG_DIR)\# avoid continuation
LIBBASE=jpegencoder
DLLNAME=$(DLLPATH)$(LIBBASE).dll
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/imageio/src/main/native/pngencoder/windows/makefile Tue May 25 21:21:09 2010
@@ -15,7 +15,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
-PNG_DIR=$(HY_HDK)\..\depends\libs\$(HY_PLATFORM)\libpng-$(HY_PNG_VER)\# avoid continuation
+PNG_DIR=$(HY_PNG_DIR)\# avoid continuation
LIBBASE=pngencoder
DLLNAME=$(DLLPATH)$(LIBBASE).dll
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/InetAddress.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/InetAddress.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/InetAddress.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/InetAddress.java Tue May 25 21:21:09 2010
@@ -1342,9 +1342,7 @@ public class InetAddress extends Object
}
static boolean preferIPv6Addresses() {
- String result = AccessController.doPrivileged(new PriviAction<String>(
- "java.net.preferIPv6Addresses")); //$NON-NLS-1$
- return "true".equals(result); //$NON-NLS-1$
+ return NetUtil.preferIPv6Addresses();
}
private static final ObjectStreamField[] serialPersistentFields = {
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/Socket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/Socket.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/Socket.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/Socket.java Tue May 25 21:21:09 2010
@@ -1112,9 +1112,7 @@ public class Socket {
}
static boolean preferIPv4Stack() {
- String result = AccessController.doPrivileged(new PriviAction<String>(
- "java.net.preferIPv4Stack")); //$NON-NLS-1$
- return "true".equals(result); //$NON-NLS-1$
+ return NetUtil.preferIPv4Stack();
}
/**
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Inet6Util.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Inet6Util.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Inet6Util.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Inet6Util.java Tue May 25 21:21:09 2010
@@ -24,28 +24,28 @@ import java.util.StringTokenizer;
*/
public class Inet6Util {
- /**
- * Creates an byte[] based on an ipAddressString. No error handling is
- * performed here.
- */
- public static byte[] createByteArrayFromIPAddressString(
- String ipAddressString) {
+ /**
+ * Creates an byte[] based on an ipAddressString. No error handling is
+ * performed here.
+ */
+ public static byte[] createByteArrayFromIPAddressString(
+ String ipAddressString) {
- if (isValidIPV4Address(ipAddressString)) {
+ if (isValidIPV4Address(ipAddressString)) {
StringTokenizer tokenizer = new StringTokenizer(ipAddressString, ".");
- String token = "";
- int tempInt = 0;
- byte[] byteAddress = new byte[4];
- for (int i = 0; i < 4; i++) {
- token = tokenizer.nextToken();
- tempInt = Integer.parseInt(token);
- byteAddress[i] = (byte) tempInt;
- }
-
- return byteAddress;
- }
-
- if (ipAddressString.charAt(0) == '[') {
+ String token = "";
+ int tempInt = 0;
+ byte[] byteAddress = new byte[4];
+ for (int i = 0; i < 4; i++) {
+ token = tokenizer.nextToken();
+ tempInt = Integer.parseInt(token);
+ byteAddress[i] = (byte) tempInt;
+ }
+
+ return byteAddress;
+ }
+
+ if (ipAddressString.charAt(0) == '[') {
ipAddressString = ipAddressString.substring(1, ipAddressString.length() - 1);
}
@@ -63,235 +63,248 @@ public class Inet6Util {
* or decimal list. In the case where we hit a :: we will save the index
* of the hexStrings so we can add zeros in to fill out the string
*/
- while (tokenizer.hasMoreTokens()) {
- prevToken = token;
- token = tokenizer.nextToken();
-
- if (token.equals(":")) {
- if (prevToken.equals(":")) {
- doubleColonIndex = hexStrings.size();
- } else if (!prevToken.equals("")) {
- hexStrings.add(prevToken);
- }
- } else if (token.equals(".")) {
- decStrings.add(prevToken);
- }
- }
-
- if (prevToken.equals(":")) {
- if (token.equals(":")) {
- doubleColonIndex = hexStrings.size();
- } else {
- hexStrings.add(token);
- }
- } else if (prevToken.equals(".")) {
- decStrings.add(token);
- }
-
- // figure out how many hexStrings we should have
- // also check if it is a IPv4 address
- int hexStringsLength = 8;
-
- // If we have an IPv4 address tagged on at the end, subtract
- // 4 bytes, or 2 hex words from the total
- if (decStrings.size() > 0) {
- hexStringsLength -= 2;
- }
-
- // if we hit a double Colon add the appropriate hex strings
- if (doubleColonIndex != -1) {
- int numberToInsert = hexStringsLength - hexStrings.size();
- for (int i = 0; i < numberToInsert; i++) {
- hexStrings.add(doubleColonIndex, "0");
- }
- }
-
- byte ipByteArray[] = new byte[16];
-
- // Finally convert these strings to bytes...
- for (int i = 0; i < hexStrings.size(); i++) {
- convertToBytes(hexStrings.get(i), ipByteArray, i * 2);
- }
+ while (tokenizer.hasMoreTokens()) {
+ prevToken = token;
+ token = tokenizer.nextToken();
+
+ if (token.equals(":")) {
+ if (prevToken.equals(":")) {
+ doubleColonIndex = hexStrings.size();
+ } else if (!prevToken.equals("")) {
+ hexStrings.add(prevToken);
+ }
+ } else if (token.equals(".")) {
+ decStrings.add(prevToken);
+ }
+ }
- // Now if there are any decimal values, we know where they go...
- for (int i = 0; i < decStrings.size(); i++) {
+ if (prevToken.equals(":")) {
+ if (token.equals(":")) {
+ doubleColonIndex = hexStrings.size();
+ } else {
+ hexStrings.add(token);
+ }
+ } else if (prevToken.equals(".")) {
+ decStrings.add(token);
+ }
+
+ // figure out how many hexStrings we should have
+ // also check if it is a IPv4 address
+ int hexStringsLength = 8;
+
+ // If we have an IPv4 address tagged on at the end, subtract
+ // 4 bytes, or 2 hex words from the total
+ if (decStrings.size() > 0) {
+ hexStringsLength -= 2;
+ }
+
+ // if we hit a double Colon add the appropriate hex strings
+ if (doubleColonIndex != -1) {
+ int numberToInsert = hexStringsLength - hexStrings.size();
+ for (int i = 0; i < numberToInsert; i++) {
+ hexStrings.add(doubleColonIndex, "0");
+ }
+ }
+
+ byte ipByteArray[] = new byte[16];
+
+ // Finally convert these strings to bytes...
+ for (int i = 0; i < hexStrings.size(); i++) {
+ convertToBytes(hexStrings.get(i), ipByteArray, i * 2);
+ }
+
+ // Now if there are any decimal values, we know where they go...
+ for (int i = 0; i < decStrings.size(); i++) {
ipByteArray[i + 12] = (byte) (Integer.parseInt(decStrings.get(i)) & 255);
}
- // now check to see if this guy is actually and IPv4 address
- // an ipV4 address is ::FFFF:d.d.d.d
- boolean ipV4 = true;
- for (int i = 0; i < 10; i++) {
- if (ipByteArray[i] != 0) {
- ipV4 = false;
- break;
- }
- }
-
- if (ipByteArray[10] != -1 || ipByteArray[11] != -1) {
- ipV4 = false;
- }
-
- if (ipV4) {
- byte ipv4ByteArray[] = new byte[4];
- for (int i = 0; i < 4; i++) {
- ipv4ByteArray[i] = ipByteArray[i + 12];
- }
- return ipv4ByteArray;
- }
-
- return ipByteArray;
-
- }
-
- static String hexCharacters = "0123456789ABCDEF";
-
- public static String createIPAddrStringFromByteArray(byte ipByteArray[]) {
- if (ipByteArray.length == 4) {
- return addressToString(bytesToInt(ipByteArray, 0));
- }
-
- if (ipByteArray.length == 16) {
- if (isIPv4MappedAddress(ipByteArray)) {
- byte ipv4ByteArray[] = new byte[4];
- for (int i = 0; i < 4; i++) {
- ipv4ByteArray[i] = ipByteArray[i + 12];
- }
- return addressToString(bytesToInt(ipv4ByteArray, 0));
- }
+ // now check to see if this guy is actually and IPv4 address
+ // an ipV4 address is ::FFFF:d.d.d.d
+ boolean ipV4 = true;
+ for (int i = 0; i < 10; i++) {
+ if (ipByteArray[i] != 0) {
+ ipV4 = false;
+ break;
+ }
+ }
+
+ if (ipByteArray[10] != -1 || ipByteArray[11] != -1) {
+ ipV4 = false;
+ }
+
+ if (ipV4) {
+ byte ipv4ByteArray[] = new byte[4];
+ for (int i = 0; i < 4; i++) {
+ ipv4ByteArray[i] = ipByteArray[i + 12];
+ }
+ return ipv4ByteArray;
+ }
+
+ return ipByteArray;
+
+ }
+
+ static String hexCharacters = "0123456789ABCDEF";
+
+ public static String createIPAddrStringFromByteArray(byte ipByteArray[]) {
+ if (ipByteArray.length == 4) {
+ return addressToString(bytesToInt(ipByteArray, 0));
+ }
+
+ if (ipByteArray.length == 16) {
+ if (isIPv4MappedAddress(ipByteArray)) {
+ byte ipv4ByteArray[] = new byte[4];
+ for (int i = 0; i < 4; i++) {
+ ipv4ByteArray[i] = ipByteArray[i + 12];
+ }
+ return addressToString(bytesToInt(ipv4ByteArray, 0));
+ }
StringBuilder buffer = new StringBuilder();
+ boolean isFirst = true;
for (int i = 0; i < ipByteArray.length; i++) {
- int j = (ipByteArray[i] & 0xf0) >>> 4;
- buffer.append(hexCharacters.charAt(j));
- j = ipByteArray[i] & 0x0f;
- buffer.append(hexCharacters.charAt(j));
- if (i % 2 != 0 && (i + 1) < ipByteArray.length) {
- buffer.append(":");
- }
+ if ((i & 1) == 0) {
+ isFirst = true;
+ }
+ int j = (ipByteArray[i] & 0xf0) >>> 4;
+ if (j != 0 || !isFirst) {
+ buffer.append(hexCharacters.charAt(j));
+ isFirst = false;
+ }
+ j = ipByteArray[i] & 0x0f;
+ if (j != 0 || !isFirst) {
+ buffer.append(hexCharacters.charAt(j));
+ isFirst = false;
+ }
+ if ((i & 1) != 0 && (i + 1) < ipByteArray.length) {
+ if (isFirst) {
+ buffer.append('0');
+ }
+ buffer.append(':');
+ }
}
return buffer.toString();
- }
- return null;
- }
-
- /** Converts a 4 character hex word into a 2 byte word equivalent */
- public static void convertToBytes(String hexWord, byte ipByteArray[],
- int byteIndex) {
-
- int hexWordLength = hexWord.length();
- int hexWordIndex = 0;
- ipByteArray[byteIndex] = 0;
- ipByteArray[byteIndex + 1] = 0;
- int charValue;
-
- // high order 4 bits of first byte
- if (hexWordLength > 3) {
- charValue = getIntValue(hexWord.charAt(hexWordIndex++));
- ipByteArray[byteIndex] = (byte) (ipByteArray[byteIndex] | (charValue << 4));
- }
-
- // low order 4 bits of the first byte
- if (hexWordLength > 2) {
- charValue = getIntValue(hexWord.charAt(hexWordIndex++));
- ipByteArray[byteIndex] = (byte) (ipByteArray[byteIndex] | charValue);
- }
-
- // high order 4 bits of second byte
- if (hexWordLength > 1) {
- charValue = getIntValue(hexWord.charAt(hexWordIndex++));
- ipByteArray[byteIndex + 1] = (byte) (ipByteArray[byteIndex + 1] | (charValue << 4));
- }
-
- // low order 4 bits of the first byte
- charValue = getIntValue(hexWord.charAt(hexWordIndex));
- ipByteArray[byteIndex + 1] = (byte) (ipByteArray[byteIndex + 1] | charValue & 15);
- }
-
- static int getIntValue(char c) {
-
- switch (c) {
- case '0':
- return 0;
- case '1':
- return 1;
- case '2':
- return 2;
- case '3':
- return 3;
- case '4':
- return 4;
- case '5':
- return 5;
- case '6':
- return 6;
- case '7':
- return 7;
- case '8':
- return 8;
- case '9':
- return 9;
- }
-
- c = Character.toLowerCase(c);
- switch (c) {
- case 'a':
- return 10;
- case 'b':
- return 11;
- case 'c':
- return 12;
- case 'd':
- return 13;
- case 'e':
- return 14;
- case 'f':
- return 15;
- }
- return 0;
- }
-
- private static boolean isIPv4MappedAddress(byte ipAddress[]) {
-
- // Check if the address matches ::FFFF:d.d.d.d
- // The first 10 bytes are 0. The next to are -1 (FF).
- // The last 4 bytes are varied.
- for (int i = 0; i < 10; i++) {
- if (ipAddress[i] != 0) {
- return false;
- }
- }
-
- if (ipAddress[10] != -1 || ipAddress[11] != -1) {
- return false;
- }
-
- return true;
-
- }
-
- /**
- * Takes the byte array and creates an integer out of four bytes starting at
- * start as the high-order byte. This method makes no checks on the validity
- * of the parameters.
- */
- public static int bytesToInt(byte bytes[], int start) {
- // First mask the byte with 255, as when a negative
- // signed byte converts to an integer, it has bits
- // on in the first 3 bytes, we are only concerned
- // about the right-most 8 bits.
- // Then shift the rightmost byte to align with its
- // position in the integer.
- int value = ((bytes[start + 3] & 255))
- | ((bytes[start + 2] & 255) << 8)
- | ((bytes[start + 1] & 255) << 16)
- | ((bytes[start] & 255) << 24);
- return value;
- }
-
- public static String addressToString(int value) {
- return ((value >> 24) & 0xff) + "." + ((value >> 16) & 0xff) + "."
- + ((value >> 8) & 0xff) + "." + (value & 0xff);
- }
+ }
+ return null;
+ }
+
+ /** Converts a 4 character hex word into a 2 byte word equivalent */
+ public static void convertToBytes(String hexWord, byte ipByteArray[],
+ int byteIndex) {
+
+ int hexWordLength = hexWord.length();
+ int hexWordIndex = 0;
+ ipByteArray[byteIndex] = 0;
+ ipByteArray[byteIndex + 1] = 0;
+ int charValue;
+
+ // high order 4 bits of first byte
+ if (hexWordLength > 3) {
+ charValue = getIntValue(hexWord.charAt(hexWordIndex++));
+ ipByteArray[byteIndex] = (byte) (ipByteArray[byteIndex] | (charValue << 4));
+ }
+
+ // low order 4 bits of the first byte
+ if (hexWordLength > 2) {
+ charValue = getIntValue(hexWord.charAt(hexWordIndex++));
+ ipByteArray[byteIndex] = (byte) (ipByteArray[byteIndex] | charValue);
+ }
+
+ // high order 4 bits of second byte
+ if (hexWordLength > 1) {
+ charValue = getIntValue(hexWord.charAt(hexWordIndex++));
+ ipByteArray[byteIndex + 1] = (byte) (ipByteArray[byteIndex + 1] | (charValue << 4));
+ }
+
+ // low order 4 bits of the first byte
+ charValue = getIntValue(hexWord.charAt(hexWordIndex));
+ ipByteArray[byteIndex + 1] = (byte) (ipByteArray[byteIndex + 1] | charValue & 15);
+ }
+
+ static int getIntValue(char c) {
+
+ switch (c) {
+ case '0':
+ return 0;
+ case '1':
+ return 1;
+ case '2':
+ return 2;
+ case '3':
+ return 3;
+ case '4':
+ return 4;
+ case '5':
+ return 5;
+ case '6':
+ return 6;
+ case '7':
+ return 7;
+ case '8':
+ return 8;
+ case '9':
+ return 9;
+ }
+
+ c = Character.toLowerCase(c);
+ switch (c) {
+ case 'a':
+ return 10;
+ case 'b':
+ return 11;
+ case 'c':
+ return 12;
+ case 'd':
+ return 13;
+ case 'e':
+ return 14;
+ case 'f':
+ return 15;
+ }
+ return 0;
+ }
+
+ private static boolean isIPv4MappedAddress(byte ipAddress[]) {
+
+ // Check if the address matches ::FFFF:d.d.d.d
+ // The first 10 bytes are 0. The next to are -1 (FF).
+ // The last 4 bytes are varied.
+ for (int i = 0; i < 10; i++) {
+ if (ipAddress[i] != 0) {
+ return false;
+ }
+ }
+
+ if (ipAddress[10] != -1 || ipAddress[11] != -1) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ /**
+ * Takes the byte array and creates an integer out of four bytes starting at
+ * start as the high-order byte. This method makes no checks on the validity
+ * of the parameters.
+ */
+ public static int bytesToInt(byte bytes[], int start) {
+ // First mask the byte with 255, as when a negative
+ // signed byte converts to an integer, it has bits
+ // on in the first 3 bytes, we are only concerned
+ // about the right-most 8 bits.
+ // Then shift the rightmost byte to align with its
+ // position in the integer.
+ int value = ((bytes[start + 3] & 255))
+ | ((bytes[start + 2] & 255) << 8)
+ | ((bytes[start + 1] & 255) << 16)
+ | ((bytes[start] & 255) << 24);
+ return value;
+ }
+
+ public static String addressToString(int value) {
+ return ((value >> 24) & 0xff) + "." + ((value >> 16) & 0xff) + "."
+ + ((value >> 8) & 0xff) + "." + (value & 0xff);
+ }
public static boolean isIP6AddressInFullForm(String ipAddress) {
if (isValidIP6Address(ipAddress)) {
@@ -304,179 +317,179 @@ public class Inet6Util {
}
return false;
}
-
- public static boolean isValidIP6Address(String ipAddress) {
- int length = ipAddress.length();
- boolean doubleColon = false;
- int numberOfColons = 0;
- int numberOfPeriods = 0;
- int numberOfPercent = 0;
- String word = "";
- char c = 0;
- char prevChar = 0;
- int offset = 0; // offset for [] IP addresses
- if (length < 2) {
+ public static boolean isValidIP6Address(String ipAddress) {
+ int length = ipAddress.length();
+ boolean doubleColon = false;
+ int numberOfColons = 0;
+ int numberOfPeriods = 0;
+ int numberOfPercent = 0;
+ String word = "";
+ char c = 0;
+ char prevChar = 0;
+ int offset = 0; // offset for [] IP addresses
+
+ if (length < 2) {
return false;
}
- for (int i = 0; i < length; i++) {
- prevChar = c;
- c = ipAddress.charAt(i);
- switch (c) {
-
- // case for an open bracket [x:x:x:...x]
- case '[':
- if (i != 0) {
+ for (int i = 0; i < length; i++) {
+ prevChar = c;
+ c = ipAddress.charAt(i);
+ switch (c) {
+
+ // case for an open bracket [x:x:x:...x]
+ case '[':
+ if (i != 0) {
return false; // must be first character
}
- if (ipAddress.charAt(length - 1) != ']') {
+ if (ipAddress.charAt(length - 1) != ']') {
return false; // must have a close ]
}
- offset = 1;
- if (length < 4) {
+ offset = 1;
+ if (length < 4) {
return false;
}
- break;
+ break;
- // case for a closed bracket at end of IP [x:x:x:...x]
- case ']':
- if (i != length - 1) {
+ // case for a closed bracket at end of IP [x:x:x:...x]
+ case ']':
+ if (i != length - 1) {
return false; // must be last character
}
- if (ipAddress.charAt(0) != '[') {
+ if (ipAddress.charAt(0) != '[') {
return false; // must have a open [
}
- break;
+ break;
- // case for the last 32-bits represented as IPv4 x:x:x:x:x:x:d.d.d.d
- case '.':
- numberOfPeriods++;
- if (numberOfPeriods > 3) {
+ // case for the last 32-bits represented as IPv4 x:x:x:x:x:x:d.d.d.d
+ case '.':
+ numberOfPeriods++;
+ if (numberOfPeriods > 3) {
return false;
}
- if (!isValidIP4Word(word)) {
+ if (!isValidIP4Word(word)) {
return false;
}
- if (numberOfColons != 6 && !doubleColon) {
+ if (numberOfColons != 6 && !doubleColon) {
return false;
}
- // a special case ::1:2:3:4:5:d.d.d.d allows 7 colons with an
- // IPv4 ending, otherwise 7 :'s is bad
- if (numberOfColons == 7 && ipAddress.charAt(0 + offset) != ':'
- && ipAddress.charAt(1 + offset) != ':') {
+ // a special case ::1:2:3:4:5:d.d.d.d allows 7 colons with an
+ // IPv4 ending, otherwise 7 :'s is bad
+ if (numberOfColons == 7 && ipAddress.charAt(0 + offset) != ':'
+ && ipAddress.charAt(1 + offset) != ':') {
return false;
}
- word = "";
- break;
+ word = "";
+ break;
- case ':':
- numberOfColons++;
- if (numberOfColons > 7) {
+ case ':':
+ numberOfColons++;
+ if (numberOfColons > 7) {
return false;
}
- if (numberOfPeriods > 0) {
+ if (numberOfPeriods > 0) {
return false;
}
- if (prevChar == ':') {
- if (doubleColon) {
+ if (prevChar == ':') {
+ if (doubleColon) {
return false;
}
- doubleColon = true;
- }
- word = "";
- break;
- case '%':
- if (numberOfColons == 0) {
- return false;
- }
- numberOfPercent++;
-
- // validate that the stuff after the % is valid
- if ((i + 1) >= length) {
- // in this case the percent is there but no number is
- // available
- return false;
- }
- try {
- Integer.parseInt(ipAddress.substring(i + 1));
- } catch (NumberFormatException e) {
- // right now we just support an integer after the % so if
- // this is not
- // what is there then return
- return false;
- }
- break;
-
- default:
- if (numberOfPercent == 0) {
- if (word.length() > 3) {
+ doubleColon = true;
+ }
+ word = "";
+ break;
+ case '%':
+ if (numberOfColons == 0) {
+ return false;
+ }
+ numberOfPercent++;
+
+ // validate that the stuff after the % is valid
+ if ((i + 1) >= length) {
+ // in this case the percent is there but no number is
+ // available
+ return false;
+ }
+ try {
+ Integer.parseInt(ipAddress.substring(i + 1));
+ } catch (NumberFormatException e) {
+ // right now we just support an integer after the % so if
+ // this is not
+ // what is there then return
+ return false;
+ }
+ break;
+
+ default:
+ if (numberOfPercent == 0) {
+ if (word.length() > 3) {
return false;
}
- if (!isValidHexChar(c)) {
+ if (!isValidHexChar(c)) {
return false;
}
- }
- word += c;
- }
- }
-
- // Check if we have an IPv4 ending
- if (numberOfPeriods > 0) {
- if (numberOfPeriods != 3 || !isValidIP4Word(word)) {
+ }
+ word += c;
+ }
+ }
+
+ // Check if we have an IPv4 ending
+ if (numberOfPeriods > 0) {
+ if (numberOfPeriods != 3 || !isValidIP4Word(word)) {
+ return false;
+ }
+ } else {
+ // If we're at then end and we haven't had 7 colons then there is a
+ // problem unless we encountered a doubleColon
+ if (numberOfColons != 7 && !doubleColon) {
return false;
}
- } else {
- // If we're at then end and we haven't had 7 colons then there is a
- // problem unless we encountered a doubleColon
- if (numberOfColons != 7 && !doubleColon) {
- return false;
- }
-
- // If we have an empty word at the end, it means we ended in either
- // a : or a .
- // If we did not end in :: then this is invalid
- if (numberOfPercent == 0) {
- if (word == "" && ipAddress.charAt(length - 1 - offset) == ':'
- && ipAddress.charAt(length - 2 - offset) != ':') {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public static boolean isValidIP4Word(String word) {
- char c;
- if (word.length() < 1 || word.length() > 3) {
+
+ // If we have an empty word at the end, it means we ended in either
+ // a : or a .
+ // If we did not end in :: then this is invalid
+ if (numberOfPercent == 0) {
+ if (word == "" && ipAddress.charAt(length - 1 - offset) == ':'
+ && ipAddress.charAt(length - 2 - offset) != ':') {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean isValidIP4Word(String word) {
+ char c;
+ if (word.length() < 1 || word.length() > 3) {
return false;
}
- for (int i = 0; i < word.length(); i++) {
- c = word.charAt(i);
- if (!(c >= '0' && c <= '9')) {
+ for (int i = 0; i < word.length(); i++) {
+ c = word.charAt(i);
+ if (!(c >= '0' && c <= '9')) {
return false;
}
- }
- if (Integer.parseInt(word) > 255) {
+ }
+ if (Integer.parseInt(word) > 255) {
return false;
}
- return true;
- }
+ return true;
+ }
- static boolean isValidHexChar(char c) {
+ static boolean isValidHexChar(char c) {
- return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')
- || (c >= 'a' && c <= 'f');
- }
-
- /**
- * Takes a string and parses it to see if it is a valid IPV4 address.
- *
- * @return true, if the string represents an IPV4 address in dotted
- * notation, false otherwise
- */
- public static boolean isValidIPV4Address(String value) {
+ return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')
+ || (c >= 'a' && c <= 'f');
+ }
+
+ /**
+ * Takes a string and parses it to see if it is a valid IPV4 address.
+ *
+ * @return true, if the string represents an IPV4 address in dotted
+ * notation, false otherwise
+ */
+ public static boolean isValidIPV4Address(String value) {
// general test
if (!value.matches("[\\p{Digit}\\.]*")) {
return false;
@@ -500,6 +513,6 @@ public class Inet6Util {
}
}
return true;
- }
+ }
}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java Tue May 25 21:21:09 2010
@@ -22,6 +22,7 @@ import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
+import java.util.Locale;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
@@ -822,6 +823,16 @@ public class Inet6AddressTest extends ju
Inet6Address.getByAddress("123", addr2, nif);
}
+ public void test_getHostAddress_() throws Exception {
+ byte[] ipAddress = new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+ InetAddress ia = InetAddress.getByAddress(ipAddress);
+ assertEquals("0:0:0:0:0:0:0:1", ia.getHostAddress().toLowerCase(Locale.US));
+
+ ipAddress = new byte[] {-2, -128, 0, 0, 0, 0, 0, 0, 2, 17, 37, -1, -2, -8, 124, -79};
+ ia = InetAddress.getByAddress(ipAddress);
+ assertEquals("fe80:0:0:0:211:25ff:fef8:7cb1", ia.getHostAddress().toLowerCase(Locale.US));
+ }
+
/**
* @throws UnknownHostException
* @tests java.net.Inet6Address#getScopeID()
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Tue May 25 21:21:09 2010
@@ -1006,6 +1006,57 @@ class SocketChannelImpl extends SocketCh
return new SocketChannelInputStream(channel);
}
+ @Override
+ public InetAddress getInetAddress() {
+ if (!isConnected()) {
+ return null;
+ }
+
+ if (channel.connectAddress == null && super.getInetAddress() != null) {
+ channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
+ }
+ if (channel.connectAddress == null) {
+ return null;
+ }
+ return channel.connectAddress.getAddress();
+ }
+
+ @Override
+ public SocketAddress getRemoteSocketAddress() {
+ if (!isConnected()) {
+ return null;
+ }
+ if (channel.connectAddress == null && super.getInetAddress() != null) {
+ channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
+ }
+ return channel.connectAddress;
+ }
+
+ @Override
+ public int getPort() {
+ if (!isConnected()) {
+ return 0;
+ }
+ if (channel.connectAddress == null && super.getInetAddress() != null) {
+ channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
+ }
+ if (channel.connectAddress == null) {
+ return 0;
+ }
+ return channel.connectAddress.getPort();
+ }
+
+ @Override
+ public int getLocalPort() {
+ if (!isBound()) {
+ return -1;
+ }
+ if (channel.localPort == 0 && super.getLocalPort() != -1) {
+ channel.localPort = super.getLocalPort();
+ }
+ return channel.localPort;
+ }
+
/*
* Checks whether the channel is open.
*/
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Tue May 25 21:21:09 2010
@@ -369,6 +369,63 @@ public class SocketChannelTest extends T
}
}
+ public void testSocket_getInetAddress() throws Exception {
+ Socket socket = channel1.socket();
+ assertNull(socket.getInetAddress());
+
+ channel1.connect(localAddr1);
+
+ assertNotNull(socket.getInetAddress());
+ assertEquals(localAddr1.getAddress(), socket.getInetAddress());
+ }
+
+ public void testSocket_getRemoteSocketAddress() throws Exception {
+ Socket socket = channel1.socket();
+ assertNull(socket.getRemoteSocketAddress());
+
+ channel1.connect(localAddr1);
+
+ assertNotNull(socket.getRemoteSocketAddress());
+ assertEquals(localAddr1, socket.getRemoteSocketAddress());
+ }
+
+ public void testSocket_getPort() throws Exception {
+ Socket socket = channel1.socket();
+ assertEquals(0, socket.getPort());
+
+ channel1.connect(localAddr1);
+
+ assertEquals(localAddr1.getPort(), socket.getPort());
+ }
+
+ public void testSocket_getLocalAddress() throws Exception {
+ Socket socket = channel1.socket();
+ assertNotNull(socket.getLocalAddress());
+
+ channel1.connect(localAddr1);
+
+ assertNotNull(socket.getLocalAddress());
+ }
+
+ public void testSocket_getLocalSocketAddress() throws Exception {
+ Socket socket = channel1.socket();
+ assertNull(socket.getLocalSocketAddress());
+
+ channel1.connect(localAddr1);
+
+ assertNotNull(socket.getLocalSocketAddress());
+ }
+
+ public void testSocket_getLocalPort() throws Exception {
+ Socket socket = channel1.socket();
+ assertEquals(-1, socket.getLocalPort());
+
+ channel1.connect(localAddr1);
+
+ assertTrue(-1 != socket.getLocalPort());
+ assertTrue(0 != socket.getLocalPort());
+ }
+
private void assertSocketBeforeConnect(Socket s) throws IOException {
assertFalse(s.isBound());
assertFalse(s.isClosed());
Propchange: harmony/enhanced/java/branches/mrh/common_resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 21:21:09 2010
@@ -1,3 +1,4 @@
-/harmony/enhanced/java/trunk/common_resources:935751-940795
-/harmony/enhanced/trunk/common_resources:476396-920147
-/incubator/harmony/enhanced/trunk/common_resources:423974-476394
+/harmony/enhanced/java/branches/mrh/common_resources:935751
+/harmony/enhanced/java/trunk/common_resources:935751-946978
+/harmony/enhanced/trunk/common_resources:476395-921782
+/incubator/harmony/enhanced/trunk/common_resources:292550-476394
Propchange: harmony/enhanced/java/branches/mrh/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 25 21:21:09 2010
@@ -1,3 +1,5 @@
-/harmony/enhanced/java/trunk/drlvm:935751-940795
+/harmony/enhanced/java/branches/mrh/drlvm:935751
+/harmony/enhanced/java/trunk/drlvm:935751-946978
+/harmony/enhanced/trunk/drlvm:476395-926313
/harmony/enhanced/trunk/working_vm:476396-920147
/incubator/harmony/enhanced/trunk/working_vm:423974-476394
Modified: harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_field_access.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_field_access.h?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_field_access.h (original)
+++ harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_field_access.h Tue May 25 21:21:09 2010
@@ -226,6 +226,8 @@ DECLARE_OPEN(void, field_get_track_acces
*/
DECLARE_OPEN(void, field_get_track_modification_flag, (Field_Handle field, char** address, char* mask));
+#ifdef __cplusplus
}
+#endif
#endif // _VM_FIELD_ACCESS_H
Modified: harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_method_access.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_method_access.h?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_method_access.h (original)
+++ harmony/enhanced/java/branches/mrh/drlvm/vm/include/open/vm_method_access.h Tue May 25 21:21:09 2010
@@ -570,6 +570,8 @@ DECLARE_OPEN(U_8*, method_get_info_block
*/
DECLARE_OPEN(unsigned, method_get_info_block_size_jit, (Method_Handle method, JIT_Handle jit));
+#ifdef __cplusplus
}
+#endif
#endif // _VM_METHOD_ACCESS_H
Modified: harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/src/main/native/jdwp/common/transport/dt_socket/SocketTransport.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/src/main/native/jdwp/common/transport/dt_socket/SocketTransport.cpp?rev=948210&r1=948209&r2=948210&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/src/main/native/jdwp/common/transport/dt_socket/SocketTransport.cpp (original)
+++ harmony/enhanced/java/branches/mrh/jdktools/modules/jpda/src/main/native/jdwp/common/transport/dt_socket/SocketTransport.cpp Tue May 25 21:21:09 2010
@@ -224,12 +224,6 @@ CheckHandshaking(jdwpTransportEnv* env,
jlong deadline = (handshakeTimeout == 0) ? 0 : (jlong)GetTickCount() + handshakeTimeout;
jdwpTransportError err;
- err = SendData(env, sckt, handshakeString, (int)strlen(handshakeString), deadline);
- if (err != JDWPTRANSPORT_ERROR_NONE) {
- SetLastTranErrorMessagePrefix(env, "'JDWP-Handshake' sending error: ");
- return err;
- }
-
err = ReceiveData(env, sckt, receivedString, (int)strlen(handshakeString), deadline);
if (err != JDWPTRANSPORT_ERROR_NONE) {
SetLastTranErrorMessagePrefix(env, "'JDWP-Handshake' receiving error: ");
@@ -241,6 +235,12 @@ CheckHandshaking(jdwpTransportEnv* env,
return JDWPTRANSPORT_ERROR_IO_ERROR;
}
+ err = SendData(env, sckt, handshakeString, (int)strlen(handshakeString), deadline);
+ if (err != JDWPTRANSPORT_ERROR_NONE) {
+ SetLastTranErrorMessagePrefix(env, "'JDWP-Handshake' sending error: ");
+ return err;
+ }
+
return JDWPTRANSPORT_ERROR_NONE;
}// CheckHandshaking