File tree Expand file tree Collapse file tree
knowage-core/src/main/java/it/eng/spagobi/api/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public abstract class AbstractDataSetResource extends AbstractSpagoBIResource {
128128
129129 private static final Logger LOGGER = LogManager .getLogger (AbstractDataSetResource .class );
130130
131- private static final String REGEX_FIELDS_VALIDATION = "(?: \\ \" [a-zA-Z0-9 \\ - \\ _ \\ s]* \\ \" )" ;
131+ private static final String REGEX_FIELDS_VALIDATION = "\\ (([^)]{1,50}) \\ )" ;
132132 private static final int SOLR_FACETS_DEFAULT_LIMIT = 10 ;
133133 private static final String VALIDATION_OK = "OK" ;
134134
@@ -835,22 +835,26 @@ private void validateBrackets(String formula) {
835835 }
836836
837837 private void validateFields (String formula , List <SimpleSelectionField > columns ) {
838- String regex = REGEX_FIELDS_VALIDATION ;
839- Pattern p = Pattern .compile (regex );
838+ Pattern p = Pattern .compile (REGEX_FIELDS_VALIDATION );
840839 Matcher m = p .matcher (formula );
841840
842841 while (m .find ()) {
842+
843+ if (!m .group (1 ).startsWith ("\" " ) || !m .group (1 ).endsWith ("\" " )) {
844+ throw new ValidationException ("common.errors.formulas.missingQuotes" );
845+ }
846+
843847 boolean found = false ;
844848 for (SimpleSelectionField simpleSelectionField : columns ) {
845849
846- if (simpleSelectionField .getName ().equals (m .group (0 ).replace ("\" " , "" ))) {
850+ if (simpleSelectionField .getName ().equals (m .group (1 ).replace ("\" " , "" ))) {
847851 found = true ;
848852 break ;
849853 }
850854 }
851855
852856 if (!found ) {
853- throw new ValidationException ();
857+ throw new ValidationException ("common.errors.formulas.unknownField" );
854858 }
855859 }
856860
You can’t perform that action at this time.
0 commit comments