将支付相关的异常抛出,改为异常输出

This commit is contained in:
Martin 2024-07-09 11:11:05 +08:00
parent 9c38f40098
commit eb9f615f70
5 changed files with 31 additions and 27 deletions

View File

@ -26,7 +26,7 @@ public class HwBuilder {
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
invite.getClass().getMethod("pay", String.class).invoke(invite, changeid);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -39,7 +39,7 @@ public class HwBuilder {
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
invite.getClass().getMethod("consume").invoke(invite);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -49,13 +49,13 @@ public class HwBuilder {
* @return
*/
public JSONObject getPayResult(Intent intent) {
JSONObject object;
JSONObject object = null;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
object = (JSONObject) invite.getClass().getMethod("getPayResult", Intent.class).invoke(invite, intent);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return object;
}

View File

@ -51,7 +51,7 @@ public class GoogleUtils {
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
flag = (boolean) googlePay.getClass().getMethod("getGoogleService").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return flag;
}
@ -87,13 +87,13 @@ public class GoogleUtils {
* @return
*/
public JSONObject getLoginResult(Intent intent) {
JSONObject object;
JSONObject object = null;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
object = (JSONObject) invite.getClass().getMethod("getLoginResult", Intent.class).invoke(invite, intent);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return object;
}
@ -108,7 +108,7 @@ public class GoogleUtils {
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
googlePay.getClass().getMethod("initGooglePay").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -120,7 +120,10 @@ public class GoogleUtils {
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
adId = (String) invite.getClass().getMethod("getAdid").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
return "";
/*throw new RuntimeException(e);*/
}
return adId;
}
@ -132,7 +135,7 @@ public class GoogleUtils {
try {
googlePay.getClass().getMethod("checkSku", String.class).invoke(googlePay, skuId);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -147,7 +150,7 @@ public class GoogleUtils {
try {
googlePay.getClass().getMethod("initResultCode").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
timer = new Timer();
@ -170,7 +173,7 @@ public class GoogleUtils {
billingListener.onPayFailed(mActivity.getString(R.string.pay_fail));
}
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
};
@ -183,7 +186,7 @@ public class GoogleUtils {
Object invite = clz.getConstructor(Context.class).newInstance(context);
invite.getClass().getMethod("initializeApp").invoke(invite);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -201,7 +204,7 @@ public class GoogleUtils {
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
};
@ -214,7 +217,7 @@ public class GoogleUtils {
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
googlePay.getClass().getMethod("initToken").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -224,7 +227,7 @@ public class GoogleUtils {
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
googlePay.getClass().getMethod("consumeAll").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -237,7 +240,7 @@ public class GoogleUtils {
.getMethod("setFirebaseCrashData", String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class)
.invoke(googlePay, uid, userData, isGoogle, cpu, runTime, enterRoom, slidingRoom, playSvga, ActivitySize);
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
@ -255,7 +258,7 @@ public class GoogleUtils {
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
};

View File

@ -135,7 +135,7 @@ public class GoogleBillingManage implements PurchasesUpdatedListener {
object.put("orderList", orderList);
object.put("tradeNo", tradeNo);
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return object;
}
@ -196,11 +196,12 @@ public class GoogleBillingManage implements PurchasesUpdatedListener {
try {
return AdvertisingIdClient.getAdvertisingIdInfo(mContext).getId();
} catch (IOException e) {
throw new RuntimeException(e);
e.printStackTrace();
return "";
} catch (GooglePlayServicesNotAvailableException e) {
throw new RuntimeException(e);
e.printStackTrace(); return "";
} catch (GooglePlayServicesRepairableException e) {
throw new RuntimeException(e);
e.printStackTrace(); return "";
}
}
@ -221,7 +222,7 @@ public class GoogleBillingManage implements PurchasesUpdatedListener {
object.put("resultToken", resultToken);
object.put("resultOrderId", resultOrderId);
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return object;
}

View File

@ -99,7 +99,7 @@ public class HuaWeiPayManage {
object.put("inAppPurchaseData", purchaseResultInfo.getInAppPurchaseData());
object.put("inAppPurchaseDataSignature", purchaseResultInfo.getInAppDataSignature());
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return object;
}

View File

@ -136,14 +136,14 @@ public class MyWalletActivity extends AbsActivity {
}
});
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
});
}
}
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
});
@ -491,7 +491,7 @@ public class MyWalletActivity extends AbsActivity {
} catch (JSONException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}