diff --git a/src/main/java/ortus/boxlang/modules/compat/bifs/system/GetClientVariablesList.java b/src/main/java/ortus/boxlang/modules/compat/bifs/system/GetClientVariablesList.java index 3ed9162..cc61f17 100644 --- a/src/main/java/ortus/boxlang/modules/compat/bifs/system/GetClientVariablesList.java +++ b/src/main/java/ortus/boxlang/modules/compat/bifs/system/GetClientVariablesList.java @@ -24,7 +24,7 @@ import ortus.boxlang.runtime.scopes.ArgumentsScope; import ortus.boxlang.runtime.scopes.Key; import ortus.boxlang.runtime.types.Argument; -import ortus.boxlang.runtime.types.Array; +import ortus.boxlang.runtime.types.util.BLCollector; import ortus.boxlang.runtime.types.util.ListUtil; @BoxBIF @@ -55,24 +55,15 @@ public Object _invoke( IBoxContext context, ArgumentsScope arguments ) { return ""; } - Array vars = new Array(); - for ( Key key : existingClientContext.getClient().getClientScope().keySet() ) { - if ( !systemProvidedVariables.contains( key ) ) { - vars.add( key ); - } - } - return ListUtil.asString( vars, "," ); - - // return ListUtil.asString( - // existingClientContext - // .getClient() - // .getClientScope() - // .keySet() - // .stream() - // .filter( key -> !systemProvidedVariables.contains( key ) ) - // .collect( BLCollector.toArray() ), - // "," - // ); - + return ListUtil.asString( + existingClientContext + .getClient() + .getClientScope() + .keySet() + .stream() + .filter( key -> !systemProvidedVariables.contains( key ) ) + .collect( BLCollector.toArray() ), + "," + ); } } diff --git a/src/test/java/ortus/boxlang/modules/compat/ClientScopeTest.java b/src/test/java/ortus/boxlang/modules/compat/ClientScopeTest.java index 7206cc4..ef57433 100644 --- a/src/test/java/ortus/boxlang/modules/compat/ClientScopeTest.java +++ b/src/test/java/ortus/boxlang/modules/compat/ClientScopeTest.java @@ -66,6 +66,7 @@ public void testGetClientVariablesList() { String clientVariablesList = ( String ) variables.get( result ); assertThat( clientVariablesList ).isInstanceOf( String.class ); Array clientVariables = ListUtil.asList( clientVariablesList, "," ); + System.out.println( clientVariables.asString() ); assertThat( clientVariables.size() ).isEqualTo( 1 ); assertThat( clientVariables.get( 0 ) ).isEqualTo( "foo" ); }