Skip to content

Commit

Permalink
if QigsawConfig.class is not found, don't throw runtime exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
kissonchan committed Dec 23, 2019
1 parent 00fb7f2 commit 30bba52
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
@RestrictTo(LIBRARY_GROUP)
public class SplitBaseInfoProvider {

private static final String TAG = "SplitBaseInfoProvider";

private static final String CLASS_QigsawConfig = ".QigsawConfig";

private static final String VERSION_NAME = "VERSION_NAME";
Expand All @@ -49,19 +51,20 @@ public class SplitBaseInfoProvider {

private static final String DEFAULT_VALUE = "unknown";

private static final String DEFAULT_SPLIT_INFO_VERSION_VALUE = "1.0.0";
private static final String DEFAULT_SPLIT_INFO_VERSION_VALUE = "unknown_1.0.0";

private static String sPackageName;

public static void setPackageName(String packageName) {
sPackageName = packageName;
}

private static Class getQigsawConfigClass() {
private static Class getQigsawConfigClass() throws ClassNotFoundException {
try {
return Class.forName(sPackageName + CLASS_QigsawConfig);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Qigsaw Error: Can't find class " + sPackageName + "QigsawConfig.class!");
SplitLog.w(TAG, "Qigsaw Warning: Can't find class " + sPackageName + ".QigsawConfig.class!");
throw e;
}
}

Expand All @@ -74,6 +77,8 @@ public static boolean isQigsawMode() {
//
} catch (IllegalAccessException e) {
//
} catch (ClassNotFoundException e) {
//
}
return false;
}
Expand All @@ -88,6 +93,8 @@ public static String getVersionName() {
//
} catch (IllegalAccessException e) {
//
} catch (ClassNotFoundException e) {
//
}
return DEFAULT_VALUE;
}
Expand All @@ -102,6 +109,8 @@ public static String getQigsawId() {
//
} catch (IllegalAccessException e) {
//
} catch (ClassNotFoundException e) {
//
}
return DEFAULT_VALUE;
}
Expand All @@ -116,6 +125,8 @@ public static String getDefaultSplitInfoVersion() {
//
} catch (IllegalAccessException e) {
//
} catch (ClassNotFoundException e) {
//
}
return DEFAULT_SPLIT_INFO_VERSION_VALUE;
}
Expand All @@ -130,6 +141,8 @@ public static String[] getDynamicFeatures() {
//
} catch (IllegalAccessException e) {
//
} catch (ClassNotFoundException e) {
//
}
return null;
}
Expand Down

0 comments on commit 30bba52

Please sign in to comment.