You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Pietro Cerutti (JIRA)" <ji...@apache.org> on 2016/10/05 12:15:20 UTC

[jira] [Comment Edited] (AVRO-1930) JsonParser doesn't handle integer scientific notation

    [ https://issues.apache.org/jira/browse/AVRO-1930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15548529#comment-15548529 ] 

Pietro Cerutti edited comment on AVRO-1930 at 10/5/16 12:14 PM:
----------------------------------------------------------------

{code}
diff --git a/impl/json/JsonIO.cc b/impl/json/JsonIO.cc
index 2e7d82f..eafd579 100644
--- a/impl/json/JsonIO.cc
+++ b/impl/json/JsonIO.cc
@@ -171,6 +171,10 @@ JsonParser::Token JsonParser::tryNumber(char ch)
                     state = 3;
                     sv.push_back(ch);
                     continue;
+                } else if (ch == 'e' || ch == 'E') {
+                    sv.push_back(ch);
+                    state = 5;
+                    continue;
                 }
                 hasNext = true;
             }
@@ -185,6 +189,10 @@ JsonParser::Token JsonParser::tryNumber(char ch)
                     state = 3;
                     sv.push_back(ch);
                     continue;
+                } else if (ch == 'e' || ch == 'E') {
+                    sv.push_back(ch);
+                    state = 5;
+                    continue;
                 }
                 hasNext = true;
             }
{code}


was (Author: gahr):
diff --git a/impl/json/JsonIO.cc b/impl/json/JsonIO.cc
index 2e7d82f..eafd579 100644
--- a/impl/json/JsonIO.cc
+++ b/impl/json/JsonIO.cc
@@ -171,6 +171,10 @@ JsonParser::Token JsonParser::tryNumber(char ch)
                     state = 3;
                     sv.push_back(ch);
                     continue;
+                } else if (ch == 'e' || ch == 'E') {
+                    sv.push_back(ch);
+                    state = 5;
+                    continue;
                 }
                 hasNext = true;
             }
@@ -185,6 +189,10 @@ JsonParser::Token JsonParser::tryNumber(char ch)
                     state = 3;
                     sv.push_back(ch);
                     continue;
+                } else if (ch == 'e' || ch == 'E') {
+                    sv.push_back(ch);
+                    state = 5;
+                    continue;
                 }
                 hasNext = true;
             }

> JsonParser doesn't handle integer scientific notation
> -----------------------------------------------------
>
>                 Key: AVRO-1930
>                 URL: https://issues.apache.org/jira/browse/AVRO-1930
>             Project: Avro
>          Issue Type: Bug
>          Components: c++
>    Affects Versions: 1.8.1
>            Reporter: Pietro Cerutti
>              Labels: patch
>
> The JsonParser doesn't handle, e.g., 1e12, which is valid according to the JSON specification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)