66import java .io .BufferedInputStream ;
77import java .io .BufferedReader ;
88import java .io .BufferedWriter ;
9- import java .io .ByteArrayInputStream ;
10- import java .io .ByteArrayOutputStream ;
119import java .io .Closeable ;
1210import java .io .File ;
1311import java .io .FileInputStream ;
3331import java .util .Arrays ;
3432import java .util .Comparator ;
3533import java .util .Enumeration ;
36- import java .util .HashSet ;
3734import java .util .Iterator ;
3835import java .util .List ;
3936import java .util .Properties ;
40- import java .util .Set ;
4137import java .util .Vector ;
4238import java .util .logging .Level ;
4339import java .util .logging .Logger ;
@@ -91,8 +87,6 @@ public String toString() {
9187
9288 private static Logger log = Logger .getLogger (FileUtils .class .getName ());
9389
94- private final static Set <String > beansCache = new HashSet <>();
95-
9690 public static void copyDirectory (String sourceDirName , String destinationDirName ) throws IOException {
9791
9892 copyDirectory (new File (sourceDirName ), new File (destinationDirName ), null );
@@ -978,8 +972,6 @@ public static String[] getFilesWithExtension(String directory, String extension)
978972 * @return Properties object of the file
979973 * @throws IOException
980974 */
981-
982-
983975 public static Properties loadPropertiesFromFile (String fileName ) throws IOException {
984976 fileName = replaceSeparator (fileName );
985977 log .finest ("Loading properties from file " + fileName );
@@ -990,29 +982,6 @@ public static Properties loadPropertiesFromFile(String fileName) throws IOExcept
990982 input = new FileInputStream (fileName );
991983 inputStreamReader = new InputStreamReader (input , "UTF-8" );
992984 p .load (inputStreamReader );
993- for (Object paramKey : p .keySet ()) {
994- if (paramKey .toString ().endsWith ("Bean" )
995- && !beansCache .contains (p .get (paramKey .toString ()).toString ())) {
996- beansCache .add (p .get (paramKey .toString ()).toString ());
997- String [] beanParamValueProp = p .get (paramKey .toString ()).toString ().split ("\r \n " );
998- StringBuilder beanParamValueFixedSB = new StringBuilder ();
999- for (String line : beanParamValueProp ) {
1000- if (!line .contains ("=" ))
1001- continue ;
1002- String [] keyValuePairArr = line .split ("=" , 2 );
1003-
1004- Pattern twoOrMoreBackslashesPattern = Pattern .compile (".*([\\ \\ ])\\ 1{1,}.*" );
1005- if (twoOrMoreBackslashesPattern .matcher (keyValuePairArr [1 ]).find ()) {
1006- String fixedParamValBackslash = null ;
1007- fixedParamValBackslash = keyValuePairArr [1 ].replace ("\\ \\ " , "\\ " );
1008- beanParamValueFixedSB .append (keyValuePairArr [0 ] + "=" + fixedParamValBackslash + "\r \n " );
1009-
1010- } else
1011- beanParamValueFixedSB .append (line + "\r \n " );
1012- }
1013- p .setProperty (paramKey .toString (), beanParamValueFixedSB .toString ());
1014- }
1015- }
1016985 return p ;
1017986 } finally { // close input stream
1018987 if (inputStreamReader != null ) {
@@ -1023,33 +992,6 @@ public static Properties loadPropertiesFromFile(String fileName) throws IOExcept
1023992 }
1024993 }
1025994 }
1026-
1027-
1028- public static Properties loadBeanPropertiesFromFile (String fileName ) throws IOException {
1029-
1030- Properties properties = new Properties ();
1031- try (FileInputStream input = new FileInputStream (fileName );
1032- InputStreamReader inputStreamReader = new InputStreamReader (input , "UTF-8" );
1033- BufferedReader bfr = new BufferedReader (inputStreamReader );
1034- ByteArrayOutputStream out = new ByteArrayOutputStream ()) {
1035-
1036- String readLine = null ;
1037- while ((readLine = bfr .readLine ()) != null ) {
1038- //In JsystemApp -> GenericObjectParameterPRovider & array Provider,
1039- //for some reason, inject this string prop representation into another
1040- //properties file, in there the 2nd properies file treats every backslash
1041- //as a special char as well, therefore, were multiplying the backslashes twice on purpose
1042-
1043- out .write (readLine .replace ("\\ " , "\\ \\ \\ \\ " ).getBytes ());
1044- out .write ("\n " .getBytes ());
1045- } // while
1046-
1047- InputStream is = new ByteArrayInputStream (out .toByteArray ());
1048- properties .load (is );
1049- }
1050- return properties ;
1051- }
1052-
1053995
1054996 /**
1055997 * save given properties to a file
@@ -1366,4 +1308,4 @@ public static void moveDirectory(String sourceDirectory, String destinationDirec
13661308 }
13671309 }
13681310
1369- }
1311+ }
0 commit comments