aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1417520 - /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java
Date Wed, 05 Dec 2012 16:52:29 GMT
Author: jwross
Date: Wed Dec  5 16:52:28 2012
New Revision: 1417520

URL: http://svn.apache.org/viewvc?rev=1417520&view=rev
Log:
Strip quotes from parameter values.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java?rev=1417520&r1=1417519&r2=1417520&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvideCapabilityHeader.java
Wed Dec  5 16:52:28 2012
@@ -43,6 +43,14 @@ public class ProvideCapabilityHeader imp
 				parameters.put(DIRECTIVE_EFFECTIVE, EffectiveDirective.DEFAULT);
 		}
 		
+		private static String removeQuotes(String value) {
+			if (value == null)
+				return null;
+			if (value.startsWith("\"") && value.endsWith("\""))
+				return value.substring(1, value.length() - 1);
+			return value;
+		}
+		
 		private final String path;
 		private final Map<String, Parameter> parameters = new HashMap<String, Parameter>();
 		
@@ -55,14 +63,14 @@ public class ProvideCapabilityHeader imp
 			while (matcher.find()) {
 				if (":=".equals(matcher.group(2))) {
 					// This is a directive.
-					parameters.put(matcher.group(1), DirectiveFactory.createDirective(matcher.group(1),
matcher.group(3)));
+					parameters.put(matcher.group(1), DirectiveFactory.createDirective(matcher.group(1),
removeQuotes(matcher.group(3))));
 				}
 				else if (":".equals(matcher.group(5)))
 					// This is a typed attribute with a declared version.
-					parameters.put(matcher.group(4), new TypedAttribute(matcher.group(4), matcher.group(7),
matcher.group(6)));
+					parameters.put(matcher.group(4), new TypedAttribute(matcher.group(4), removeQuotes(matcher.group(7)),
matcher.group(6)));
 				else
 					// This is a typed attribute without a declared version.
-					parameters.put(matcher.group(4), new TypedAttribute(matcher.group(4), matcher.group(7),
TypedAttribute.Type.String));
+					parameters.put(matcher.group(4), new TypedAttribute(matcher.group(4), removeQuotes(matcher.group(7)),
TypedAttribute.Type.String));
 			}
 			fillInDefaults(parameters);
 		}



Mime
View raw message