fixed problem with validating spel expressions that include property placeholders, ignoring those spel expressions now for validation

This commit is contained in:
Martin Lippert
2020-09-07 10:57:36 +02:00
parent 3a56d78cb6
commit c7c838dced
2 changed files with 12 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSe
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemTypes;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblem;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
import org.springframework.util.SystemPropertyUtils;
/**
* @author Martin Lippert
@@ -39,7 +40,7 @@ public class SpelExpressionReconciler implements Reconciler {
return;
}
if (spelExpression.length() > 0) {
if (spelExpression.length() > 0 && spelExpression.indexOf(SystemPropertyUtils.PLACEHOLDER_PREFIX) == -1) {
SpelExpressionParser parser = new SpelExpressionParser();
try {
parser.parseExpression(spelExpression);

View File

@@ -297,7 +297,16 @@ public class ValueSpelExpressionValidationTest {
assertEquals(1, problems.size());
}
@Test
public void testIgnoreSpelExpressionsWithPropertyPlaceholder() throws Exception {
TextDocument doc = prepareDocument("@Value(\"onField\")", "@Value(value=\"#{${property.hello:false}}\")");
assertNotNull(doc);
reconcileEngine.reconcile(doc, problemCollector);
List<ReconcileProblem> problems = problemCollector.getCollectedProblems();
assertEquals(0, problems.size());
}
private TextDocument prepareDocument(String selectedAnnotation, String annotationStatementBeforeTest) throws Exception {
String content = IOUtils.toString(new URI(docUri));