14
14
*/
15
15
package org .apache .ibatis .io ;
16
16
17
- import org .apache .log4j .Logger ;
17
+ import org .apache .ibatis .logging .Log ;
18
+ import org .apache .ibatis .logging .LogFactory ;
18
19
19
20
import java .io .BufferedReader ;
20
21
import java .io .File ;
@@ -72,7 +73,7 @@ public class ResolverUtil<T> {
72
73
/**
73
74
* An instance of Log to use for logging in this class.
74
75
*/
75
- private static final Logger log = Logger . getLogger (ResolverUtil .class );
76
+ private static final Log log = LogFactory . getLog (ResolverUtil .class );
76
77
77
78
/**
78
79
* The magic header that indicates a JAR (ZIP) file.
@@ -295,7 +296,7 @@ protected List<String> listClassResources(URL url, String path) throws IOExcepti
295
296
is = url .openStream ();
296
297
JarInputStream jarInput = new JarInputStream (is );
297
298
for (JarEntry entry ; (entry = jarInput .getNextJarEntry ()) != null ;) {
298
- log .trace ("Jar entry: " + entry .getName ());
299
+ log .debug ("Jar entry: " + entry .getName ());
299
300
if (isRelevantResource (entry .getName ())) {
300
301
children .add (entry .getName ());
301
302
}
@@ -306,7 +307,7 @@ protected List<String> listClassResources(URL url, String path) throws IOExcepti
306
307
is = url .openStream ();
307
308
BufferedReader reader = new BufferedReader (new InputStreamReader (is ));
308
309
for (String line ; (line = reader .readLine ()) != null ;) {
309
- log .trace ("Reader entry: " + line );
310
+ log .debug ("Reader entry: " + line );
310
311
if (isRelevantResource (line )) {
311
312
children .add (line );
312
313
}
@@ -321,7 +322,7 @@ protected List<String> listClassResources(URL url, String path) throws IOExcepti
321
322
*/
322
323
if ("file" .equals (url .getProtocol ())) {
323
324
File file = new File (url .getFile ());
324
- log .trace ("Listing directory " + file .getAbsolutePath ());
325
+ log .debug ("Listing directory " + file .getAbsolutePath ());
325
326
if (file .isDirectory ()) {
326
327
children = Arrays .asList (file .list (new FilenameFilter () {
327
328
public boolean accept (File dir , String name ) {
@@ -344,7 +345,7 @@ public boolean accept(File dir, String name) {
344
345
for (String child : children ) {
345
346
String resourcePath = path + "/" + child ;
346
347
if (child .endsWith (".class" )) {
347
- log .trace ("Found class file: " + resourcePath );
348
+ log .debug ("Found class file: " + resourcePath );
348
349
resources .add (resourcePath );
349
350
} else {
350
351
URL childUrl = new URL (prefix + child );
@@ -391,7 +392,7 @@ protected List<String> listClassResources(JarInputStream jar, String path) throw
391
392
392
393
// Check file name
393
394
if (name .endsWith (".class" ) && name .startsWith (path )) {
394
- log .trace ("Found class file: " + name );
395
+ log .debug ("Found class file: " + name );
395
396
resources .add (name .substring (1 )); // Trim leading slash
396
397
}
397
398
}
@@ -411,13 +412,13 @@ protected List<String> listClassResources(JarInputStream jar, String path) throw
411
412
* @throws MalformedURLException
412
413
*/
413
414
protected URL findJarForResource (URL url , String path ) throws MalformedURLException {
414
- log .trace ("Find JAR URL: " + url );
415
+ log .debug ("Find JAR URL: " + url );
415
416
416
417
// If the file part of the URL is itself a URL, then that URL probably points to the JAR
417
418
try {
418
419
for (; ;) {
419
420
url = new URL (url .getFile ());
420
- log .trace ("Inner URL: " + url );
421
+ log .debug ("Inner URL: " + url );
421
422
}
422
423
}
423
424
catch (MalformedURLException e ) {
@@ -429,9 +430,9 @@ protected URL findJarForResource(URL url, String path) throws MalformedURLExcept
429
430
int index = jarUrl .lastIndexOf (".jar" );
430
431
if (index >= 0 ) {
431
432
jarUrl .setLength (index + 4 );
432
- log .trace ("Extracted JAR URL: " + jarUrl );
433
+ log .debug ("Extracted JAR URL: " + jarUrl );
433
434
} else {
434
- log .trace ("Not a JAR: " + jarUrl );
435
+ log .debug ("Not a JAR: " + jarUrl );
435
436
return null ;
436
437
}
437
438
@@ -442,7 +443,7 @@ protected URL findJarForResource(URL url, String path) throws MalformedURLExcept
442
443
return testUrl ;
443
444
} else {
444
445
// WebLogic fix: check if the URL's file exists in the filesystem.
445
- log .trace ("Not a JAR: " + jarUrl );
446
+ log .debug ("Not a JAR: " + jarUrl );
446
447
jarUrl .replace (0 , jarUrl .length (), testUrl .getFile ());
447
448
File file = new File (jarUrl .toString ());
448
449
@@ -452,7 +453,7 @@ protected URL findJarForResource(URL url, String path) throws MalformedURLExcept
452
453
// }
453
454
454
455
if (file .exists ()) {
455
- log .trace ("Trying real file: " + file .getAbsolutePath ());
456
+ log .debug ("Trying real file: " + file .getAbsolutePath ());
456
457
testUrl = file .toURI ().toURL ();
457
458
if (isJar (testUrl )) {
458
459
return testUrl ;
@@ -464,7 +465,7 @@ protected URL findJarForResource(URL url, String path) throws MalformedURLExcept
464
465
log .warn ("Invalid JAR URL: " + jarUrl );
465
466
}
466
467
467
- log .trace ("Not a JAR: " + jarUrl );
468
+ log .debug ("Not a JAR: " + jarUrl );
468
469
return null ;
469
470
}
470
471
@@ -544,7 +545,7 @@ protected void addIfMatching(Test test, String fqn) {
544
545
try {
545
546
String externalName = fqn .substring (0 , fqn .indexOf ('.' )).replace ('/' , '.' );
546
547
ClassLoader loader = getClassLoader ();
547
- log .trace ("Checking to see if class " + externalName + " matches criteria [" + test + "]" );
548
+ log .debug ("Checking to see if class " + externalName + " matches criteria [" + test + "]" );
548
549
549
550
Class type = loader .loadClass (externalName );
550
551
if (test .matches (type )) {
0 commit comments