[pkg-java] r11946 - in trunk/maven-repo-helper: . debian src/main/java/org/debian/maven/repo src/test/resources
Damien Raude-Morvan
drazzib at alioth.debian.org
Sat Mar 27 02:14:02 UTC 2010
Author: drazzib
Date: 2010-03-27 02:14:00 +0000 (Sat, 27 Mar 2010)
New Revision: 11946
Modified:
trunk/maven-repo-helper/
trunk/maven-repo-helper/debian/changelog
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed
Log:
* Rule.java: harden our handling of version string (from pom.xml)
to cope with specials chars.
* POMTransformer: If we can't find a dependency, just skip it.
Property changes on: trunk/maven-repo-helper
___________________________________________________________________
Added: svn:ignore
+ .classpath
.project
bin
Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog 2010-03-26 23:29:29 UTC (rev 11945)
+++ trunk/maven-repo-helper/debian/changelog 2010-03-27 02:14:00 UTC (rev 11946)
@@ -1,3 +1,11 @@
+maven-repo-helper (1.0.6) UNRELEASED; urgency=low
+
+ * Rule.java: harden our handling of version string (from pom.xml)
+ to cope with specials chars.
+ * POMTransformer: If we can't find a dependency, just skip it.
+
+ -- Damien Raude-Morvan <drazzib at debian.org> Sat, 27 Mar 2010 03:13:11 +0100
+
maven-repo-helper (1.0.5) unstable; urgency=low
* mh_installjar: Add new -e/--set-version switchs and handle
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java 2010-03-26 23:29:29 UTC (rev 11945)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java 2010-03-27 02:14:00 UTC (rev 11946)
@@ -327,7 +327,8 @@
int index = inc(dependencyIndexes, POMInfo.EXTENSIONS);
dependency = (Dependency) info.getExtensions().get(index);
}
- if (!acceptDependency(dependency, info)) {
+ // Skip dependency if we can't find it (== null)
+ if (dependency == null || !acceptDependency(dependency, info)) {
inIgnoredElement++;
inLevel--;
path.remove(path.size() - 1);
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java 2010-03-26 23:29:29 UTC (rev 11945)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java 2010-03-27 02:14:00 UTC (rev 11946)
@@ -19,8 +19,9 @@
pattern = Pattern.compile(st.nextToken());
replace = st.nextToken();
} else {
- pattern = Pattern.compile(rule.replace(".", "\\.").replace("*", "(.*)"));
- replace = rule.replace("*", "$1");
+ String pat = escapeParameters(rule.replace(".", "\\.").replace("*", "(.*)"));
+ pattern = Pattern.compile(pat);
+ replace = escapeGroupMatch(rule).replace("*", "$1");
}
}
@@ -42,7 +43,6 @@
m.appendReplacement(sb, replace);
}
}
- // m.appendTail(sb);
return sb.toString();
}
@@ -81,4 +81,24 @@
public String toString() {
return rule;
}
-}
\ No newline at end of file
+
+ /**
+ * Escape (ie. preprend \\) characters which can be specials chars for regexp.
+ *
+ * @param value Input chars
+ * @return Escaped output chars
+ */
+ private String escapeParameters(String value) {
+ return escapeGroupMatch(value).replace("{", "\\{").replace("}", "\\}");
+ }
+
+ /**
+ * Escape (ie. preprend \\) characters which can be group identifiers for replace
+ *
+ * @param value Input chars
+ * @return Escaped output chars
+ */
+ private String escapeGroupMatch(String value) {
+ return value.replace("$", "\\$");
+ }
+}
Modified: trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed 2010-03-26 23:29:29 UTC (rev 11945)
+++ trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed 2010-03-27 02:14:00 UTC (rev 11946)
@@ -63,7 +63,6 @@
</goals>
</execution>
</executions>
- <version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
More information about the pkg-java-commits
mailing list