diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2008-02-05 14:02:38 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2008-02-05 14:02:38 -0330 |
commit | e4dadd4907bdc43f35f87a743fb6ba89df53257d (patch) | |
tree | b6928dfd4601a8e8d989661dc6a072483b23f39d /java/src | |
parent | Minor fix (diff) | |
download | ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.tar.bz2 ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.tar.xz ice-e4dadd4907bdc43f35f87a743fb6ba89df53257d.zip |
Bug 1373 - allowable property names in config files
Added continue to allDemos scripts
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/PropertiesI.java | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index d78651ae2d7..cc266f79004 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -431,47 +431,50 @@ public final class PropertiesI implements Properties { String s = line; - int hash = s.indexOf('#'); - if(hash == 0) - { - return; // ignore comment lines - } - else if(hash != -1) + // + // Remove comments and unescape #'s + // + int idx = 0; + while((idx = s.indexOf("#", idx)) != -1) { - s = s.substring(0, hash); + if(idx == 0 || s.charAt(idx - 1) != '\\') + { + s = s.substring(0, idx); + break; + } + ++idx; } + s = s.replace("\\#", "#"); - s = s.trim(); - - final char[] arr = s.toCharArray(); - int end = -1; - for(int i = 0; i < arr.length; i++) + // + // Split key/value and unescape ='s + // + int split = -1; + idx = 0; + while((idx = s.indexOf("=", idx)) != -1) { - if(arr[i] == ' ' || arr[i] == '\t' || arr[i] == '\r' || arr[i] == '\n' || arr[i] == '=') + if(idx == 0 || s.charAt(idx - 1) != '\\') { - end = i; + split = idx; break; } + ++idx; } - if(end == -1) + if(split == 0 || split == -1) { + s = s.trim(); + if(s.length() != 0) + { + Ice.Util.getProcessLogger().warning("invalid config file entry: \"" + line + "\""); + } return; } - String key = s.substring(0, end); + String key = s.substring(0, split).trim(); + String value = s.substring(split + 1, s.length()).trim(); - end = s.indexOf('=', end); - if(end == -1) - { - return; - } - ++end; - - String value = ""; - if(end < s.length()) - { - value = s.substring(end).trim(); - } + key = key.replace("\\=", "="); + value = value.replace("\\=", "="); setProperty(key, value); } |