Skip to content

Commit b096c99

Browse files
authored
Boxlang compat
Fix issue where coldfusion.runtime.java.JavaProxy is not available and use the awesome DynamicObject class instead.
1 parent 389d615 commit b096c99

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

models/javaloader/JavaLoader.cfc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,14 @@
113113
>
114114
<cfargument name="className" hint="The name of the class to create" type="string" required="Yes">
115115
<cfscript>
116-
try {
117-
// do this in one line just for speed.
118-
return createJavaProxy( getURLClassLoader().loadClass( arguments.className ) );
116+
try {
117+
if( server.keyExists( "boxlang" ) ){
118+
// Boxlang's Dynamic object class handles all of our needs - we just need to retrieve the class through the module classloader
119+
return createObject( "java", "ortus.boxlang.runtime.interop.DynamicObject" ).init( getURLClassLoader().loadClass( arguments.className ) );
120+
} else {
121+
// do this in one line just for speed.
122+
return createJavaProxy( getURLClassLoader().loadClass( arguments.className ) );
123+
}
119124
} catch ( java.lang.ClassNotFoundException exc ) {
120125
throwException(
121126
"javaloader.ClassNotFoundException",

0 commit comments

Comments
 (0)