-
-
Notifications
You must be signed in to change notification settings - Fork 735
ParseUser$State java.lang.ClassCastException: org.json.JSONObject$1 cannot be cast to java.lang.String #209
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
Comments
Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.
|
It's not obvious to me how this could be happening. Would you be able to provide a small project that reproduces this issue and possibly attach a debugger and tell me the information that's in |
ok, I will schedule this and reply asap. |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
Some of my users have seen this too since upgrading to 1.10.3 http://crashes.to/s/18e58f0f97a
Here is a snippet with line numbers:
This is happening in when my code is saving the ParseUser:
|
I found 3 users this happened for. The sequence of events was like this:
This is odd because my code will not save the ParseInstallation until the ParseUser is saved. Its also odd that the ParseInstallation error comes first. It looks to me like the ParseUser fails to save, but, saveInBackground completes successfully, letting my code move ahead to try to save the ParseInstallation, which then fails to save because I reference the ParseUser on it. Perhaps on a subsequent app launch the app tries to save the ParseUser again, and this time an error is thrown. Here is the ParseInstallation error:
My code:
|
Are either of you happening to be using lazy users and cloud code such as before/afterSave for your Also once either of you are able to reproduce this, it'd be great to get repro steps/project as well as the User object stored in sqlite/disk and the network information from our logging tools (feel free to remove any private information). I mainly need what's getting passed around in the |
Whats a lazy user? I'm not using before/afterSave on my users. I think I've shared all my user code above. I find it really hard to reproduce these parse bugs. sorry man. |
Lazy users are also known as anonymous or automatic users: https://parse.com/docs/android/guide#users-anonymous-users It's all good, these edge case issues are always harder to track down, but luckily that also means that they don't happen often for users either. |
Gotcha. Yes my code uses anonymous users, this can be seen in the code I pasted above.
|
Sorry, I totally missed that 😞 |
Np, I pasted a lot of code, thx for your help with this and other issues! |
I use lazy users, I'm not using before/afterSave on my users. public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
ParseObject.registerSubclass(MyUser.class);
Parse.initialize(...);
ParseFacebookUtils.initialize(appContext, REQUESTCODE_FACEBOOK);
FacebookSdk.sdkInitialize(appContext);
MyUser.enableAutomaticUser();
String userId = MyUser.getUserId(); //does the first user save, see first post
... is there any problem? I noticed that in the Parse tutorials you enable the localDatastore after the registering of User subclass. Can this be a problem because of the "single instance" the localDatastore introduces? The documentation does not talk about the relative execution order of these methods. |
the same exception is happening in the first save() in my getUserId method (first post updated with code) |
can this be related? #138 |
You're Are either of you able to reproduce successfully? From the information you've both provided, we would need the network requests being sent/received or the on disk user data to further debug this issue. |
I haven't tried to repro, I'm not sure what would cause this bug. Can you offer any insight as to what might be required to repro? I've never seen these methods fail for me in this manner. |
Unfortunately this seems like an impossible scenario for me, so I'm not entirely sure how this could happen or even reproduce it. From my current understanding of the problem, somehow a |
@grantland what code would you like me to add to my app to capture/log data to help get this bug fixed? |
Bump |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
I don't have any additional info, I'm waiting for response |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
@grantland any further data you need from me to help figure this one out? |
Unfortunately we won't be able to investigate this further without the user JSON that was sent over the network and the same JSON persisted in LDS which requires you to be able to reproduce this issue on a development device. |
What is LDS? So is there no way for me to add code to get that data? Could you add code to the SDK to expose it? If you have some suggestions on how to repro I'd be happy to try them out. The JSON sent over the network - that comes from you guys, right? I'm not sure I can help you there. |
LDS is Local Datastore LDS is not accessible programmatically and there aren't plans to enable access to it programmatically due to the fact that the internal storage mechanism and format is subject to change. Gathering data sent over the network on our side isn't a viable option since we won't be able to isolate requests that cause issues in live clients. With these two limitations, the only way to proceed with this issue is for this to be reproduced on a development device so that we can use tools like ParseInterceptors and adb to monitor the network requests and SQLite storage on the device. |
Hey @grantland lets focus on things we can do, not things we can't :) If you are able to repro this locally, then great, but I have no idea where to start on this to cause this parse bug to repro. I do have users who experience this bug, and I'm happy to add any code necessary. I'd imagine if we both were willing to add some code to track this down then it could be solved. It sounds like you're saying you're not willing to take the steps necessary to solve this. Thinking aloud, couldn't I also just write some code to grab your LDS sqlite database and upload it when this issue happens? If this bug was in my code, here are things I would do:
|
Debugging an issue in the wild is not something I'd recommend, but if you're willing to dive into unsupported territory, you can find our SQLite storage configurations here: https://github.com/ParsePlatform/Parse-SDK-Android/blob/master/Parse/src/main/java/com/parse/OfflineSQLiteOpenHelper.java#L60 I understand that this might be an error within our SDK, but without concise repro steps we don't have enough information to pinpoint the problem to solve it and therefore do not have any actionable items without it. Please see our Contributing Guidelines for more information regarding bug reporting. |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
4 similar comments
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback. |
I'm experiencing this issue. Did anyone find a fix for it? |
+1 Same issue with this code:
And the trace is this one:
I use the latest version (1.13.0) |
FIXED The exception was thrown when the User had issues disconnecting. Nothing to do with Android API or device.Hi, I am having this same issue with this code on an Android Api 17 (Samsung Galaxy Trend Plus)
Does anyone know how to solve it? This exact code is working on other devices. It's really weird. Thank you |
@grantland I got serverData dump. I got following log via crashlytics, with
apparently, sessionToken is null :( |
maybe a stored value in sessionToken is |
I got same issue on user fetch any solution ? |
current workaround which is working for me is this: package com.parse;
import org.json.JSONObject;
public class ParseUtil {
private ParseUtil() {
// no-op
}
public static String getCurrentSessionToken() {
return getSessionToken(ParseUser.getCurrentUser());
}
public static String getSessionToken(ParseUser parseUser) {
if (parseUser == null) {
return null;
}
Object value = parseUser.getState().get("sessionToken");
if (JSONObject.NULL.equals(value)) {
return null;
}
return (String) value;
}
} |
I have the same issue - session token null for anonymous user after calling saveInBackground(). For some reason calling enableLocalDataStore() in the beginning (and reinstalling the app) fixes it... |
This still happens. When i update an app, the crash in parse sdk happens here: i believe it is because the session token itself is null. The other question, is why the session token becomes null? |
PR to fix the cast issue: #723 |
This should be fixed by #724 , if you still see some of these, please let us know |
Check for JSONObject.NULL before casting to String [Fixes #209]
Check for JSONObject.NULL before casting to String [Fixes parse-community#209]
I updated sdk from 1.10.0 to 1.10.3, now on ParseUser.logOut() I have this error apparently at random.
happened on my development app as well as production app.
Everything was working fine before the upgrade.
if need anything more I will try to be helpful.
this is part of MyUser class
The text was updated successfully, but these errors were encountered: