harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r986447 - in /harmony/enhanced/java/branches/mrh: ./ classlib/ classlib/depends/build/platform/ classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ classlib/modules/luni/src/main/java/java/lang/ classlib/m...
Date Tue, 17 Aug 2010 18:38:43 GMT
Author: hindessm
Date: Tue Aug 17 18:38:42 2010
New Revision: 986447

URL: http://svn.apache.org/viewvc?rev=986447&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@964786:

  r964786 | tellison | 2010-07-16 13:38:46 +0100 (Fri, 16 Jul 2010) | 3 lines
  
  Fix to date toString to use the short display name in the correct daylight zone, and fix
a test that makes assumptions about the name.
  Use a string builder to collect the string.
  Tidy-up some of the compiler directives.


Modified:
    harmony/enhanced/java/branches/mrh/   (props changed)
    harmony/enhanced/java/branches/mrh/classlib/   (props changed)
    harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk
    harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk
    harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/lang/String.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Date.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Scanner.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/DateTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/util/UtilTest.java
    harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
    harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java
    harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
    harmony/enhanced/java/branches/mrh/common_resources/   (props changed)
    harmony/enhanced/java/branches/mrh/drlvm/   (props changed)

Propchange: harmony/enhanced/java/branches/mrh/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 17 18:38:42 2010
@@ -1,2 +1,2 @@
 /harmony/enhanced/java/branches/mrh:935751
-/harmony/enhanced/java/trunk:935751-964042
+/harmony/enhanced/java/trunk:935751-964765,964786

Propchange: harmony/enhanced/java/branches/mrh/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 17 18:38:42 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk:926318-926838
 /harmony/enhanced/java/branches/mrh/classlib:935751
-/harmony/enhanced/java/trunk/classlib:935751-964042
+/harmony/enhanced/java/trunk/classlib:935751-964765,964786
 /harmony/enhanced/trunk/classlib:476395-926317

Modified: harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk (original)
+++ harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390.mk Tue Aug
17 18:38:42 2010
@@ -19,7 +19,7 @@ AS = cc
 # Use cxx/c++ for c++ compiles on z/OS
 CXX = cxx
 
-DEFINES += -DZOS -DZOS_S390 -DHYS390 -DHY_ATOE
+DEFINES += -DZOS -DZOS_S390 -DHYS390 -DHY_ATOE -DIPv6_FUNCTION_SUPPORT
 PLATFORM = -Wc,xplink,convlit\(ISO8859-1\),FLOAT\(IEEE,FOLD,AFP\) -Wa,goff \
            -Wc,NOANSIALIAS -Wc,DLL,EXPORTALL
 

Modified: harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk (original)
+++ harmony/enhanced/java/branches/mrh/classlib/depends/build/platform/zos.s390x.mk Tue Aug
17 18:38:42 2010
@@ -19,7 +19,7 @@ AS = cc
 # Use cxx/c++ for c++ compiles on z/OS
 CXX = cxx
 
-DEFINES += -DZOS -DZOS_S390X -DHYS390X -DHY_ATOE
+DEFINES += -DZOS -DZOS_S390X -DHYS390X -DHY_ATOE -DIPv6_FUNCTION_SUPPORT
 PLATFORM = -Wc,lp64,xplink,convlit\(ISO8859-1\),FLOAT\(IEEE,FOLD,AFP\) \
            -Wa,goff -Wc,NOANSIALIAS -Wc,DLL,EXPORTALL
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
Tue Aug 17 18:38:42 2010
@@ -662,11 +662,12 @@ public class JarFileTest extends TestCas
         assertEquals("Wrong length of empty jar entry", -1, res);
     }
 
+    // Regression test for HARMONY-6384
     public void testJarWrittenWithFlush() throws IOException {
         File f = new File(resources, "hyts_flushed.jar");
         Support_Resources.copyFile(resources, null, "hyts_flushed.jar");
 
-        // Harmony crashes with ZipException: Central Directory Entry not found
+        // Used to crash with ZipException: Central Directory Entry not found
         new JarFile(f);
     }
 }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/lang/String.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/lang/String.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/lang/String.java
