forked from I2P_Developers/i2p.i2p
* DataHelper: Trim trailing whitespace when loading properties
This commit is contained in:
@ -394,12 +394,21 @@ public class DataHelper {
|
|||||||
public static void loadProps(Properties props, File file) throws IOException {
|
public static void loadProps(Properties props, File file) throws IOException {
|
||||||
loadProps(props, file, false);
|
loadProps(props, file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param forceLowerCase if true forces the keys to lower case (not the values)
|
||||||
|
*/
|
||||||
public static void loadProps(Properties props, File file, boolean forceLowerCase) throws IOException {
|
public static void loadProps(Properties props, File file, boolean forceLowerCase) throws IOException {
|
||||||
loadProps(props, new FileInputStream(file), forceLowerCase);
|
loadProps(props, new FileInputStream(file), forceLowerCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadProps(Properties props, InputStream inStr) throws IOException {
|
public static void loadProps(Properties props, InputStream inStr) throws IOException {
|
||||||
loadProps(props, inStr, false);
|
loadProps(props, inStr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param forceLowerCase if true forces the keys to lower case (not the values)
|
||||||
|
*/
|
||||||
public static void loadProps(Properties props, InputStream inStr, boolean forceLowerCase) throws IOException {
|
public static void loadProps(Properties props, InputStream inStr, boolean forceLowerCase) throws IOException {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try {
|
try {
|
||||||
@ -414,7 +423,7 @@ public class DataHelper {
|
|||||||
int split = line.indexOf('=');
|
int split = line.indexOf('=');
|
||||||
if (split <= 0) continue;
|
if (split <= 0) continue;
|
||||||
String key = line.substring(0, split);
|
String key = line.substring(0, split);
|
||||||
String val = line.substring(split+1); //.trim() ??????????????
|
String val = line.substring(split+1).trim();
|
||||||
// Unescape line breaks after loading.
|
// Unescape line breaks after loading.
|
||||||
// Remember: "\" needs escaping both for regex and string.
|
// Remember: "\" needs escaping both for regex and string.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user