diff options
Diffstat (limited to 'src/proguard/DataEntryWriterFactory.java')
-rw-r--r-- | src/proguard/DataEntryWriterFactory.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/proguard/DataEntryWriterFactory.java b/src/proguard/DataEntryWriterFactory.java index 0da890b..9fbc6d0 100644 --- a/src/proguard/DataEntryWriterFactory.java +++ b/src/proguard/DataEntryWriterFactory.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -65,10 +65,11 @@ public class DataEntryWriterFactory private static DataEntryWriter createClassPathEntryWriter(ClassPathEntry classPathEntry, DataEntryWriter alternativeWriter) { - boolean isJar = classPathEntry.isJar(); - boolean isWar = classPathEntry.isWar(); - boolean isEar = classPathEntry.isEar(); - boolean isZip = classPathEntry.isZip(); + String entryName = classPathEntry.getName(); + boolean isJar = endsWithIgnoreCase(entryName, ".jar"); + boolean isWar = endsWithIgnoreCase(entryName, ".war"); + boolean isEar = endsWithIgnoreCase(entryName, ".ear"); + boolean isZip = endsWithIgnoreCase(entryName, ".zip"); List filter = classPathEntry.getFilter(); List jarFilter = classPathEntry.getJarFilter(); @@ -82,7 +83,7 @@ public class DataEntryWriterFactory isEar ? "ear" : isZip ? "zip" : "directory") + - " [" + classPathEntry.getName() + "]" + + " [" + entryName + "]" + (filter != null || jarFilter != null || warFilter != null || @@ -147,4 +148,17 @@ public class DataEntryWriterFactory filteredJarWriter, isJar ? jarWriter : writer); } + + + /** + * Returns whether the given string ends with the given suffix, ignoring its + * case. + */ + private static boolean endsWithIgnoreCase(String string, String suffix) + { + int stringLength = string.length(); + int suffixLength = suffix.length(); + + return string.regionMatches(true, stringLength - suffixLength, suffix, 0, suffixLength); + } } |