@@ -53,12 +53,12 @@ public static synchronized void initActivityRouter(Context context, String ... s
53
53
}
54
54
55
55
public static boolean open (String url , Object ... params ){
56
- String temp = String . format ( Locale . ENGLISH , url , params );
56
+ String temp = formatUrl ( url , params );
57
57
return RouterManager .getSingleton ().open (temp );
58
58
}
59
59
60
60
public static boolean open (Context context , String url , Object ... params ){
61
- String temp = String . format ( Locale . ENGLISH , url , params );
61
+ String temp = formatUrl ( url , params );
62
62
return RouterManager .getSingleton ().open (context , temp );
63
63
}
64
64
@@ -78,7 +78,7 @@ public static void setDebugMode(boolean debug){
78
78
* @return
79
79
*/
80
80
public static IRoute getRoute (String url , Object ... params ){
81
- String temp = String . format ( Locale . ENGLISH , url , params );
81
+ String temp = formatUrl ( url , params );
82
82
return RouterManager .getSingleton ().getRoute (temp );
83
83
}
84
84
@@ -95,4 +95,16 @@ public static void setInterceptor(Interceptor interceptor){
95
95
RouterManager .getSingleton ().setInterceptor (interceptor );
96
96
}
97
97
98
+ private static String formatUrl (String url , Object ... params ) {
99
+ String formatted = url ;
100
+ try {
101
+ formatted = String .format (Locale .ENGLISH , url , params );
102
+ } catch (Exception e ) {
103
+ Timber .e ("ops" , e );
104
+ }
105
+
106
+ return formatted ;
107
+
108
+ }
109
+
98
110
}
0 commit comments