Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After a goods night sleep, remembered that split can take an arg. Fix… #35

Merged
merged 1 commit into from
May 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ public static Map<String, String> parse(String s) {
// Process each line separated by a newline.
for (String line : s.split("\n")) {
// Parse the line looking for the first equals to get the map key.
final String[] parts = line.split("=");
final String[] parts = line.split("=", 2);

if (parts.length == 0)
continue;

final String key = parts[0].trim();
final int keylen = parts[0].length();
if (key.trim().equals(""))
continue;

String value = "";
if (keylen+1 < line.length()) {
value = line.substring(keylen+1, line.length());
if (parts.length > 1 && parts[1] != null) {
value = parts[1];
}

if (result.containsKey(key))
Expand Down