Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

End with double-quote string problem #58

Description

@yukihane

I am trying to emulate OpenID Connect UserInfo Error Response, putting on following yaml, but it is not working as expected.

- response:
    status: 401
    headers:
      WWW-Authenticate: 'error="invalid_token"'

It looks that GroovyClassLoader#parseClass() throws exception:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
data\userinfo.get.yaml: 1: unexpected char: '"' @ line 1, column 27.
   """error="invalid_token""""

I think it works well to escepe double-quote:

diff --git a/src/main/java/org/hidetake/stubyaml/model/ExpressionCompiler.java b/src/main/java/org/hidetake/stubyaml/model/ExpressionCompiler.java
index 3d4903c..f1cbdc4 100644
--- a/src/main/java/org/hidetake/stubyaml/model/ExpressionCompiler.java
+++ b/src/main/java/org/hidetake/stubyaml/model/ExpressionCompiler.java
@@ -44,7 +44,7 @@ public class ExpressionCompiler {
             return compileExpression(template.substring(2, template.length() - 1), source);
         }
         return compileExpression("\"\"\"" +
-            StringUtils.replace(template, "\"\"\"", "\\\"\\\"\\\"") +
+            StringUtils.replace(template, "\"", "\\\"") +
             "\"\"\"", source);
     }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions