fixed problem with validating spel expressions that include property placeholders, ignoring those spel expressions now for validation
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user