felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1793472 - in /felix/trunk/gogo/runtime/src: main/java/org/apache/felix/gogo/runtime/Tokenizer.java test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
Date Tue, 02 May 2017 11:27:40 GMT
Author: gnodet
Date: Tue May  2 11:27:40 2017
New Revision: 1793472

URL: http://svn.apache.org/viewvc?rev=1793472&view=rev
Log:
[FELIX-5631][gogo][runtime] The parser indicates wrong repair string when parsing heredocs

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java
    felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java?rev=1793472&r1=1793471&r2=1793472&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java Tue
May  2 11:27:40 2017
@@ -239,7 +239,7 @@ public class Tokenizer extends BaseToken
             getch();
         }
         if (ch == EOT) {
-            throw new EOFError(sLine, sCol, "expected here-doc start", "heredoc", "foo");
+            throw new EOFError(sLine, sCol, "expected here-doc start", "heredoc", "foo\n");
         }
         Token token = text.subSequence(start, index - 1);
         getch();
@@ -274,7 +274,7 @@ public class Tokenizer extends BaseToken
             }
             if (ch == EOT)
             {
-                throw new EOFError(sLine, sCol, "unexpected eof found in here-doc", "heredoc",
token.toString());
+                throw new EOFError(sLine, sCol, "unexpected eof found in here-doc", "heredoc",
"\n" + token.toString() + "\n");
             }
             getch();
         }

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java?rev=1793472&r1=1793471&r2=1793472&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
(original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
Tue May  2 11:27:40 2017
@@ -545,4 +545,21 @@ public class TestTokenizer
         when(bc.getBundles()).thenReturn(new Bundle[] { systemBundle });
         return bc;
     }
+
+    @Test
+    public void testHereDocMissing() throws Exception {
+        try {
+            new Parser("a <<").statement();
+            fail("Expected exception");
+        } catch (EOFError e) {
+            assertEquals("foo\n", e.repair());
+        }
+        try {
+            new Parser("a << foo\n").statement();
+            fail("Expected exception");
+        } catch (EOFError e) {
+            assertEquals("\nfoo\n", e.repair());
+        }
+        new Parser("a << foo\n \nfoo\n").statement();
+    }
 }



Mime
View raw message