Code:
<cfscript>
arrayToSort = [12301,12302,12303,12304,12305];
createObject("java", "java.util.Collections").Shuffle(arrayToSort);
writeDump(arrayToSort);
</cfscript>
private static final int SHUFFLE_THRESHOLD = 5;
...
public static void shuffle(List<?> list, Random rnd) {
int size = list.size();
if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
for (int i=size; i>1; i--)
swap(list, i-1, rnd.nextInt(i));
} else {
Object arr[] = list.toArray();
// Shuffle array
for (int i=size; i>1; i--)
swap(arr, i-1, rnd.nextInt(i));
// Dump array back into list
ListIterator it = list.listIterator();
for (int i=0; i<arr.length; i++) {
it.next();
it.set(arr[i]);
}
}
}
I've checked out the code for 3.2.2.000 from github and tried to build
it in eclipse but I'm running into an error as per below.
I'm using jdk 1.5.0_22 on Windows 7 (32-bit). My "compile server" is
running on Java 6 - not sure if that is a potential issue.
Has anyone come across this before and can help me please?
Regards,
Andrew
Buildfile: C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-master\build.xml
init:
[echo] ***** Start Railo build process. *****
clean:
[echo] Deleting build and dist
getInfo:
[echo] Extracting version information from file src/railo/runtime/Info.ini
[echo] Version is: 3.2.2.000.1.rc
clean:
[echo] Deleting build and dist
clean:
[echo] Deleting build and dist
[delete] Deleting directory
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo\build
master:
[echo] ***** Building railo-loader.jar *****
clean:
[echo] Deleting build and dist
init:
[echo] Creating the build and dist directories.
[mkdir] Created dir:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-loader\build\classes
[mkdir] Created dir:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-loader\dist
compile:
[echo] Compile the RailoLoader src.
[javac] Compiling 192 source files to
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-loader\build\classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
package:
[echo] Packaging the railo-loader.jar file.
[jar] Building jar:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-loader\dist\railo-loader.jar
install:
[echo] Copy the railo-loader.jar to the Railo core lib directory.
[copy] Copying 1 file to
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\libs
[echo] ***** Building Railo core.rc *****
getInfo:
[echo] Extracting version information from file src/railo/runtime/Info.ini
[echo] Version is: 3.2.2.000.1.rc
clean:
[echo] Deleting build and dist
init:
[echo] Creating the build, admin and dist directories.
[mkdir] Created dir:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\build\classes
[mkdir] Created dir:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\build\admin
[mkdir] Created dir:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\dist
compile:
[echo] Compile Railo src.
[javac] Compiling 2149 source files to
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\build\classes
[javac] C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\src\railo\runtime\ComponentImpl.java:234:
reference to ComponentScopeShadow is ambiguous, both method
ComponentScopeShadow(railo.runtime.ComponentImpl,java.util.Map<railo.runtime.type.Collection.Key,java.lang.Object>)
in railo.runtime.ComponentScopeShadow and method
ComponentScopeShadow(railo.runtime.ComponentImpl,railo.runtime.ComponentScopeShadow)
in railo.runtime.ComponentScopeShadow match
[javac] if(useShadow) trg.scope=new
ComponentScopeShadow(trg,(ComponentScopeShadow)trg.base.scope);
[javac] ^
[javac] C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\src\railo\runtime\ComponentImpl.java:398:
reference to ComponentScopeShadow is ambiguous, both method
ComponentScopeShadow(railo.runtime.ComponentImpl,java.util.Map<railo.runtime.type.Collection.Key,java.lang.Object>)
in railo.runtime.ComponentScopeShadow and method
ComponentScopeShadow(railo.runtime.ComponentImpl,railo.runtime.ComponentScopeShadow)
in railo.runtime.ComponentScopeShadow match
[javac] else scope=new
ComponentScopeShadow(this,(ComponentScopeShadow)base.scope);
[javac] ^
[javac] C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\src\railo\runtime\reflection\Invoker.java:308:
warning: non-varargs call of varargs method with inexact argument type
for last parameter;
[javac] cast to java.lang.Object for a varargs call
[javac] cast to java.lang.Object[] for a non-varargs call and to
suppress this warning
[javac] return m.invoke(o,null);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warning
BUILD FAILED
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-master\build.xml:25:
The following error occurred while executing this line:
C:\Users\andrew\projects\am2605-railo-b57682a\railo-java\railo-core\build.xml:57:
Compile failed; see the compiler error output for details.
Total time: 32 seconds
https://github.com/denuno/railo-build
As it comes with git (jgit) and will detect java 1.5 if you installed
it to the default location (It also has an easy way to set the
location in build/build.xml).
INSTRUCTIONS FOR USE:
Select the "download" link, save it as a zip, and then expand it somewhere.
Double click the "build-railo.bat" file, select option 1, and wait for
a [long] bit as it downloads all the sources.
Wait a bit more for it to compile them (theoretically).
When it's done, you should have a 3.2.2.002.rc file in the ./dist directory.
Apply this change:
https://github.com/getrailo/railo/commit/c5e7281136f227bf9bee3e1dec11df66172f1a23
Edit the build file (build/build.xml) to set the build number to 3.2.2.003
Run railo-build.bat again. Select option 1. (It should be a lot
faster this time since it won't have to DL the sources. If you don't
have compile errors, you can select option 2, and it will fire up the
freshly built version for testing)
Assuming you didn't run into any errors, you then drop the new .rc
file from ./dist into the railo patches dir
(WEB-INF/lib/railo/context/patches IIRC) and restart railo.
And I think that's it. Let us know how you get on, por favor!
:Den
--
Knowledge is recognition of something absent; it is a salutation, not
an embrace.
George Santayana