bndtools/bnd — Issue #140: "IllegalArgumentException: Illegal group reference" in doUses when package name contains $
Author: pmoriarty
Created: 2012-03-02 12:53:41+00:00
State: open

From http://paudo.posterous.com/clojure-osgi

Use case is Clojure autogenerated packages which can contain $. String replaceAll treats $ in the replacement string as a group reference and complains if it isn't followed by a digit.

See stacktrace below. Looks like the replacement string sb.toString() should be quoted using java.util.regex.Matcher#quoteReplacement before being passed to String.replaceAll.

```
java.lang.IllegalArgumentException: Illegal group reference
at java.util.regex.Matcher.appendReplacement(Matcher.java:713)
at java.util.regex.Matcher.replaceAll(Matcher.java:813)
at java.lang.String.replaceAll(String.java:2189)
at aQute.lib.osgi.Analyzer.doUses(Analyzer.java:1379)
at aQute.lib.osgi.Analyzer.doUses(Analyzer.java:1325)
at aQute.lib.osgi.Analyzer.analyze(Analyzer.java:240)
at aQute.lib.osgi.Builder.analyze(Builder.java:306)
at aQute.lib.osgi.Analyzer.calcManifest(Analyzer.java:301)
at org.apache.felix.bundleplugin.ManifestPlugin.getAnalyzer(ManifestPlugin.java:192)
at org.apache.felix.bundleplugin.ManifestPlugin.getManifest(ManifestPlugin.java:113)
at org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:68)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:263)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:254)
```