Revision: 3612
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3612&view=rev
Author: spasi
Date: 2011-08-13 19:16:58 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
Replaced Arrays.copyof with custom implementation for Java 5 compatibility.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-13 18:53:54 UTC (rev 3611)
+++ trunk/LWJGL/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2011-08-13 19:16:58 UTC (rev 3612)
@@ -38,7 +38,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
-import java.util.Arrays;
/**
* This classloader is responsible for applying the bytecode transformation to mapped objects.
@@ -167,7 +166,7 @@
try {
while ( true ) {
if ( bytecode.length == len )
- bytecode = Arrays.copyOf(bytecode, len * 2);
+ bytecode = copyOf(bytecode, len * 2);
int got = in.read(bytecode, len, bytecode.length - len);
if ( got == -1 )
break;
@@ -182,7 +181,13 @@
// ignore...
}
}
- return Arrays.copyOf(bytecode, len);
+ return copyOf(bytecode, len);
}
+ private static byte[] copyOf(byte[] original, int newLength) {
+ byte[] copy = new byte[newLength];
+ System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
+ return copy;
+ }
+
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|