Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1225

Change subject: improve error messages
......................................................................

improve error messages

Change-Id: Ia82cd34ae5099f924302d7d42b541247a258c9b9
---
M 
asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
2 files changed, 16 insertions(+), 4 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/25/1225/1

diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
index 94866eb..2bc78a1 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/FunctionUtil.java
@@ -116,7 +116,7 @@
                     messageBuilder.append("function " + 
functionDecls.get(functionDecls.size() - 1).getSignature()
                             + " depends upon function " + signature + " which 
is undefined");
                 } else {
-                    messageBuilder.append("function " + signature + " is 
undefined ");
+                    messageBuilder.append("function " + signature + " is not 
defined");
                 }
                 throw new AsterixException(messageBuilder.toString());
             }
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 697439d..f330f40 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -2187,15 +2187,27 @@
     }
   | <INTEGER_LITERAL>
     {
-      lit.setValue(new LongIntegerLiteral(new Long(token.image)));
+        try {
+            lit.setValue(new LongIntegerLiteral(Long.valueOf(token.image)));
+        } catch (NumberFormatException e) {
+            throw new ParseException("Could not parse numeric literal \"" + 
token.image +'"');
+        }
     }
   | <FLOAT_LITERAL>
     {
-      lit.setValue(new FloatLiteral(new Float(token.image)));
+        try {
+            lit.setValue(new FloatLiteral(Float.valueOf(token.image)));
+        } catch (NumberFormatException e) {
+            throw new ParseException("Could not parse numeric literal \"" + 
token.image +'"');
+        }
     }
   | <DOUBLE_LITERAL>
     {
-      lit.setValue(new DoubleLiteral(new Double(token.image)));
+        try {
+            lit.setValue(new DoubleLiteral(Double.valueOf(token.image)));
+        } catch (NumberFormatException e) {
+            throw new ParseException("Could not parse numeric literal \"" + 
token.image +'"');
+        }
     }
   | <MISSING>
     {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1225
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia82cd34ae5099f924302d7d42b541247a258c9b9
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <[email protected]>

Reply via email to