felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1799987 - in /felix/trunk/gogo/runtime/src: main/java/org/apache/felix/gogo/runtime/Expander.java test/java/org/apache/felix/gogo/runtime/ExpanderTest.java
Date Mon, 26 Jun 2017 20:57:51 GMT
Author: gnodet
Date: Mon Jun 26 20:57:51 2017
New Revision: 1799987

URL: http://svn.apache.org/viewvc?rev=1799987&view=rev
Log:
[FELIX-5656] [gogo][runtime] The Expander does not correctly support octal values

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
    felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java?rev=1799987&r1=1799986&r2=1799987&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Expander.java Mon
Jun 26 20:57:51 2017
@@ -857,6 +857,7 @@ public class Expander extends BaseTokeni
                     case '8':
                     case '9':
                         ch = 0;
+                        i--;
                         for (int j = 0; j < 3; j++)
                         {
                             c = i < arg.length() - 1 ? arg.charAt(++i) : -1;

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java?rev=1799987&r1=1799986&r2=1799987&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java
(original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java
Mon Jun 26 20:57:51 2017
@@ -32,6 +32,33 @@ import static org.junit.Assert.assertNot
 public class ExpanderTest {
 
     @Test
+    public void testOctalAndHex() throws Exception {
+        Evaluate evaluate = new Evaluate() {
+            @Override
+            public Object eval(Token t) throws Exception {
+                return null;
+            }
+            @Override
+            public Object get(String key) {
+                return null;
+            }
+            @Override
+            public Object put(String key, Object value) {
+                return null;
+            }
+            @Override
+            public Object expr(Token t) {
+                return null;
+            }
+            @Override
+            public Path currentDir() {
+                return null;
+            }
+        };
+        assertEquals("\033\033", Expander.expand("$'\\033\\u001B'", evaluate));
+    }
+
+    @Test
     public void testGenerateFiles() throws IOException {
         final Path testdir = Paths.get(".").toAbsolutePath().resolve("target/testdir").normalize();
         Evaluate evaluate = new Evaluate() {



Mime
View raw message