summaryrefslogtreecommitdiffstats
path: root/theme-compiler
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan@vaadin.com>2014-02-07 15:45:56 +0200
committerJonatan Kronqvist <jonatan@vaadin.com>2014-02-07 15:45:57 +0200
commit22c0c3f41d475d3e186e944d2d94855d72869b2e (patch)
tree7fb04d611b866f2bd8d2d884c421268636855a15 /theme-compiler
parentde34762f0dd6e886a070a384a8eb52ad6a28f46c (diff)
parent1dd2ed36b73404f17863765ec34a56f8fdb0b40f (diff)
downloadvaadin-framework-22c0c3f41d475d3e186e944d2d94855d72869b2e.tar.gz
vaadin-framework-22c0c3f41d475d3e186e944d2d94855d72869b2e.zip
Merge changes from origin/7.1
5b56eeb Changed the rendering order of TabSheet tabs to prevent an NPE in isClipped (#12343) 9026cef Make VTreeTableScrollBody extendable (#13054) b5a080c Provides error location for ArithmeticException. (#11877) a494133 Fixed TabSheet tab bar sizing by removing an obsolete Safari hack (#12343) 1dd2ed3 Changes padding for Textfields with Chameleon theme. (#12974) Change-Id: I44e168176753ed4228002ac11fbd214ee369131a
Diffstat (limited to 'theme-compiler')
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java7
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java20
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java12
3 files changed, 34 insertions, 5 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java b/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java
index 7dbd8ae1a0..552b464941 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluator.java
@@ -99,7 +99,8 @@ public class ArithmeticExpressionEvaluator {
continue inputTermLoop;
}
}
- throw new ArithmeticException();
+ throw new ArithmeticException("Illegal arithmetic expression",
+ term);
}
if (current.getLexicalUnitType() == SCSSLexicalUnit.SCSS_OPERATOR_LEFT_PAREN) {
operators.push(Parentheses.LEFT);
@@ -115,7 +116,7 @@ public class ArithmeticExpressionEvaluator {
while (!operators.isEmpty()) {
Object operator = operators.pop();
if (operator == Parentheses.LEFT) {
- throw new ArithmeticException("Unexpected \"(\" found");
+ throw new ArithmeticException("Unexpected \"(\" found", term);
}
createNewOperand((BinaryOperator) operator, operands);
}
@@ -123,7 +124,7 @@ public class ArithmeticExpressionEvaluator {
if (!operands.isEmpty()) {
LexicalUnitImpl operand = (LexicalUnitImpl) operands.peek();
throw new ArithmeticException("Unexpected operand "
- + operand.toString() + " found");
+ + operand.toString() + " found", term);
}
return expression;
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java b/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java
index 13b6f0e936..f9ab90fc32 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/expression/exception/ArithmeticException.java
@@ -15,12 +15,28 @@
*/
package com.vaadin.sass.internal.expression.exception;
+import com.vaadin.sass.internal.parser.LexicalUnitImpl;
+
public class ArithmeticException extends RuntimeException {
public ArithmeticException(String errorMsg) {
super(errorMsg);
}
- public ArithmeticException() {
- super("Illegal arithmetic expression");
+ public ArithmeticException(String error, LexicalUnitImpl term) {
+ super(buildMessage(error, term));
+ }
+
+ private static String buildMessage(String message, LexicalUnitImpl term) {
+ StringBuilder builder = new StringBuilder(message);
+
+ builder.append(": \"");
+ builder.append(term.toString());
+ builder.append("\" [");
+ builder.append(term.getLineNumber());
+ builder.append(",");
+ builder.append(term.getColumnNumber());
+ builder.append("]");
+
+ return builder.toString();
}
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java b/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java
index 8978eb812e..c408255d0e 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java
@@ -19,6 +19,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.w3c.css.sac.LexicalUnit;
+import com.vaadin.sass.internal.expression.exception.ArithmeticException;
import com.vaadin.sass.internal.expression.exception.IncompatibleUnitsException;
import com.vaadin.sass.internal.parser.LexicalUnitImpl;
@@ -122,4 +123,15 @@ public class ArithmeticExpressionEvaluatorTest {
Assert.assertEquals(LexicalUnit.SAC_CENTIMETER,
result.getLexicalUnitType());
}
+
+ @Test(expected = ArithmeticException.class)
+ public void testNonExistingSignal() {
+ LexicalUnitImpl operand2Integer = LexicalUnitImpl.createInteger(2, 3,
+ null, 2);
+ LexicalUnitImpl operatorComma = LexicalUnitImpl.createComma(2, 3,
+ operand2Integer);
+ LexicalUnitImpl operand3Integer = LexicalUnitImpl.createInteger(2, 3,
+ operatorComma, 3);
+ LexicalUnitImpl result = evaluator.evaluate(operand2Integer);
+ }
}