diff options
author | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
commit | 9f606f95f03a75961498803e24bee6799a7c0885 (patch) | |
tree | a45f4d74feda9b76277a0c9ced55ad15d82248a1 /src/proguard/DataEntryWriterFactory.java | |
parent | cfead78069f3dc32998dc118ee08cab3867acea2 (diff) | |
download | proguard-jb-mr1-dev.tar.gz |
Revert "Upgrade from Progaurd 4.4 to 4.7."android-sdk-support_r11android-cts-4.2_r2android-cts-4.1_r4android-cts-4.1_r2android-cts-4.1_r1tools_r22tools_r21jb-mr1.1-dev-plus-aospjb-mr1.1-devjb-mr1-dev-plus-aospjb-mr1-devjb-dev
This reverts commit cfead78069f3dc32998dc118ee08cab3867acea2.
Bug: 6079915
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); + } } |