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/04/29 22:14:02 UTC
svn commit: r939473 - in /harmony/enhanced/java/branches/mrh: ./ classlib/
classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/
classlib/modules/luni/src/main/java/java/io/
classlib/modules/luni/src/main/java/org/apache/har...
Author: hindessm
Date: Thu Apr 29 20:14:01 2010
New Revision: 939473
URL: http://svn.apache.org/viewvc?rev=939473&view=rev
Log:
Merging changes from trunk@938409
Modified:
harmony/enhanced/java/branches/mrh/ (props changed)
harmony/enhanced/java/branches/mrh/classlib/ (props changed)
harmony/enhanced/java/branches/mrh/classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/InstrumentationImpl.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSFileSystem.c
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/exports.txt
harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.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/FileChannelTest.java
harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
harmony/enhanced/java/branches/mrh/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
harmony/enhanced/java/branches/mrh/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.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 Thu Apr 29 20:14:01 2010
@@ -1 +1 @@
-/harmony/enhanced/java/trunk:935751-936843
+/harmony/enhanced/java/trunk:935751-938409
Propchange: harmony/enhanced/java/branches/mrh/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 29 20:14:01 2010
@@ -1,2 +1,2 @@
/harmony/enhanced/classlib/trunk:926318-926838
-/harmony/enhanced/java/trunk/classlib:935751-936843
+/harmony/enhanced/java/trunk/classlib:935751-938409
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/InstrumentationImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/InstrumentationImpl.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/InstrumentationImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/instrument/src/main/java/org/apache/harmony/instrument/internal/InstrumentationImpl.java Thu Apr 29 20:14:01 2010
@@ -22,6 +22,7 @@ import java.lang.instrument.ClassFileTra
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
import java.lang.reflect.Method;
+import java.io.UnsupportedEncodingException;
import java.security.ProtectionDomain;
import org.apache.harmony.instrument.internal.nls.Messages;
@@ -185,7 +186,7 @@ public class InstrumentationImpl impleme
byte[] source = classfileBuffer;
byte[] result = null;
byte[] trans = null;
- String className = new String(classNameBytes);
+ String className = utf8BytesToString(classNameBytes);
for (ClassFileTransformer t : transformers) {
try {
trans = t.transform(loader, className, classBeingRedefined,
@@ -207,10 +208,10 @@ public class InstrumentationImpl impleme
private void executePremain(byte[] className, byte[] options) {
try {
ClassLoader loader = ClassLoader.getSystemClassLoader();
- Class c = loader.loadClass(new String(className));
+ Class c = loader.loadClass(utf8BytesToString(className));
Method method = c.getMethod("premain", PREMAIN_SIGNATURE); //$NON-NLS-1$
method.invoke(null, new Object[] {
- null == options ? null : new String(options), this });
+ null == options ? null : utf8BytesToString(options), this });
} catch (Exception e) {
e.printStackTrace();
System.err
@@ -218,4 +219,18 @@ public class InstrumentationImpl impleme
System.exit(1);
}
}
+
+ private static String utf8BytesToString(byte[] bytes) {
+ if (bytes == null) {
+ return null;
+ }
+
+ try {
+ return new String(bytes, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // should never happen
+ throw new RuntimeException(e);
+ }
+ }
+
}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java Thu Apr 29 20:14:01 2010
@@ -262,15 +262,7 @@ public class RandomAccessFile implements
*/
public long length() throws IOException {
openCheck();
- synchronized (repositionLock) {
- long currentPosition = fileSystem.seek(fd.descriptor, 0L,
- IFileSystem.SEEK_CUR);
- long endOfFilePosition = fileSystem.seek(fd.descriptor, 0L,
- IFileSystem.SEEK_END);
- fileSystem.seek(fd.descriptor, currentPosition,
- IFileSystem.SEEK_SET);
- return endOfFilePosition;
- }
+ return fileSystem.size(fd.descriptor);
}
/**
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/Environment.java Thu Apr 29 20:14:01 2010
@@ -16,6 +16,7 @@
package org.apache.harmony.luni.platform;
+import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -63,11 +64,16 @@ public class Environment {
* @return the value of the environment variable specified
*/
public static String getenv(String name) {
- byte[] env = getEnvByName(name.getBytes());
- if (null == env) {
- return null;
- }
- return new String(env);
+ try {
+ byte[] env = getEnvByName(name.getBytes("UTF-8"));
+ if (null == env) {
+ return null;
+ }
+ return new String(env, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // UTF-8 should always be supported so this should not be reached
+ throw new RuntimeException(e);
+ }
}
public static class EnvironmentMap extends HashMap<String, String> {
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java Thu Apr 29 20:14:01 2010
@@ -105,6 +105,8 @@ public interface IFileSystem {
public long ttyAvailable() throws IOException;
public long available(long fileDescriptor) throws IOException;
+
+ public long size(long fileDescriptor) throws IOException;
public long ttyRead(byte[] bytes, int offset, int length) throws IOException;
}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java Thu Apr 29 20:14:01 2010
@@ -277,6 +277,16 @@ class OSFileSystem implements IFileSyste
private native long availableImpl(long fileDescriptor);
+ public long size(long fileDescriptor) throws IOException {
+ long nChar = sizeImpl(fileDescriptor);
+ if (nChar < 0) {
+ throw new IOException();
+ }
+ return nChar;
+ }
+
+ private native long sizeImpl(long fileDescriptor);
+
public long ttyRead(byte[] bytes, int offset, int length) throws IOException {
long nChar = ttyReadImpl(bytes, offset, length);
if (nChar < 0) {
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSFileSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSFileSystem.c?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSFileSystem.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/shared/OSFileSystem.c Thu Apr 29 20:14:01 2010
@@ -285,11 +285,11 @@ JNIEXPORT jlong JNICALL Java_org_apache_
}
/*
- * Answers the number of remaining chars in the stdin.
+ * Answers the number of remaining chars on the file descriptor.
*
* Class: org_apache_harmony_luni_platform_OSFileSystem
- * Method: AvailableImpl
- * Signature: ()J
+ * Method: availableImpl
+ * Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSFileSystem_availableImpl
(JNIEnv *env, jobject thiz, jlong fd)
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c Thu Apr 29 20:14:01 2010
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <sys/stat.h>
#if defined(FREEBSD) || defined(AIX) || defined(ZOS) || defined(MACOSX)
#include <sys/types.h>
#include <sys/socket.h>
@@ -187,7 +188,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
(*env)->ReleaseIntArrayElements(env, jlengths, lengths, JNI_ABORT);
}
hymem_free_memory(vectors);
- return totalRead;
+ return totalRead == 0 ? -1 : totalRead;
}
/*
@@ -338,3 +339,21 @@ JNIEXPORT jlong JNICALL Java_org_apache_
#endif
#endif
}
+
+
+/*
+ * Answers the size of the file pointed to by the file descriptor.
+ *
+ * Class: org_apache_harmony_luni_platform_OSFileSystem
+ * Method: sizeImpl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSFileSystem_sizeImpl
+(JNIEnv *env, jobject thiz, jlong fd)
+{
+ struct stat statbuf;
+ if (fstat(fd - FD_BIAS, &statbuf) < 0) {
+ return -1;
+ }
+ return (jlong)statbuf.st_size;
+}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/exports.txt?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/exports.txt (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/unix/exports.txt Thu Apr 29 20:14:01 2010
@@ -138,6 +138,7 @@ Java_org_apache_harmony_luni_platform_OS
Java_org_apache_harmony_luni_platform_OSFileSystem_transferImpl
Java_org_apache_harmony_luni_platform_OSFileSystem_ttyAvailableImpl
Java_org_apache_harmony_luni_platform_OSFileSystem_availableImpl
+Java_org_apache_harmony_luni_platform_OSFileSystem_sizeImpl
Java_org_apache_harmony_luni_platform_OSFileSystem_ttyReadImpl
Java_org_apache_harmony_luni_platform_OSMemory_isLoadedImpl
Java_org_apache_harmony_luni_platform_OSMemory_loadImpl
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c Thu Apr 29 20:14:01 2010
@@ -296,3 +296,21 @@ JNIEXPORT jlong JNICALL Java_org_apache_
return count;
}
+/*
+ * Answers the size of the file pointed to by the file descriptor.
+ *
+ * Class: org_apache_harmony_luni_platform_OSFileSystem
+ * Method: sizeImpl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSFileSystem_sizeImpl
+(JNIEnv *env, jobject thiz, jlong fd)
+{
+ BY_HANDLE_FILE_INFORMATION info;
+ HANDLE hfile = (HANDLE)fd;
+ if (GetFileInformationByHandle(hfile, (LPBY_HANDLE_FILE_INFORMATION) &info)) {
+ return (jlong) ((info.nFileSizeHigh<<0x20) + info.nFileSizeLow);
+ } else {
+ return (jlong)-1;
+ }
+}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java Thu Apr 29 20:14:01 2010
@@ -298,15 +298,9 @@ public abstract class FileChannelImpl ex
throw new IndexOutOfBoundsException();
}
openCheck();
- for (int i = offset; i < offset + length; i++) {
- count += buffers[i].remaining();
- }
- if (0 == count) {
+ if (calculateTotalRemaining(buffers, offset, length) == 0) {
return 0;
}
- if (size() == 0) {
- return -1;
- }
ByteBuffer[] directBuffers = new ByteBuffer[length];
long[] handles = new long[length];
int[] offsets = new int[length];
@@ -376,14 +370,7 @@ public abstract class FileChannelImpl ex
*/
public long size() throws IOException {
openCheck();
- synchronized (repositioningLock) {
- long currentPosition = fileSystem.seek(handle, 0L,
- IFileSystem.SEEK_CUR);
- long endOfFilePosition = fileSystem.seek(handle, 0L,
- IFileSystem.SEEK_END);
- fileSystem.seek(handle, currentPosition, IFileSystem.SEEK_SET);
- return endOfFilePosition;
- }
+ return fileSystem.size(handle);
}
public long transferFrom(ReadableByteChannel src, long position, long count)
@@ -570,11 +557,7 @@ public abstract class FileChannelImpl ex
throw new IndexOutOfBoundsException();
}
openCheck();
- long count = 0;
- for (int i = offset; i < offset + length; i++) {
- count += sources[i].remaining();
- }
- if (0 == count) {
+ if (calculateTotalRemaining(sources, offset, length) == 0) {
return 0;
}
Object[] src = new Object[length];
@@ -634,4 +617,13 @@ public abstract class FileChannelImpl ex
public long getHandle() {
return handle;
}
+
+ private int calculateTotalRemaining(ByteBuffer[] buffers, int offset,
+ int length) {
+ int count = 0;
+ for (int i = offset; i < offset + length; i++) {
+ count += buffers[i].remaining();
+ }
+ return count;
+ }
}
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=939473&r1=939472&r2=939473&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 Thu Apr 29 20:14:01 2010
@@ -399,7 +399,7 @@ class SocketChannelImpl extends SocketCh
}
checkOpenConnected();
- int totalCount = calculateByteBufferArray(targets, offset, length);
+ int totalCount = calculateTotalRemaining(targets, offset, length);
if (0 == totalCount) {
return 0;
}
@@ -491,11 +491,7 @@ class SocketChannelImpl extends SocketCh
}
checkOpenConnected();
- long count = 0;
- for (int i = offset; i < offset + length; i++) {
- count += sources[i].remaining();
- }
- if (0 == count) {
+ if (calculateTotalRemaining(sources, offset, length) == 0) {
return 0;
}
@@ -569,13 +565,13 @@ class SocketChannelImpl extends SocketCh
return writeCount;
}
- private int calculateByteBufferArray(ByteBuffer[] sources, int offset,
+ private int calculateTotalRemaining(ByteBuffer[] buffers, int offset,
int length) {
- int sum = 0;
- for (int val = offset; val < offset + length; val++) {
- sum = sum + sources[val].remaining();
+ int count = 0;
+ for (int i = offset; i < offset + length; i++) {
+ count += buffers[i].remaining();
}
- return sum;
+ return count;
}
/*
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.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/FileChannelTest.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.java Thu Apr 29 20:14:01 2010
@@ -516,6 +516,21 @@ public class FileChannelTest extends Tes
writeDataToFile(fileOfReadOnlyFileChannel);
assertEquals(fileOfReadOnlyFileChannel.length(), readOnlyFileChannel
.size());
+
+
+ // REGRESSION test for read(ByteBuffer[], int, int) on special files
+ try {
+ FileChannel specialFile =
+ new FileInputStream("/dev/zero").getChannel();
+ assertEquals(0, specialFile.size());
+ ByteBuffer buf = ByteBuffer.allocate(8);
+ assertEquals(8, specialFile.read(buf));
+ ByteBuffer[] bufs = { ByteBuffer.allocate(8) };
+ assertEquals(8, specialFile.read(bufs, 0, 1));
+ specialFile.close();
+ } catch (FileNotFoundException e) {
+ // skip test if special file doesn't exist
+ }
}
/**
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java Thu Apr 29 20:14:01 2010
@@ -84,6 +84,11 @@ public class ConnectionTest extends RMIT
* If some error occurs.
*/
public void testDirectSocket_SingleVM() throws Exception {
+ if (checkSocket("127.0.0.1", REGISTRY_PORT, TIMEOUT_TICK*3)) {
+ System.err.println("Registry DEFAULT port ("
+ + REGISTRY_PORT + ") in use, skipping tests.");
+ return;
+ }
System.err.println("testDirectSocket_SingleVM starting");
testSingleVM(CONFIG_DIRECT_SOCKET, true);
}
@@ -96,6 +101,11 @@ public class ConnectionTest extends RMIT
* If some error occurs.
*/
public void testDirectHTTP_SingleVM() throws Exception {
+ if (checkSocket("127.0.0.1", REGISTRY_PORT, TIMEOUT_TICK*3)) {
+ System.err.println("Registry DEFAULT port ("
+ + REGISTRY_PORT + ") in use, skipping tests.");
+ return;
+ }
System.err.println("testDirectHTTP_SingleVM starting");
testSingleVM(CONFIG_DIRECT_HTTP, true);
}
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java Thu Apr 29 20:14:01 2010
@@ -96,6 +96,13 @@ public class RegistryTest extends RMITes
// Create registry.
int port = REGISTRY_PORT;
+
+ if (checkSocket("127.0.0.1", port, TIMEOUT_TICK*3)) {
+ System.err.println("Registry DEFAULT port ("
+ + port + ") in use, skipping tests.");
+ return;
+ }
+
Registry reg = LocateRegistry.createRegistry(port);
System.out.println("Registry on DEFAULT port ("
+ port + ") created.");
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java Thu Apr 29 20:14:01 2010
@@ -271,7 +271,16 @@ public class DefaultPolicyScanner {
st.nextToken();
}
if (st.ttype == '"') {
- pe.name = st.sval;
+ StringBuilder sb = new StringBuilder();
+ String[] elements = st.sval.split("[,]"); //$NON-NLS-1$
+ int endIndex = elements.length - 1;
+ for (int index = 0; index < endIndex; index++) {
+ sb.append(elements[index].trim() + ',');
+ }
+ if (endIndex > -1) {
+ sb.append(elements[endIndex].trim());
+ }
+ pe.name = sb.toString();
} else if (st.ttype == '*') {
pe.name = PrincipalEntry.WILDCARD;
} else {
Modified: harmony/enhanced/java/branches/mrh/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java?rev=939473&r1=939472&r2=939473&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java (original)
+++ harmony/enhanced/java/branches/mrh/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java Thu Apr 29 20:14:01 2010
@@ -264,6 +264,10 @@ public class DefaultPolicyScannerTest ex
pe = scanner.readPrincipalEntry(getST("clazz *"));
assertEquals(DefaultPolicyScanner.PrincipalEntry.WILDCARD, pe.name);
assertEquals("clazz", pe.klass);
+
+ pe = scanner.readPrincipalEntry(getST("\"a, b, c, d\""));
+ assertEquals("a,b,c,d", pe.name);
+ assertNull(pe.klass);
}
/**
Propchange: harmony/enhanced/java/branches/mrh/common_resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 29 20:14:01 2010
@@ -1,3 +1,3 @@
-/harmony/enhanced/java/trunk/common_resources:935751-936843
+/harmony/enhanced/java/trunk/common_resources:935751-938409
/harmony/enhanced/trunk/common_resources:476396-920147
/incubator/harmony/enhanced/trunk/common_resources:423974-476394
Propchange: harmony/enhanced/java/branches/mrh/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 29 20:14:01 2010
@@ -1,3 +1,3 @@
-/harmony/enhanced/java/trunk/drlvm:935751-936843
+/harmony/enhanced/java/trunk/drlvm:935751-938409
/harmony/enhanced/trunk/working_vm:476396-920147
/incubator/harmony/enhanced/trunk/working_vm:423974-476394