From cfcd1e96500c48c44f95f8c0528472e4e0b0ed58 Mon Sep 17 00:00:00 2001 From: Jonathan Jarvis Date: Fri, 3 Nov 2023 11:28:02 -0500 Subject: [PATCH] [PDI-19972] Use getADefaultVariableSpace(), which inits from system --- engine/src/main/java/org/pentaho/di/trans/TransMeta.java | 2 +- .../test/java/org/pentaho/di/trans/TransMetaTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/src/main/java/org/pentaho/di/trans/TransMeta.java b/engine/src/main/java/org/pentaho/di/trans/TransMeta.java index 46eb75c01e7f..fef38f5698ca 100644 --- a/engine/src/main/java/org/pentaho/di/trans/TransMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/TransMeta.java @@ -2786,7 +2786,7 @@ public TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean se Document doc = null; try { if (parentVariableSpace == null ) { - parentVariableSpace = new Variables(); + parentVariableSpace = Variables.getADefaultVariableSpace(); } final FileObject transFile = KettleVFS.getFileObject( fname, parentVariableSpace ); diff --git a/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java index 3a72a7dba4a5..ec489faa2118 100644 --- a/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java @@ -867,4 +867,13 @@ public void testSetInternalEntryCurrentDirectoryWithoutFilenameOrRepository( ) { assertEquals( "Original value defined at run execution", transMetaTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ); } + + @Test + public void testTransMetaUsingDefaultVariableSpaceWithSystemProperties() { + System.setProperty( "TransMetaTest.A_TEST_PROPERTY", "1000" ); + TransMeta transMeta = new TransMeta(); + assertEquals( "1000", transMeta.getVariable( "TransMetaTest.A_TEST_PROPERTY" ) ); + System.clearProperty( "TransMetaTest.A_TEST_PROPERTY" ); + } + }