Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONParser of json-smart is not throwing exception for invalid json string #46

Closed
GoogleCodeExporter opened this issue Sep 10, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create JSONParser with mode as RFC4627
2. try to parse string "{ \"param1\'\': value1, \"param2\": \"value2\" }" which 
invalid format


What is the expected output? What do you see instead?
It should throw exception, instead it's getting parsed as valid

What version of the product are you using? On what operating system?
1.1.1

Please provide any additional information below.


Original issue reported on code.google.com by arunoda...@gmail.com on 10 Jul 2014 at 10:51

@GoogleCodeExporter
Copy link
Author

OS is WINDOWS7 64bit

Original comment by arunoda...@gmail.com on 10 Jul 2014 at 10:54

@GoogleCodeExporter
Copy link
Author

{ "param1:"sample"": "value1", "param2": "value2" }

Even this is taken as valid but  actually invalid

Original comment by arunoda...@gmail.com on 10 Jul 2014 at 11:37

@GoogleCodeExporter
Copy link
Author

Tested with the curent version 2.0 and 1.3, an exception are throws.


public class TestIssue46 extends TestCase {
    public void testEmptyStrict() throws Exception {
        String s;
        s = "{ \"param1:\"sample\"\": \"value1\", \"param2\": \"value2\" }";
        s = "{ \"param1\'\': value1, \"param2\": \"value2\" }";
        JSONObject o = null;
        try {
            o = (JSONObject) JSONValue.parseStrict(s);
        } catch (Exception e) {
            // should be invalid
        }
        assertEquals(o, null);
    }
}

Original comment by uriel.chemouni on 15 Jul 2014 at 11:30

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

{ \"param1\": \"value1\", \"param2\": \"value2\" }\\\\\\

But still this does not throw any exception. This is taken as valid.

Original comment by arunoda...@gmail.com on 16 Jul 2014 at 11:03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant