4848import java .io .IOException ;
4949import java .io .InputStreamReader ;
5050import java .net .URLDecoder ;
51+ import java .nio .charset .StandardCharsets ;
5152import java .util .LinkedList ;
5253import java .util .List ;
5354import java .util .Map ;
@@ -67,8 +68,7 @@ public class LauncherMain {
6768
6869 private static String getLocalCoreJarPath (String localSqlRootJar ) throws Exception {
6970 String jarPath = PluginUtil .getCoreJarFileName (localSqlRootJar , CORE_JAR );
70- String corePath = localSqlRootJar + SP + jarPath ;
71- return corePath ;
71+ return localSqlRootJar + SP + jarPath ;
7272 }
7373
7474 public static void main (String [] args ) throws Exception {
@@ -85,14 +85,14 @@ public static void main(String[] args) throws Exception {
8585 Properties confProperties = PluginUtil .jsonStrToObject (confProp , Properties .class );
8686
8787 if (mode .equals (ClusterMode .local .name ())) {
88- String [] localArgs = argList .toArray (new String [argList . size () ]);
88+ String [] localArgs = argList .toArray (new String [0 ]);
8989 Main .main (localArgs );
9090 return ;
9191 }
9292
9393 String pluginRoot = launcherOptions .getLocalSqlPluginPath ();
9494 File jarFile = new File (getLocalCoreJarPath (pluginRoot ));
95- String [] remoteArgs = argList .toArray (new String [argList . size () ]);
95+ String [] remoteArgs = argList .toArray (new String [0 ]);
9696 PackagedProgram program = new PackagedProgram (jarFile , Lists .newArrayList (), remoteArgs );
9797
9898 String savePointPath = confProperties .getProperty (ConfigConstrant .SAVE_POINT_PATH_KEY );
@@ -116,14 +116,14 @@ public static void main(String[] args) throws Exception {
116116
117117 private static String [] parseJson (String [] args ) {
118118 BufferedReader reader = null ;
119- String lastStr = "" ;
119+ StringBuilder lastStr = new StringBuilder () ;
120120 try {
121121 FileInputStream fileInputStream = new FileInputStream (args [0 ]);
122- InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , "UTF-8" );
122+ InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , StandardCharsets . UTF_8 );
123123 reader = new BufferedReader (inputStreamReader );
124124 String tempString = null ;
125125 while ((tempString = reader .readLine ()) != null ){
126- lastStr += tempString ;
126+ lastStr . append ( tempString ) ;
127127 }
128128 reader .close ();
129129 }catch (IOException e ){
@@ -137,14 +137,13 @@ private static String[] parseJson(String[] args) {
137137 }
138138 }
139139 }
140- Map <String , Object > map = JSON .parseObject (lastStr , new TypeReference <Map <String , Object >>(){} );
140+ Map <String , Object > map = JSON .parseObject (lastStr . toString () , new TypeReference <Map <String , Object >>(){} );
141141 List <String > list = new LinkedList <>();
142142
143143 for (Map .Entry <String , Object > entry : map .entrySet ()) {
144144 list .add ("-" + entry .getKey ());
145145 list .add (entry .getValue ().toString ());
146146 }
147- String [] array = list .toArray (new String [list .size ()]);
148- return array ;
147+ return list .toArray (new String [0 ]);
149148 }
150149}
0 commit comments