diff --git a/packages/farcry/javaloader/JavaLoader.cfc b/packages/farcry/javaloader/JavaLoader.cfc index f28900db1..d2b8764ff 100644 --- a/packages/farcry/javaloader/JavaLoader.cfc +++ b/packages/farcry/javaloader/JavaLoader.cfc @@ -17,7 +17,6 @@ Purpose: Utlitity class for loading Java Classes instance.static.uuid = "A0608BEC-0AEB-B46A-0E1E1EC5F3CE7C9C"; - @@ -97,8 +96,122 @@ Purpose: Utlitity class for loading Java Classes + + + + + + + + var local = {}; + var func = 0; //need this as cf8 doesn't like the structure with functions. + var System = createObject("java", "java.lang.System"); + var Thread = createObject("java", "java.lang.Thread"); + var currentClassloader = Thread.currentThread().getContextClassLoader(); + var classLoader = ""; + + if (structCount(arguments) == 4) + { + // the last 2 arguments are the function arguments and class loader + classLoader = arguments[4]; + local.funcArgs = arguments[3]; + } + else if (structCount(arguments) == 3) + { + // 2nd argument could be classloader or function arguments + if (isInstanceOf(arguments[2],"java.lang.ClassLoader")) + { + classLoader = arguments[2]; + } + else if (isStruct(arguments[2])) + { + local.funcArgs = arguments[2]; + } + + // 3rd argument could be classloader or function arguments + if (isInstanceOf(arguments[3],"java.lang.ClassLoader")) + { + classLoader = arguments[3]; + } + else if (isStruct(arguments[3])) + { + local.funcArgs = arguments[3]; + } + } + else if (structCount(arguments) == 2) + { + // the 2nd argument could be a class loader or function arguments + if (isInstanceOf(arguments[2],"java.lang.ClassLoader")) + { + classLoader = arguments[2]; + } + else if (isStruct(arguments[2])) + { + local.funcArgs = arguments[2]; + } + } + + if (!structKeyExists(local,"funcArgs")) + { + local.funcArgs = {}; + } + + if (isSimpleValue(classLoader)) + { + classLoader = getURLClassLoader(); + } + + + + + Thread.currentThread().setContextClassLoader(classloader); + + + + + + + func = arguments[1]; + local.return = func(argumentCollection = local.funcArgs); + + + + + + + + + + Thread.currentThread().setContextClassLoader(currentClassloader); + + + + + + + //need to do this twice, as cf8 has no finally. + Thread.currentThread().setContextClassLoader(currentClassloader); + + if(structKeyExists(local, "return")) + { + return local.return; + } + + + - + @@ -201,7 +314,7 @@ Purpose: Utlitity class for loading Java Classes for(; counter lte len; counter = counter + 1) { dir = directories[counter]; - directoryCopy(dir, path); + $directoryCopy(dir, path); } //then we compile it, and grab that jar @@ -256,10 +369,9 @@ Purpose: Utlitity class for loading Java Classes var counter = 0; - - @@ -364,11 +476,11 @@ Purpose: Utlitity class for loading Java Classes - libName = ListGetAt(name, 1, "-"); + libName = ListGetAt(qJars.name, 1, "-"); //let's not use the lib's that have the same name, but a lower datestamp if(NOT ListFind(jarList, libName)) { - ArrayAppend(aJars, path & "/" & name); + ArrayAppend(aJars, path & "/" & qJars.name); jarList = ListAppend(jarList, libName); } @@ -377,10 +489,6 @@ Purpose: Utlitity class for loading Java Classes - - - - @@ -474,7 +582,7 @@ Copies a directory. @author Joe Rinehart (joe.rinehart@gmail.com) @version 1, July 27, 2005 ---> - + @@ -492,9 +600,9 @@ Copies a directory. - + - \ No newline at end of file + diff --git a/packages/farcry/javaloader/JavaProxy.cfc b/packages/farcry/javaloader/JavaProxy.cfc index 3f1b81225..8da0d2dc3 100644 --- a/packages/farcry/javaloader/JavaProxy.cfc +++ b/packages/farcry/javaloader/JavaProxy.cfc @@ -121,16 +121,16 @@ Mark Mandel 27/08/2007 Created - + - var len = StructCount(arguments); + var len = StructCount(args); var objArray = _getArray().newInstance(_getObjectClass(), len); var counter = 1; var obj = 0; for(; counter <= len; counter++) { - obj = arguments[counter]; + obj = args[counter]; _getArray().set(objArray, counter - 1, obj); } diff --git a/packages/farcry/javaloader/lib/classloader-20100119110136.jar b/packages/farcry/javaloader/lib/classloader-20100119110136.jar deleted file mode 100644 index 0e3292223..000000000 Binary files a/packages/farcry/javaloader/lib/classloader-20100119110136.jar and /dev/null differ diff --git a/packages/farcry/javaloader/lib/classloader-20120103162851.jar b/packages/farcry/javaloader/lib/classloader-20120103162851.jar new file mode 100644 index 000000000..ea070000c Binary files /dev/null and b/packages/farcry/javaloader/lib/classloader-20120103162851.jar differ diff --git a/packages/farcry/javaloader/lib/classloader-src.zip b/packages/farcry/javaloader/lib/classloader-src.zip index 9222b4e3a..e86f27e89 100644 Binary files a/packages/farcry/javaloader/lib/classloader-src.zip and b/packages/farcry/javaloader/lib/classloader-src.zip differ diff --git a/packages/farcry/javaloader/readme.txt b/packages/farcry/javaloader/readme.txt index 706ab91be..271c2081d 100644 --- a/packages/farcry/javaloader/readme.txt +++ b/packages/farcry/javaloader/readme.txt @@ -1,6 +1,6 @@ -JavaLoader v1.0 +JavaLoader v1.2 Author: Mark Mandel -Date: 10 September 2010 +Date: 22 March 2017 Documentation can now be found at: -http://www.compoundtheory.com/javaloader/docs/ \ No newline at end of file +https://github.com/markmandel/JavaLoader/wiki diff --git a/packages/farcry/javaloader/tags/directory.cfm b/packages/farcry/javaloader/tags/directory.cfm deleted file mode 100644 index 3601708e6..000000000 --- a/packages/farcry/javaloader/tags/directory.cfm +++ /dev/null @@ -1,25 +0,0 @@ - - - - - -