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

RuntimeException in MarketSession #23

Open
GoogleCodeExporter opened this issue Apr 28, 2016 · 0 comments
Open

RuntimeException in MarketSession #23

GoogleCodeExporter opened this issue Apr 28, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

If in flush method RuntimeException is occur, then subsequent calls to 
MarketSession will fail because of invalid state of "request" parameter. 
"request = Request.newBuilder();" will never be called.

Solution. Use following method:

        request.setContext(ctxt);
        try {
            Response resp = executeProtobuf(request.build());
            int i = 0;
            for (ResponseGroup grp : resp.getResponseGroupList()) {
                Object val = null;
                if (grp.hasAppsResponse())
                    val = grp.getAppsResponse();
                if (grp.hasCategoriesResponse())
                    val = grp.getCategoriesResponse();
                if (grp.hasCommentsResponse())
                    val = grp.getCommentsResponse();
                if (grp.hasImageResponse())
                    val = grp.getImageResponse();
                ((Callback) callbacks.get(i)).onResult(grp.getContext(), val);
                i++;
            }
        } finally {
            request = Request.newBuilder();
            callbacks.clear();
        }


Library version : 0.3

RuntimeException is quite common thing due to 400=Bad Request.

Original issue reported on code.google.com by [email protected] on 15 Sep 2010 at 6:22

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