Tue Aug 17 18:38:42 2010
@@ -986,9 +986,20 @@ public final class String implements Ser
             if (start < 0) {
                 start = 0;
             }
-            for (int i = offset + start; i < offset + count; i++) {
-                if (value[i] == c) {
-                    return i - offset;
+            if (c >= 0 && c <= Character.MAX_VALUE) {
+                for (int i = offset + start; i < offset + count; i++) {
+                    if (value[i] == c) {
+                        return i - offset;
+                    }
+                }
+            } else if (c > Character.MAX_VALUE && c <= Character.MAX_CODE_POINT)
{
+                for (int i = start; i < count; i++) {
+                    int codePoint = codePointAt(i);
+                    if (codePoint == c) {
+                        return i;
+                    } else if (codePoint >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
+                        i++;
+                    }
                 }
             }
         }
@@ -1099,9 +1110,20 @@ public final class String implements Ser
             if (start >= count) {
                 start = count - 1;
             }
-            for (int i = offset + start; i >= offset; --i) {
-                if (value[i] == c) {
-                    return i - offset;
+            if (c >= 0 && c <= Character.MAX_VALUE) {
+                for (int i = offset + start; i >= offset; --i) {
+                    if (value[i] == c) {
+                        return i - offset;
+                    }
+                }
+            } else if (c > Character.MAX_VALUE && c <= Character.MAX_CODE_POINT)
{
+                for (int i = start; i >= 0; --i) {
+                    int codePoint = codePointAt(i);
+                    if (codePoint == c) {
+                        return i;
+                    } else if (codePoint >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
+                        --i;
+                    }
                 }
             }
         }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
Tue Aug 17 18:38:42 2010
@@ -111,7 +111,7 @@ public abstract class URLStreamHandler {
         String userInfo = u.getUserInfo();
 
         int refIdx = parseString.indexOf('#', 0);
-        if (parseString.startsWith("//")) { //$NON-NLS-1$
+        if (parseString.startsWith("//") && !parseString.startsWith("////")) { //$NON-NLS-1$
             int hostIdx = 2, portIdx = -1;
             port = -1;
             fileIdx = parseString.indexOf('/', hostIdx);

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Date.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Date.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Date.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Date.java
Tue Aug 17 18:38:42 2010
@@ -45,12 +45,13 @@ public class Date implements Serializabl
 
     private transient long milliseconds;
     
-    private static String[] dayOfWeekNames = { "Sun", "Mon", "Tue", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
-        "Wed", "Thu", "Fri", "Sat" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    
-    private static String[] monthNames = { "Jan", "Feb", "Mar", //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
-        "Apr", "May", "Jun", "Jul", //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-        "Aug", "Sep", "Oct", "Nov", "Dec"};  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
//$NON-NLS-5$
+    @SuppressWarnings("nls")
+    private static String[] dayOfWeekNames = { "Sun", "Mon", "Tue", "Wed",
+            "Thu", "Fri", "Sat" };
+
+    @SuppressWarnings("nls")
+    private static String[] monthNames = { "Jan", "Feb", "Mar", "Apr", "May",
+            "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
 
     /**
      * Initializes this {@code Date} instance to the current date and time.
@@ -708,10 +709,28 @@ public class Date implements Serializabl
     @Override
     public String toString() {
         Calendar cal = new GregorianCalendar(milliseconds);
-        return dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1] + " " + monthNames[cal.get(Calendar.MONTH)]//$NON-NLS-1$
-                + " " + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)) + " " + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY))//$NON-NLS-1$
//$NON-NLS-2$
-                + ":" + toTwoDigits(cal.get(Calendar.MINUTE)) + ":" + toTwoDigits(cal.get(Calendar.SECOND))//$NON-NLS-1$
//$NON-NLS-2$
-                + " " + cal.getTimeZone().getID() + " " + cal.get(Calendar.YEAR);//$NON-NLS-1$
//$NON-NLS-2$
+        TimeZone zone = cal.getTimeZone();
+        String zoneName = zone.getDisplayName(zone.inDaylightTime(this),
+                TimeZone.SHORT, Locale.getDefault());
+
+        StringBuilder sb = new StringBuilder(34);
+        sb.append(dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1]);
+        sb.append(' ');
+        sb.append(monthNames[cal.get(Calendar.MONTH)]);
+        sb.append(' ');
+        sb.append(toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)));
+        sb.append(' ');
+        sb.append(toTwoDigits(cal.get(Calendar.HOUR_OF_DAY)));
+        sb.append(':');
+        sb.append(toTwoDigits(cal.get(Calendar.MINUTE)));
+        sb.append(':');
+        sb.append(toTwoDigits(cal.get(Calendar.SECOND)));
+        sb.append(' ');
+        sb.append(zoneName);
+        sb.append(' ');
+        sb.append(cal.get(Calendar.YEAR));
+
+        return sb.toString();
     }
 
     private String toTwoDigits(int digit) {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Scanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Scanner.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Scanner.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/util/Scanner.java
Tue Aug 17 18:38:42 2010
@@ -844,7 +844,8 @@ public final class Scanner implements It
         boolean hasNextLine = false;
         while (true) {
             if (matcher.find()) {
-                if (inputExhausted || matcher.end() != bufferLength) {
+                if (inputExhausted || matcher.end() != bufferLength
+                        || bufferLength < buffer.capacity()) {
                     matchSuccessful = true;
                     hasNextLine = true;
                     break;

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
Tue Aug 17 18:38:42 2010
@@ -52,6 +52,7 @@ import java.util.TimeZone;
 import org.apache.harmony.luni.util.Base64;
 import org.apache.harmony.luni.internal.nls.Messages;
 import org.apache.harmony.luni.util.PriviAction;
+import org.apache.harmony.luni.util.Util;
 
 /**
  * This subclass extends <code>HttpURLConnection</code> which in turns extends
@@ -615,6 +616,7 @@ public class HttpURLConnectionImpl exten
             return;
         }
         try {
+            url = new URL(Util.encodeURL(url.toString()));
             uri = url.toURI();
         } catch (URISyntaxException e1) {
             // ignore

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/util/Util.java
Tue Aug 17 18:38:42 2010
@@ -324,7 +324,53 @@ public final class Util {
         }
         return result.toString();
     }
-	
+
+
+    /**
+     * Encode the given url string as RFC-1738 required.
+     * 
+     * @param urlString
+     * @return encoded URL string
+     */
+    public static String encodeURL(String urlStr) {
+        String digits = "0123456789ABCDEF"; //$NON-NLS-1$
+
+        StringBuilder buf = new StringBuilder(urlStr.length() + 16);
+        for (int i = 0; i < urlStr.length(); i++) {
+            char ch = urlStr.charAt(i);
+            if ('%' == ch) {
+                if (i + 1 < urlStr.length()
+                        && i + 2 < urlStr.length()
+                        && digits.indexOf(Character.toUpperCase(urlStr
+                                .charAt(i + 1))) != -1
+                        && digits.indexOf(Character.toUpperCase(urlStr
+                                .charAt(i + 2))) != -1) {
+                    buf.append(ch);
+                    buf.append(urlStr.charAt(i + 1));
+                    buf.append(urlStr.charAt(i + 2));
+                    i += 2;
+                } else {
+                    buf.append("%25"); //$NON-NLS-1$
+                }
+            } else if ("\"<>%\\^[]`+$,{}`~| ".indexOf(ch) == -1) { //$NON-NLS-1$
+                buf.append(ch);
+            } else {
+                byte[] bytes = null;
+                try {
+                    bytes = new String(new char[] { ch }).getBytes("UTF-8"); //$NON-NLS-1$
+                } catch (UnsupportedEncodingException e) {
+                    throw new AssertionError(e);
+                }
+                for (int j = 0; j < bytes.length; j++) {
+                    buf.append('%');
+                    buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
+                    buf.append(digits.charAt(bytes[j] & 0xf));
+                }
+            }
+        }
+        return buf.toString();
+    }
+
 	public static String toASCIILowerCase(String s) {
         int len = s.length();
 		StringBuilder buffer = new StringBuilder(len);

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
Tue Aug 17 18:38:42 2010
@@ -23,6 +23,12 @@
 #include "socket.h"
 #include "harmonyglob.h"
 
+#if defined(WIN32) || defined(WIN64)
+#if !defined(ECONNABORTED)
+#define ECONNABORTED WSAECONNABORTED
+#endif
+#endif
+
 void setSocketImplPort(JNIEnv * env, jobject socketImpl, U_16 hPort);
 void setSocketImplAddress(JNIEnv * env, jobject socketImpl,
                           jobject anInetAddress);
@@ -717,49 +723,6 @@ Java_org_apache_harmony_luni_platform_OS
   }
 }
 
-
-/*
- * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    accept
- * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptSocketImpl
-  (JNIEnv * env, jobject thiz, jobject fileDescriptorServer,
-   jobject socketImpl, jobject fileDescriptorSocketImpl, jint timeout)
-{
-  PORT_ACCESS_FROM_ENV(env);
-  I_32 result;
-  hysocket_t socketS, socketNew;
-  hysockaddr_struct sockaddrP;
-  jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
-
-  result = pollSelectRead(env, fileDescriptorServer, timeout, TRUE);
-
-  if (0 > result) {
-    return;
-  }
-
-  socketS =
-    getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptorServer);
-  if (!hysock_socketIsValid(socketS)) {
-    throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
-    return;
-  }
-
-  hysock_sockaddr_init6(&sockaddrP, (U_8 *) nlocalAddrBytes,
-                        HYSOCK_INADDR_LEN, HYADDR_FAMILY_AFINET4, 0, 0, 0,
-                        socketS);
-
-  result = hysock_accept(socketS, &sockaddrP, &socketNew);
-  if (0 != result) {
-    throwJavaNetBindException(env, result);
-  } else {
-    updateSocket(env, &sockaddrP, socketNew, socketImpl,
-                 fileDescriptorSocketImpl);
-  }
-}
-
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    supportsUrgentData
@@ -1697,6 +1660,7 @@ Java_org_apache_harmony_luni_platform_OS
   hysockaddr_struct sockaddrP;
   jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
 
+  select_accept:
   result = pollSelectRead(env, fdServer, timeout, TRUE);
   if (0 > result) {
     return;
@@ -1714,8 +1678,13 @@ Java_org_apache_harmony_luni_platform_OS
 
   result = hysock_accept(socketS, &sockaddrP, &socketNew);
   if (0 != result) {
-    throwJavaNetBindException(env, result);
-    return;
+    // repeat accept if the server was reset
+    if (errno == ECONNABORTED) {
+      goto select_accept;
+    } else {
+      throwJavaNetSocketException(env, result);
+      return;
+    }
   }
 
   updateSocket(env, &sockaddrP, socketNew, socketImpl, fdSocketImpl);

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/luniglob.c
Tue Aug 17 18:38:42 2010
@@ -132,7 +132,7 @@ JNI_OnLoad (JavaVM * vm, void *reserved)
        (*vmInterface)->GetSystemProperty (vmInterface, "user.language", &propVal);
        if (propVal == NULL) {
             /* FIXME provide appropriate non-dummy value */
-           propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.language",
"en");
+           propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.language",
(char *)hynls_get_language());
            if (VMI_ERROR_NONE != propRes) {
                /* goto fail2; */
            }
@@ -140,7 +140,7 @@ JNI_OnLoad (JavaVM * vm, void *reserved)
        (*vmInterface)->GetSystemProperty (vmInterface, "user.country", &propVal);
        if (propVal == NULL) {
            /* FIXME provide appropriate non-dummy value */
-           propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.country", "US");
+           propRes = (*vmInterface)->SetSystemProperty (vmInterface, "user.country", (char
*)hynls_get_region());
            if (VMI_ERROR_NONE != propRes) {
                /* goto fail2; */
            }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
Tue Aug 17 18:38:42 2010
@@ -466,6 +466,34 @@ public class HttpURLConnectionTest exten
     }
 
     /**
+     * @tests the url with space
+     */
+    public void testConnectWithSpaceinURL() throws Exception {
+        String jettyURLwithSpace = "http://localhost:" + jettyPort
+                + "/servlet with space";
+        HttpURLConnection httpURLConnect = (HttpURLConnection) new URL(
+                jettyURLwithSpace).openConnection();
+        httpURLConnect.setDoOutput(true);
+        httpURLConnect.connect();
+        assertEquals(200, httpURLConnect.getResponseCode());
+        assertEquals("OK", httpURLConnect.getResponseMessage());
+    }
+
+    /**
+     * @tests the url with space
+     */
+    public void testConnectWithSpaceinURL1() throws Exception {
+        String jettyURLwithSpace = "http://localhost:" + jettyPort
+                + "/servlet with space?arg1=value>1&arg2=%aval%1Aue&arg3=#";
+        HttpURLConnection httpURLConnect = (HttpURLConnection) new URL(
+                jettyURLwithSpace).openConnection();
+        httpURLConnect.setDoOutput(true);
+        httpURLConnect.connect();
+        assertEquals(200, httpURLConnect.getResponseCode());
+        assertEquals("OK", httpURLConnect.getResponseMessage());
+    }
+
+    /**
      * @tests org.apache.harmony.luni.internal.net.www.http.getOutputStream()
      */
     public void testGetOutputStream() throws Exception {

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.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/lang/String2Test.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
Tue Aug 17 18:38:42 2010
@@ -544,7 +544,7 @@ public class String2Test extends junit.f
     public void test_indexOfI() {
         // Test for method int java.lang.String.indexOf(int)
         assertEquals("Invalid index returned", 1, hw1.indexOf('e'));
-
+        assertEquals("Invalid index returned", 1, "a\ud800\udc00".indexOf(0x10000));
     }
 
     /**
@@ -553,7 +553,7 @@ public class String2Test extends junit.f
     public void test_indexOfII() {
         // Test for method int java.lang.String.indexOf(int, int)
         assertEquals("Invalid character index returned", 5, hw1.indexOf('W', 2));
-
+        assertEquals("Invalid index returned", 2, "ab\ud800\udc00".indexOf(0x10000, 1));
     }
 
     /**
@@ -595,7 +595,8 @@ public class String2Test extends junit.f
         assertEquals("Failed to return correct index", 5, hw1.lastIndexOf('W'));
         assertEquals("Returned index for non-existent char", -1, hw1
                 .lastIndexOf('Z'));
-
+        assertEquals("Failed to return correct index", 1, "a\ud800\udc00"
+                .lastIndexOf(0x10000));
     }
 
     /**

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.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/URLTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
Tue Aug 17 18:38:42 2010
@@ -249,6 +249,19 @@ public class URLTest extends TestCase {
         assertTrue("u10 returns a wrong port " + u10.getPort(),
                 u10.getPort() == -1);
 
+		URL u11 = new URL("file:////file.txt");
+        assertNull("u11 returns a wrong authority " + u11.getAuthority(), u11
+                .getAuthority());
+        assertTrue("u11 returns a wrong file " + u11.getFile(), u11.getFile()
+                .equals("////file.txt"));
+
+        URL u12 = new URL("file:///file.txt");
+        assertTrue("u12 returns a wrong authority", u12.getAuthority().equals(
+                ""));
+        assertTrue("u12 returns a wrong file " + u12.getFile(), u12.getFile()
+                .equals("/file.txt"));
+
+
         // test for error catching
 
         // Bad HTTP format - no "//"

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/DateTest.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/util/DateTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/DateTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/DateTest.java
Tue Aug 17 18:38:42 2010
@@ -471,7 +471,7 @@ public class DateTest extends junit.fram
         TimeZone.setDefault(TimeZone.getTimeZone("MST"));
         Date d2 = new Date(108, 7, 27);
         assertTrue("Returned incorrect string: " + d2, d2.toString()
-                .startsWith("Wed Aug 27 00:00:00 MST")
+                .startsWith("Wed Aug 27 00:00:00")
                 && d2.toString().endsWith("2008"));
 	}
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.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/util/ScannerTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
Tue Aug 17 18:38:42 2010
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
 import java.io.StringReader;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -37,8 +38,10 @@ import java.nio.channels.FileChannel;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.SocketChannel;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.InputMismatchException;
+import java.util.List;
 import java.util.Locale;
 import java.util.NoSuchElementException;
 import java.util.Scanner;
@@ -5614,7 +5617,6 @@ public class ScannerTest extends TestCas
      * @tests java.util.Scanner#hasNextLine()
      */
     public void test_hasNextLine() {
-        
         s = new Scanner("");
         s.close();
         try {
@@ -5682,7 +5684,40 @@ public class ScannerTest extends TestCas
         assertEquals(0, matchResult.start());
         assertEquals(1, matchResult.end());
     }
-    
+
+    public void test_hasNextLine_sequence() throws IOException {
+        final PipedInputStream pis = new PipedInputStream();
+        final PipedOutputStream pos = new PipedOutputStream();
+        final Scanner scanner = new Scanner(pis);
+        pis.connect(pos);
+        final List<String> result = new ArrayList<String>();
+        Thread thread = new Thread(new Runnable() {
+            public void run() {
+                while (scanner.hasNextLine()) {
+                    result.add(scanner.nextLine());
+                }
+            }
+        });
+        thread.start();
+        for (int index = 0; index < 5; index++) {
+            pos.write(("line" + index + "\n").getBytes());
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                // Ignored
+            }
+            assertEquals(index + 1, result.size());
+        }
+        pis.close();
+        pos.close();
+        try {
+            thread.join(1000);
+        } catch (InterruptedException e) {
+            // Ignored
+        }
+        assertFalse(scanner.hasNextLine());
+    }
+
     protected void setUp() throws Exception {
         super.setUp();
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/util/UtilTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/util/UtilTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/util/UtilTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/util/UtilTest.java
Tue Aug 17 18:38:42 2010
@@ -55,4 +55,12 @@ public class UtilTest extends TestCase {
         }
     }
 
+    public void testEncodeURL() {
+        assertEquals("http://test.com/%25", Util.encodeURL("http://test.com/%"));
+        assertEquals("http://test.com/%250", Util.encodeURL("http://test.com/%0"));
+        assertEquals("http://test.com/%2b", Util.encodeURL("http://test.com/%2b"));
+        assertEquals("http://test.com/%2b/index", Util.encodeURL("http://test.com/%2b/index"));
+        assertEquals("http://test.com/%252z", Util.encodeURL("http://test.com/%2z"));
+        assertEquals("http://test.com/with%20space", Util.encodeURL("http://test.com/with
space"));
+    }
 }

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
Tue Aug 17 18:38:42 2010
@@ -43,17 +43,17 @@ public class SyncFactory {
     /**
      * The property name for the synchronization provider's implementation class.
      */
-    public static final String ROWSET_SYNC_PROVIDER = "rowset.provider.classname"; //$NON-NLS-1$
+    public static String ROWSET_SYNC_PROVIDER = "rowset.provider.classname"; //$NON-NLS-1$
 
     /**
      * The property name for the synchronization provider's vendor name.
      */
-    public static final String ROWSET_SYNC_VENDOR = "rowset.provider.vendor"; //$NON-NLS-1$
+    public static String ROWSET_SYNC_VENDOR = "rowset.provider.vendor"; //$NON-NLS-1$
 
     /**
      * The property name for the synchronization provider's version information.
      */
-    public static final String ROWSET_SYNC_PROVIDER_VERSION = "rowset.provider.version";
//$NON-NLS-1$
+    public static String ROWSET_SYNC_PROVIDER_VERSION = "rowset.provider.version"; //$NON-NLS-1$
 
     private static SyncFactory instance = new SyncFactory();
 

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java
Tue Aug 17 18:38:42 2010
@@ -21,27 +21,27 @@ import javax.sql.RowSetReader;
 import javax.sql.RowSetWriter;
 
 public abstract class SyncProvider {
-    public static final int GRADE_NONE = 1;
+    public static int GRADE_NONE = 1;
 
-    public static final int GRADE_CHECK_MODIFIED_AT_COMMIT = 2;
+    public static int GRADE_CHECK_MODIFIED_AT_COMMIT = 2;
 
-    public static final int GRADE_CHECK_ALL_AT_COMMIT = 3;
+    public static int GRADE_CHECK_ALL_AT_COMMIT = 3;
 
-    public static final int GRADE_LOCK_WHEN_MODIFIED = 4;
+    public static int GRADE_LOCK_WHEN_MODIFIED = 4;
 
-    public static final int GRADE_LOCK_WHEN_LOADED = 5;
+    public static int GRADE_LOCK_WHEN_LOADED = 5;
 
-    public static final int DATASOURCE_NO_LOCK = 1;
+    public static int DATASOURCE_NO_LOCK = 1;
 
-    public static final int DATASOURCE_ROW_LOCK = 2;
+    public static int DATASOURCE_ROW_LOCK = 2;
 
-    public static final int DATASOURCE_TABLE_LOCK = 3;
+    public static int DATASOURCE_TABLE_LOCK = 3;
 
-    public static final int DATASOURCE_DB_LOCK = 4;
+    public static int DATASOURCE_DB_LOCK = 4;
 
-    public static final int UPDATABLE_VIEW_SYNC = 5;
+    public static int UPDATABLE_VIEW_SYNC = 5;
 
-    public static final int NONUPDATABLE_VIEW_SYNC = 6;
+    public static int NONUPDATABLE_VIEW_SYNC = 6;
 
     public SyncProvider() {
         super();

Modified: harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java?rev=986447&r1=986446&r2=986447&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
(original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/FilteredRowSetTest.java
Tue Aug 17 18:38:42 2010
@@ -889,7 +889,7 @@ class RangeThree implements Predicate {
 class OddRowFilter implements Predicate {
     public boolean evaluate(RowSet rs) {
         try {
-            return rs.getInt(1) % 2 == 1;
+            return (rs.getInt(1) & 1) == 1;
         } catch (SQLException e) {
             // do nothing
         }

Propchange: harmony/enhanced/java/branches/mrh/common_resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 17 18:38:42 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh/common_resources:935751
-/harmony/enhanced/java/trunk/common_resources:935751-964042
+/harmony/enhanced/java/trunk/common_resources:935751-964765,964786
 /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 Aug 17 18:38:42 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751
-/harmony/enhanced/java/trunk/drlvm:935751-964042
+/harmony/enhanced/java/trunk/drlvm:935751-964765,964786
 /harmony/enhanced/trunk/drlvm:476395-926313
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/working_vm:423974-476394



Mime
View raw message