Of course my English sucks but I wrote:

Found the problem in another part of code!
I didn't close JsonParser before delete the associated file.. Calling
close() has solved problem.

So I call close method on -->>JsonParser<<-- :D and not in the connection.

I wrote in first post: I have this piece of code that takes the server
response and writes it into a file.
And this part is ok.

When I parsed the file with JsonParser (Jackson) I've forgot to call close
method on JsonParser object, so I have the described exception. But the
exception gives me no information about which lines of my code caused it.
So in first attempt I was thinking the code I've posted in first post. But
later I found that was in these lines of code:

final JsonParser jp = new
ObjectMapper().getJsonFactory().createJsonParser(fileResult);
jp.nextToken();
while (jp.nextToken() != JsonToken.END_ARRAY) {
    ....
}
jp.close();
fileResult.delete();

After adding jp.close() exception is gone.


2013/1/25 Indicator Veritatis <[email protected]>

> Especially since in his final comment, he does not tell us on which object
> he called 'close()';)
>
> After all: most of us are using HTTP 1.1 these days, with "connection:
> keep-alive" (the default), so it is mysterious that he is calling close()
> on the connection in the thread's constructor in the first place.
>
> So other readers have little to learn from this thread, since we have no
> sound knowledge of either his original problem nor of the fix.
>
>
> On Thursday, January 24, 2013 12:34:23 PM UTC-8, Lew wrote:
>>
>> Marco Serioli wrote:
>>
>>> Mah.. I've no change in libraries and no change in code. Only Eclipse
>>> ADT plugin has changed.
>>>
>>
>> That does not span the universe of conditions.
>>
>> Since you provide no evidence of your assertions, we have no way of
>> knowing how you erred.
>>
>>  Lew
>>
>>> Marco Serioli wrote:
>>>
>>>> And why in your opinion in the past I got no exception?
>>>>
>>> Because the conditions that triggered it did not happen before.
>>>
>>
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Reply via email to