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

initAndStartService: Request[id]=GET[url] = null #4

Open
kunalkala opened this issue Sep 23, 2013 · 2 comments
Open

initAndStartService: Request[id]=GET[url] = null #4

kunalkala opened this issue Sep 23, 2013 · 2 comments

Comments

@kunalkala
Copy link

I created and hosted a page to serve a Json representation of an Object (which also had three fields for state, result_code and transaction flag.

In my android application also, I created the same object. However, my android application is shutting down and showing Null Pointer exception and cannot resume activity exception in the LogCat.

Before the VM shuts down, I am getting the lines:

initAndStartService: Request [id]=....=GET[url]=...[ResourceRepresentation].=null
getUserRequest has started!

and then shutting down VM

I tried to retrieve the Object through another Android App using HttpRequest...I was able to do so.

To be used by RestDroid, does the hosted JSON need to satisfy any special format?

Is there a working example anywhere with a hosted JSON page also

@PCreations
Copy link
Owner

Did you change source code finally ? Because it Resource should not be null at this point...Which Processor are you using ? A custom one ? Have you done the tutorial guide on my website ? http://pcreations.fr/restdroid-guides

@kunalkala
Copy link
Author

I have read your tutorial

I have made 2 changes in Processor.java in RESTDroid Core:

In line 523 (I didn't use Rest.class here as you had said this might definitely case dynamic casting exception at runtime)

    protected Persistable<Resource> getResourcePersistable(Resource resource) {
    Class<Resource> claz=(Class<Resource>)resource.getClass();
    return mPersistableFactory.getPersistable(claz);
}

in line 625

   protected <R extends Resource> InputStream parseToInputStream(R resource) throws ParsingException {
    Class<R> claz=(Class<R>)resource.getClass();
    Parser<R> p = mParserFactory.getParser(claz);
    return p.parseToInputStream(resource);
}

Apart from above I have made no change in the core.

I am also using your ORMLiteJackson library, importing it besides RESTdroid library. I am using your ORMLiteJackson example as base. Hence, I have not written any custom processor but using ORMLiteJackson one.

As I mentioned in my earlier post in issue 3, I had to change getResourceRepresentation() to getResource() in the ORMLiteJackson example. Could this have caused this error? In your main tutorial this was getResource() only, so I thought the problem was there in the example

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

2 participants