aspen0883 / xmlwise

Automatically exported from code.google.com/p/xmlwise
0 stars 0 forks source link

StringIndexOutOfBoundsException #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Environment Linux,OpenJDK(I don't see this issue on windows platform)
1. Get the XML data as byte array
2. BufferedInputStream bis = new BufferedInputStream(request.getInputStream());
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        int result = bis.read();
        while (result != -1) {
            byte b = (byte) result;
            buf.write(b);
            result = bis.read();
        }

3. Map<String, Object> map = new HashMap<String, Object>();
        map = Plist.fromXml(xml);
4. java.lang.StringIndexOutOfBoundsException: String index out of range: 1790
        at java.lang.String.charAt(String.java:694)
        at xmlwise.Plist.base64decode(Unknown Source)
        at xmlwise.Plist.parseElementRaw(Unknown Source)
        at xmlwise.Plist.parseDict(Unknown Source)
        at xmlwise.Plist.parseElementRaw(Unknown Source)
        at xmlwise.Plist.parseElement(Unknown Source)
        at xmlwise.Plist.parse(Unknown Source)
        at xmlwise.Plist.fromXml(Unknown Source)

What is the expected output? What do you see instead?

XML should get parsed and values should get 
added in the map.

What version of the product are you using? On what operating system?
Version: 1.1
OS : Linux(CentOS)

Original issue reported on code.google.com by abhinay....@mobileasap.com on 15 Nov 2011 at 12:01

GoogleCodeExporter commented 8 years ago
This sounds like an encoding issue. How do you create the xml-string?

Original comment by christof...@gmail.com on 20 Nov 2011 at 4:39

GoogleCodeExporter commented 8 years ago

Original comment by christof...@gmail.com on 20 Nov 2011 at 4:51

GoogleCodeExporter commented 8 years ago
I am getting XML string from iOS device via put method.
There is an issue in base64decode(String str) method of Plist class. 
If I use another Base64 utility 
(com.​sun.​org.​apache.​xml.​internal.​security.​utils) for 
decoding it works well.

-Abhinay

Original comment by abhinay....@mobileasap.com on 20 Nov 2011 at 4:53

GoogleCodeExporter commented 8 years ago
Could you provide me with a encoded base64 sequence that fails?

Original comment by christof...@gmail.com on 20 Nov 2011 at 6:11