Forums

Home » Mobile » Liferay Mobile SDK

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Marcel Brueckner
Mobile SDK: broken parameter OrderByComparator is ranked "minor" issue?
April 28, 2014 7:56 AM
Answer

Marcel Brueckner

Rank: New Member

Posts: 7

Join Date: August 30, 2013

Recent Posts

Hi everyone,

I did my first test with the mobile SDK and found the parameter handling of OrderByComparator broken.
There is a ticket for it in the queue, but it is ranked "minor", how is that?
Most of the content related APIs are using the parameter! I debugged into the issue on the server side and the issue is not easy to solve: the JSON deserializer is basically not getting a proper hint on how to decode the abstract class parameter "OrderbyComparator" and thus tries to instantiate the abstract class instead of the passed parameter type.

One workaround for now would be to pass a "null" parameter from SDK side, but this proves impossible, since the SDK expects the "obc" parameter to be initialized and thus throws an exception before forwarding the HTTP request.

Any quick workaround on the SDK side would be appreciated, since I would like to test the content fetching (DDLRecordSet, DDLRecord, DDMContent) to work. I do not really care about sorting atm, since getting the data at all would already be awesome :-).
Bruno Farache
RE: Mobile SDK: broken parameter OrderByComparator is ranked "minor" issue?
April 28, 2014 7:56 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 573

Join Date: May 14, 2007

Recent Posts

Marcel,

As you said, for those who don't know, we are working on this ticket.

We found out we need to pass the class name of the object comparator, we will change the param type from map to a string, the param will be called "obcClassName". You could manually make this workaround.

We plan to release a new version of the SDK soon with this fix and others. The priority is set to "minor" just because it's the default value in Jira, in fact, all tickets that are open there are important.
Marcel Brueckner
RE: Mobile SDK: broken parameter OrderByComparator is ranked "minor" issue?
April 28, 2014 8:32 AM
Answer

Marcel Brueckner

Rank: New Member

Posts: 7

Join Date: August 30, 2013

Recent Posts

Thanks for the quick response.

I don't want to eat up your time, thus the following is just a curious individual's question (feel free to ignore it):
I tried to make the change you described above and it seems like it's passing on the string parameter to the server side (I see the string in my JSON expression now). There it throws a ClassCastException, since it tries to convert the new string parameter into the actual OrderByComparator parameter.
If I inject a [NSNull null] right into the Service (instead of passing a string) I finally get no exceptions on the server side, but the log output looks wrong ("Request JSON web service action with path /ddlrecordset/search and method null for /"). The Client side (iOS) then returns an error code "Error state: (null), (null)".
Am I missing something?
Bruno Farache
RE: Mobile SDK: broken parameter OrderByComparator is ranked "minor" issue?
April 29, 2014 3:49 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 573

Join Date: May 14, 2007

Recent Posts

Marcel, sorry, my answer was incomplete.

The JSON needs something like this:

"+obc": "com.liferay.MyOrderByComparatorImpl"

If you need to pass null:

"-obc": ""
Bruno Farache
RE: Mobile SDK: broken parameter OrderByComparator is ranked "minor" issue?
May 7, 2014 12:46 PM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 573

Join Date: May 14, 2007

Recent Posts

Marcel,

We just released a new version (6.2.0.2) with this fix, check the release page. It is published to Cocoapods as well. Check out the docs.

Thank you letting us know about the bug.