From eb9f615f70cd7d78dfdfd16cda3cee5b216df9f5 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Tue, 9 Jul 2024 11:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8=E6=8A=9B=E5=87=BA=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=BC=82=E5=B8=B8=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/pay/hw/HwBuilder.java | 8 ++--- .../com/yunbao/common/utils/GoogleUtils.java | 31 ++++++++++--------- .../lib_google/utils/GoogleBillingManage.java | 11 ++++--- .../lib_huawei/utils/HuaWeiPayManage.java | 2 +- .../main/activity/MyWalletActivity.java | 6 ++-- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java b/common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java index 776fa3873..9ddab63cd 100644 --- a/common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java +++ b/common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java index c97ea4a90..3924ac786 100644 --- a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java @@ -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(); } } }; diff --git a/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java b/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java index 0ba4267aa..20a2b38a4 100644 --- a/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java +++ b/lib_google/src/main/java/com/shayu/lib_google/utils/GoogleBillingManage.java @@ -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; } diff --git a/lib_huawei/src/main/java/com/shayu/lib_huawei/utils/HuaWeiPayManage.java b/lib_huawei/src/main/java/com/shayu/lib_huawei/utils/HuaWeiPayManage.java index 15afa1d7c..ff4aed887 100644 --- a/lib_huawei/src/main/java/com/shayu/lib_huawei/utils/HuaWeiPayManage.java +++ b/lib_huawei/src/main/java/com/shayu/lib_huawei/utils/HuaWeiPayManage.java @@ -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; } diff --git a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java index 5d50f0f66..a89ec5c31 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java @@ -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(); } }