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

Wrong implementation for Http(s)URLConnection parser. #5

Open
melonaerial opened this issue Jan 27, 2016 · 0 comments
Open

Wrong implementation for Http(s)URLConnection parser. #5

melonaerial opened this issue Jan 27, 2016 · 0 comments

Comments

@melonaerial
Copy link

So, lines 154 and 155 of ParseGenerator.java code calls methods getResponse() and getResponseMessage()
https://github.com/idanr1986/droidmon/blob/master/src/com/cuckoodroid/droidmon/utils/ParseGenerator.java#L154
https://github.com/idanr1986/droidmon/blob/master/src/com/cuckoodroid/droidmon/utils/ParseGenerator.java#L155
After calling that methods this class object establishes a network connection to the given in constructor url and receives data from it. But this is wrong behavior for logging functionality, because if we will go to the Android Developer's site we will see typical usage of it this class( http://developer.android.com/intl/ru/reference/java/net/HttpURLConnection.html ):

HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
   try {
     urlConnection.setDoOutput(true);
     urlConnection.setChunkedStreamingMode(0);

     OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());
     writeStream(out);

     InputStream in = new BufferedInputStream(urlConnection.getInputStream());
     readStream(in);
    finally {
     urlConnection.disconnect();
   }
 }

So on the same page of documentation you can see that methods setDoOutput() and setChunkedStreamingMode() can cause IllegalAccessError and IllegalStateException respectively, when connection is already established and its called. Also you can check working of such trace functionality with apps using Android Volley library which are used in most of apps right now. And you will see that apps don't received any data from servers with such wrong logging implementation. They just cause IllegalStateException, nothing more. Also I think that API monitor that change program behavior and state of program objects is not good as well. So please delete this lines and if you want to log this methods and think better add special hooks in hooks.json file.

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

No branches or pull requests

1 participant