FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add support for java.lang.Bool, Integer and Long classes by qistoph · Pull Request #27 · tcalmant/python-javaobj · GitHub

Add support for java.lang.Bool, Integer and Long classes - #27

Merged
tcalmant merged 3 commits into
tcalmant:masterfrom
qistoph:master
Apr 26, 2019
Merged

Add support for java.lang.Bool, Integer and Long classes#27
tcalmant merged 3 commits into
tcalmant:masterfrom
qistoph:master

Conversation

qistoph commented Apr 22, 2019

Copy link
Copy Markdown
Contributor

This PR adds support for instances of

  • java.lang.Bool
  • java.lang.Integer
  • java.lang.Long

Test cases created with:

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;

public class Creator {
    public static void main(String[] args)
    throws Exception {
        HashMap hm1 = new HashMap();
        hm1.put("key1", "value1");
        hm1.put("key2", "value2");
        hm1.put("int", 9);
        hm1.put("ing2", new Integer(10));
        hm1.put("bool", true);
        hm1.put("bool2", new Boolean(true));
        FileOutputStream fs = new FileOutputStream("hashmap-1.ser");
        ObjectOutputStream os = new ObjectOutputStream(fs);
        os.writeObject(hm1);
        os.close();

        HashMap hm2 = new HashMap();
        hm2.put("key1", hm1);
        fs = new FileOutputStream("hashmap-2.ser");
        os = new ObjectOutputStream(fs);
        os.writeObject(hm2);
        os.close();
    }
}

Tested with:

#!/usr/bin/python3
  
import sys
import logging

logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)

import javaobj

#filename = 'creator/hashmap-1.ser'
filename = 'creator/hashmap-2.ser'
with open(filename, 'rb') as fd:
    jobj = fd.read()

pobj = javaobj.loads(jobj)
print(pobj)

coveralls commented Apr 22, 2019
edited
Loading

Copy link
Copy Markdown

Coverage decreased (-0.3%) to 79.237% when pulling a2c0172 on qistoph:master into 1dc4427 on tcalmant:master.

tcalmant merged commit a2c0172 into tcalmant:master Apr 26, 2019
tcalmant added a commit that referenced this pull request Apr 26, 2019
tcalmant added a commit that referenced this pull request Apr 26, 2019

Copy link
Copy Markdown
Owner

Thank you for your contribution 👍
I've added the unit test plus the comparison operators to the loaded classes

tcalmant added a commit that referenced this pull request Apr 26, 2019
- Fixes #25
- Seems to have been unlocked thanks to #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL