diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-14 21:28:10 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-14 21:28:10 +0100 |
commit | 83feb6ad13187af9be55cc71408611f67d280955 (patch) | |
tree | 2ef512092714fe3ae7a26a767cd5779bbe78ef51 /src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java | |
parent | 99b7023aba5c09f069badc35d05ea3ef53f3a6d2 (diff) |
Fix timestamps and ValueQuery
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index ece50b5..3edda69 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -28,24 +28,30 @@ public class ValueQuery extends Value { */ public ValueQuery(String query) throws Exception { this.code = query; - Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); - this.query = (new parser(lex)).pProgram(); + if (!query.isEmpty()) { + Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); + this.query = (new parser(lex)).pProgram(); + } this.signature = null; this.timestamp = System.currentTimeMillis(); } public ValueQuery(String query, byte[] querySignature) throws Exception { this.code = query; - Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); - this.query = (new parser(lex)).pProgram(); + if (!query.isEmpty()) { + Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); + this.query = (new parser(lex)).pProgram(); + } this.signature = querySignature; this.timestamp = System.currentTimeMillis(); } public ValueQuery(QueryData queryData) throws Exception { this.code = queryData.getCode(); - Yylex lex = new Yylex(new ByteArrayInputStream(queryData.getCode().getBytes())); - this.query = (new parser(lex)).pProgram(); + if (!queryData.getCode().isEmpty()) { + Yylex lex = new Yylex(new ByteArrayInputStream(queryData.getCode().getBytes())); + this.query = (new parser(lex)).pProgram(); + } this.signature = queryData.getSignature(); this.timestamp = System.currentTimeMillis(); } |