fixed crashes

This commit is contained in:
Mariotaku Lee 2016-12-01 22:02:10 +08:00
parent 62840c907a
commit ab3f7e8260
4 changed files with 8 additions and 11 deletions

View File

@ -74,7 +74,8 @@ public class TabArguments implements TwidereConstants {
}
@Nullable
public static TabArguments parse(@NonNull @CustomTabType String type, String json) throws IOException {
public static TabArguments parse(@NonNull @CustomTabType String type, @Nullable String json) throws IOException {
if (json == null) return null;
switch (type) {
case CustomTabType.HOME_TIMELINE:
case CustomTabType.NOTIFICATIONS_TIMELINE:

View File

@ -24,7 +24,8 @@ public abstract class TabExtras implements Parcelable {
}
@Nullable
public static TabExtras parse(@NonNull @CustomTabType String type, String json) throws IOException {
public static TabExtras parse(@NonNull @CustomTabType String type, @Nullable String json) throws IOException {
if (json == null) return null;
switch (type) {
case CustomTabType.NOTIFICATIONS_TIMELINE: {
return LoganSquare.parse(json, InteractionsTabExtras.class);

View File

@ -35,9 +35,9 @@ import android.support.v4.util.LongSparseArray;
import android.text.TextUtils;
import com.bluelinelabs.logansquare.JsonMapper;
import com.bluelinelabs.logansquare.LoganSquare;
import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.commons.logansquare.LoganSquareMapperFinder;
import org.mariotaku.microblog.library.twitter.model.Activity;
import org.mariotaku.sqliteqb.library.ArgsArray;
import org.mariotaku.sqliteqb.library.Columns;
@ -559,12 +559,7 @@ public class DataStoreUtils implements Constants {
final Cursor cur = resolver.query(uri, projection, selection.getSQL(), selectionArgs, null);
if (cur == null) return -1;
try {
final JsonMapper<UserFollowState> mapper;
try {
mapper = LoganSquareMapperFinder.mapperFor(UserFollowState.class);
} catch (LoganSquareMapperFinder.ClassLoaderDeadLockException e) {
return -1;
}
final JsonMapper<UserFollowState> mapper = LoganSquare.mapperFor(UserFollowState.class);
int total = 0;
cur.moveToFirst();
while (!cur.isAfterLast()) {

View File

@ -23,8 +23,8 @@ import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.support.annotation.WorkerThread
import android.util.Log
import com.bluelinelabs.logansquare.LoganSquare
import com.nostra13.universalimageloader.cache.disc.DiskCache
import org.mariotaku.commons.logansquare.LoganSquareMapperFinder
import org.mariotaku.microblog.library.MicroBlog
import org.mariotaku.microblog.library.MicroBlogException
import org.mariotaku.microblog.library.twitter.model.Paging
@ -227,7 +227,7 @@ abstract class MicroBlogAPIStatusesLoader(
val pos = PipedOutputStream()
val pis = PipedInputStream(pos)
val future = pool.submit(Callable<kotlin.Any> {
LoganSquareMapperFinder.mapperFor(ParcelableStatus::class.java).serialize(statuses, pos)
LoganSquare.serialize(statuses, pos)
null
})
val saved = fileCache.save(key, pis) { current, total -> !future.isDone }