1616 * limitations under the License.
1717 */
1818
19-
19+
2020
2121package com .dtstack .flink .sql .launcher ;
2222
@@ -66,8 +66,7 @@ public class LauncherMain {
6666
6767 private static String getLocalCoreJarPath (String localSqlRootJar ) throws Exception {
6868 String jarPath = PluginUtil .getCoreJarFileName (localSqlRootJar , CORE_JAR );
69- String corePath = localSqlRootJar + SP + jarPath ;
70- return corePath ;
69+ return localSqlRootJar + SP + jarPath ;
7170 }
7271
7372 public static void main (String [] args ) throws Exception {
@@ -104,6 +103,7 @@ public static void main(String[] args) throws Exception {
104103 String flinkConfDir = launcherOptions .getFlinkconf ();
105104 Configuration config = StringUtils .isEmpty (flinkConfDir ) ? new Configuration () : GlobalConfiguration .loadConfiguration (flinkConfDir );
106105 JobGraph jobGraph = PackagedProgramUtils .createJobGraph (program , config , 1 );
106+
107107 PerJobSubmitter .submit (launcherOptions , jobGraph , config );
108108 } else {
109109 ClusterClient clusterClient = ClusterClientFactory .createClusterClient (launcherOptions );
@@ -115,35 +115,35 @@ public static void main(String[] args) throws Exception {
115115
116116 private static String [] parseJson (String [] args ) {
117117 BufferedReader reader = null ;
118- String lastStr = "" ;
119- try {
118+ StringBuilder lastStr = new StringBuilder () ;
119+ try {
120120 FileInputStream fileInputStream = new FileInputStream (args [0 ]);
121- InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , "UTF-8" );
121+ InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , Charsets . UTF_8 );
122122 reader = new BufferedReader (inputStreamReader );
123- String tempString = null ;
124- while ((tempString = reader .readLine ()) != null ){
125- lastStr += tempString ;
123+ String tempString ;
124+ while ((tempString = reader .readLine ()) != null ) {
125+ lastStr . append ( tempString ) ;
126126 }
127127 reader .close ();
128- }catch (IOException e ){
128+ } catch (IOException e ) {
129129 e .printStackTrace ();
130- }finally {
131- if (reader != null ){
130+ } finally {
131+ if (reader != null ) {
132132 try {
133133 reader .close ();
134134 } catch (IOException e ) {
135135 e .printStackTrace ();
136136 }
137137 }
138138 }
139- Map <String , Object > map = JSON .parseObject (lastStr , new TypeReference <Map <String , Object >>(){} );
139+ Map <String , Object > map = JSON .parseObject (lastStr .toString (), new TypeReference <Map <String , Object >>() {
140+ });
140141 List <String > list = new LinkedList <>();
141142
142143 for (Map .Entry <String , Object > entry : map .entrySet ()) {
143144 list .add ("-" + entry .getKey ());
144145 list .add (entry .getValue ().toString ());
145146 }
146- String [] array = list .toArray (new String [list .size ()]);
147- return array ;
147+ return list .toArray (new String [0 ]);
148148 }
149149}
0 commit comments