Retain negative operator
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1189503 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
index 9a1d6f3..2974ffa 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
@@ -39,7 +39,7 @@
*/
public abstract class AbstractDependencyFilter
{
- private final Pattern MISSING_KEY_PATTERN = Pattern.compile( "^[a-zA-Z]+=" );
+ private static final Pattern MISSING_KEY_PATTERN = Pattern.compile( "^(!)?([a-zA-Z]+=)" );
/**
* Dependency artifacts.
@@ -106,12 +106,7 @@
protected final void processInstructions( String header ) throws MojoExecutionException
{
- if ( MISSING_KEY_PATTERN.matcher( header ).lookingAt() )
- {
- header = "*;" + header;
- }
-
- Map instructions = OSGiHeader.parseHeader( header );
+ Map instructions = OSGiHeader.parseHeader( MISSING_KEY_PATTERN.matcher( header ).replaceFirst( "$1*;$2" ) );
DependencyFilter filter;
for ( Iterator clauseIterator = instructions.entrySet().iterator(); clauseIterator.hasNext(); )
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index 428fbf4..9ecf37c 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -274,7 +274,12 @@
}
- public void testEmbedDependencyMissingKey() throws Exception
+ public void testEmbedDependencyNegativeClauses() throws Exception
+ {
+ }
+
+
+ public void testEmbedDependencyMissingPositiveKey() throws Exception
{
ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
@@ -303,7 +308,7 @@
}
- public void testEmbedDependencyNegativeClauses() throws Exception
+ public void testEmbedDependencyMissingNegativeKey() throws Exception
{
}
}