Allow comments anywhere in the line

This commit is contained in:
md_5 2013-07-03 11:52:19 +10:00
parent 6d9552101f
commit 11d057e669

View File

@ -72,8 +72,8 @@ public class JarMapping {
}
/**
* Add a class name prefix to the mapping ignore list.
* Note: this only applies before loading mappings, not after
* Add a class name prefix to the mapping ignore list. Note: this only
* applies before loading mappings, not after
*/
public void addExcludedPackage(String packageName) {
SpecialSource.log("Protecting Package: " + packageName);
@ -256,7 +256,11 @@ public class JarMapping {
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#") || line.isEmpty()) {
int commentIndex = line.indexOf('#');
if (commentIndex != -1) {
line = line.substring(0, commentIndex);
}
if (line.isEmpty()) {
continue;
}
@ -369,8 +373,8 @@ public class JarMapping {
}
if (packages.containsKey(oldPackageName) && !newPackageName.equals(packages.get(oldPackageName))) {
throw new IllegalArgumentException("Duplicate package mapping: " + oldPackageName + " ->" + newPackageName +
" but already mapped to "+packages.get(oldPackageName)+" in line="+line);
throw new IllegalArgumentException("Duplicate package mapping: " + oldPackageName + " ->" + newPackageName
+ " but already mapped to " + packages.get(oldPackageName) + " in line=" + line);
}
packages.put(oldPackageName, newPackageName);
@ -400,7 +404,7 @@ public class JarMapping {
}
if (isExcludedPackage(oldClassName)) {
SpecialSource.log("Ignored FD: " + oldClassName + "/" + oldFieldName + " -> " + newFieldName);
SpecialSource.log("Ignored FD: " + oldClassName + "/" + oldFieldName + " -> " + newFieldName);
return;
}
@ -435,7 +439,7 @@ public class JarMapping {
}
if (isExcludedPackage(oldClassName)) {
SpecialSource.log("Ignored MD: " + oldClassName + "/" + oldMethodName + " -> " + newMethodName);
SpecialSource.log("Ignored MD: " + oldClassName + "/" + oldMethodName + " -> " + newMethodName);
return;
}