felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r804096 - in /felix/trunk/fileinstall/src: main/java/org/apache/felix/fileinstall/util/Util.java test/java/org/apache/felix/fileinstall/util/UtilTest.java
Date Fri, 14 Aug 2009 07:08:57 GMT
Author: gnodet
Date: Fri Aug 14 07:08:56 2009
New Revision: 804096

URL: http://svn.apache.org/viewvc?rev=804096&view=rev
Log:
FELIX-1481: When performing variable substitution, fileinstall throws an exception if there
is a start or stop delimiter without the other one

Modified:
    felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/util/Util.java
    felix/trunk/fileinstall/src/test/java/org/apache/felix/fileinstall/util/UtilTest.java

Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/util/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/util/Util.java?rev=804096&r1=804095&r2=804096&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/util/Util.java (original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/util/Util.java Fri
Aug 14 07:08:56 2009
@@ -88,16 +88,10 @@
 
         // If we do not have a start or stop delimiter, then just
         // return the existing value.
-        if ((startDelim < 0) && (stopDelim < 0))
+        if ((startDelim < 0) || (stopDelim < 0))
         {
             return val;
         }
-        // At this point, we found a stop delimiter without a start,
-        // so throw an exception.
-        else if (((startDelim < 0) || (startDelim > stopDelim)) && (stopDelim
>= 0))
-        {
-            throw new IllegalArgumentException("stop delimiter with no start delimiter: "
+ val);
-        }
 
         // At this point, we have found a variable placeholder so
         // we must perform a variable substitution on it.

Modified: felix/trunk/fileinstall/src/test/java/org/apache/felix/fileinstall/util/UtilTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/test/java/org/apache/felix/fileinstall/util/UtilTest.java?rev=804096&r1=804095&r2=804096&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/test/java/org/apache/felix/fileinstall/util/UtilTest.java
(original)
+++ felix/trunk/fileinstall/src/test/java/org/apache/felix/fileinstall/util/UtilTest.java
Fri Aug 14 07:08:56 2009
@@ -47,6 +47,12 @@
 
     }
 
+    public void testSubstitutionFailures()
+    {
+        assertEquals("a}", Util.substVars("a}", "b", null, new Hashtable()));
+        assertEquals("${a", Util.substVars("${a", "b", null, new Hashtable()));
+    }
+
     public void testCanRecognizeInvalidJar()
     {
         assertFalse(Util.isValidJar("src/test/resources/watched/firstjar.jar"));



Mime
View raw message