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

NullPointerException when retreiving from Parse Cloud function #60

Closed
kssaboo opened this issue Oct 16, 2015 · 4 comments
Closed

NullPointerException when retreiving from Parse Cloud function #60

kssaboo opened this issue Oct 16, 2015 · 4 comments

Comments

@kssaboo
Copy link

kssaboo commented Oct 16, 2015

I have a problem #159, parse-community/Parse-SDK-Android#159 (comment)
Hasn't been resolved in JS SDK 1.6.7, Android 1.10.3

Android Code

   ParseCloud.callFunctionInBackground("schedule", new HashMap<String, Object>(), new FunctionCallback<List<Object>>() {
        public void done(List<Object> itemList, ParseException e) {
            if (e == null) {
                arraySchedule.addAll(itemList);
            } else {
                Log.d("item", "Error: " + e.getMessage());
            }
        }
    });

and it's work well in JavaScript.

        Parse.Cloud.run('schedule', {}, {
          success: function(results) {
            // TODO
          },
          error: function(error) {
          }
        });

Cloud Code

Parse.Cloud.define("schedule", function(request, response) {

    var ScheduleToday = Parse.Object.extend("LiveScheduleToday");
    var scheduleTodayQuery = new Parse.Query(ScheduleToday);
    scheduleTodayQuery.include("contentId");
    scheduleTodayQuery.include("contentId.VodCategory");

    scheduleTodayQuery.find().then( function(result) {
        response.success(result);
    });
});

Here is the adb log.

could not parse date: {"iso":"2015-10-16T02:33:11.095Z","__type":"Date"}
java.text.ParseException: Unparseable date: "{"iso":"2015-10-16T02:33:11.095Z","__type":"Date"}" (at offset 0)
at java.text.DateFormat.parse(DateFormat.java:555)
at com.parse.ParseDateFormat.parse(ParseDateFormat.java:42)
at com.parse.ParseObject.mergeFromServer(ParseObject.java:990)
at com.parse.ParseObject.fromJSON(ParseObject.java:686)
at com.parse.ParseDecoder.decode(ParseDecoder.java:125)
at com.parse.ParseDecoder.convertJSONArrayToList(ParseDecoder.java:45)
at com.parse.ParseDecoder.decode(ParseDecoder.java:71)
at com.parse.ParseCloudCodeController.convertCloudResponse(ParseCloudCodeController.java:52)
at com.parse.ParseCloudCodeController$1.then(ParseCloudCodeController.java:36)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$12.then(Task.java:679)
at bolts.Task$12.then(Task.java:667)
at bolts.Task$15.run(Task.java:825)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:816)
at bolts.Task.access$200(Task.java:32)
at bolts.Task$11.then(Task.java:621)
at bolts.Task$11.then(Task.java:618)
at bolts.Task.runContinuations(Task.java:861)
at bolts.Task.access$600(Task.java:32)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:916)
at bolts.Task$TaskCompletionSource.setResult(Task.java:950)
at bolts.Task$15$1.then(Task.java:842)
at bolts.Task$15$1.then(Task.java:829)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$15.run(Task.java:829)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:816)
at bolts.Task.access$200(Task.java:32)
at bolts.Task$11.then(Task.java:621)
at bolts.Task$11.then(Task.java:618)
at bolts.Task.runContinuations(Task.java:861)
at bolts.Task.access$600(Task.java:32)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:916)
at bolts.Task$TaskCompletionSource.setResult(Task.java:950)
at bolts.Task$15$1.then(Task.java:842)
at bolts.Task$15$1.then(Task.java:829)
at bolts.Task$14.run(Task.java:784)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:775)
at bolts.Task.continueWith(Task.java:574)
at bolts.Task.continueWith(Task.java:585)
at bolts.Task$15.run(Task.java:829)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
@parse-github-bot
Copy link

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.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

@wangmengyan95
Copy link
Contributor

Hi @kssaboo, I tested a similar include query in cloud code and it worked fine in my emulator.
Could you open your cloud code's .parse.project file and set the version to 1.6.7 and try again

{
  "project_type": 1,
  "parse": {
    "jssdk": "1.6.7" // Change latest to 1.6.7
  },
  "email": "XXXXX"
}

@kssaboo
Copy link
Author

kssaboo commented Oct 16, 2015

JS SDK was 1.6.7.
Tried again and now it works!.
Didn't change the jssdk version. Weird.
Thanks anyway.

@wangmengyan95
Copy link
Contributor

@kssaboo, glad it works.

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

4 participants