@@ -111,15 +111,15 @@ public static URL getRemoteJarFilePath(String pluginType, String tableType, Stri
111111 String dirName = pluginType + tableType .toLowerCase ();
112112 String prefix = String .format ("%s-%s" , pluginType , tableType .toLowerCase ());
113113 String jarPath = remoteSqlRootDir + SP + dirName ;
114- String jarName = getCoreJarFileName (jarPath , prefix );
114+ String jarName = getCoreJarFileName (jarPath , prefix , false );
115115 return new URL ("file:" + remoteSqlRootDir + SP + dirName + SP + jarName );
116116 }
117117
118118 public static URL getRemoteSideJarFilePath (String pluginType , String sideOperator , String tableType , String remoteSqlRootDir ) throws Exception {
119119 String dirName = pluginType + sideOperator + tableType .toLowerCase ();
120120 String prefix = String .format ("%s-%s-%s" , pluginType , sideOperator , tableType .toLowerCase ());
121121 String jarPath = remoteSqlRootDir + SP + dirName ;
122- String jarName = getCoreJarFileName (jarPath , prefix );
122+ String jarName = getCoreJarFileName (jarPath , prefix , false );
123123 return new URL ("file:" + remoteSqlRootDir + SP + dirName + SP + jarName );
124124 }
125125
@@ -144,7 +144,11 @@ public static void addPluginJar(String pluginDir, DtClassLoader classLoader) thr
144144 }
145145 }
146146
147- public static String getCoreJarFileName (String path , String prefix ) throws Exception {
147+ public static String getCoreJarFileName (String path , String prefix , boolean existCheck ) throws Exception {
148+ if (!existCheck ) {
149+ return prefix .toLowerCase () + ".jar" ;
150+ }
151+
148152 String coreJarFileName = null ;
149153 File pluginDir = new File (path );
150154 if (pluginDir .exists () && pluginDir .isDirectory ()){
@@ -158,10 +162,11 @@ public boolean accept(File dir, String name) {
158162 if (jarFiles != null && jarFiles .length > 0 ){
159163 coreJarFileName = jarFiles [0 ].getName ();
160164 }
161- }else {
162- coreJarFileName = prefix .toLowerCase () + ".jar" ;
163165 }
164166
167+ if (StringUtils .isEmpty (coreJarFileName )){
168+ throw new Exception ("Can not find core jar file in path:" + path );
169+ }
165170
166171 return coreJarFileName ;
167172 }
0 commit comments