~ubuntu-branches/ubuntu/trusty/proguard/trusty

« back to all changes in this revision

Viewing changes to src/proguard/io/DataEntryObfuscator.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-06-06 21:43:59 UTC
  • mfrom: (7.1.1 quantal)
  • Revision ID: package-import@ubuntu.com-20130606214359-anr49am8ewoj0taa
Tags: 4.8-0.1
* Non-maintainer upload.
* New upstream release. (Closes: #678049, #643255)
* Sync changes from Ubuntu packaging.
  - Thank you to Sebastian Carneiro.
* Bump Standards-Version to 3.9.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3
3
 *             of Java bytecode.
4
4
 *
5
 
 * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
 
5
 * Copyright (c) 2002-2012 Eric Lafortune (eric@graphics.cornell.edu)
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify it
8
8
 * under the terms of the GNU General Public License as published by the Free
75
75
        String dataEntryName = dataEntry.getName();
76
76
 
77
77
        // Try to find a corresponding class name by removing increasingly
78
 
        // long suffixes,
 
78
        // long suffixes.
79
79
        for (int suffixIndex = dataEntryName.length() - 1;
80
80
             suffixIndex > 0;
81
81
             suffixIndex--)
106
106
 
107
107
                        return new RenamedDataEntry(dataEntry, newDataEntryName);
108
108
                    }
109
 
 
 
109
                    else
 
110
                    {
 
111
                        // Otherwise stop looking.
 
112
                        return dataEntry;
 
113
                    }
 
114
                }
 
115
            }
 
116
        }
 
117
 
 
118
        // Try to find a corresponding package name by increasingly removing
 
119
        // more subpackages.
 
120
        String packagePrefix = dataEntryName;
 
121
        do
 
122
        {
 
123
            // Chop off the class name or the last subpackage name.
 
124
            packagePrefix = ClassUtil.internalPackagePrefix(packagePrefix);
 
125
 
 
126
            // Is there a package corresponding to the package prefix?
 
127
            String newPackagePrefix = (String)packagePrefixMap.get(packagePrefix);
 
128
            if (newPackagePrefix != null)
 
129
            {
 
130
                // Did the package get a new name?
 
131
                if (!packagePrefix.equals(newPackagePrefix))
 
132
                {
 
133
                    // Return a renamed data entry.
 
134
                    String newDataEntryName =
 
135
                        newPackagePrefix + dataEntryName.substring(packagePrefix.length());
 
136
 
 
137
                    return new RenamedDataEntry(dataEntry, newDataEntryName);
 
138
                }
 
139
                else
 
140
                {
110
141
                    // Otherwise stop looking.
111
 
                    break;
 
142
                    return dataEntry;
112
143
                }
113
144
            }
114
145
        }
115
 
 
116
 
        // Did the package get a new name?
117
 
        String packagePrefix    = ClassUtil.internalPackagePrefix(dataEntryName);
118
 
        String newPackagePrefix = (String)packagePrefixMap.get(packagePrefix);
119
 
        if (newPackagePrefix != null &&
120
 
            !packagePrefix.equals(newPackagePrefix))
121
 
        {
122
 
            // Return a renamed data entry.
123
 
            String newDataEntryName =
124
 
                newPackagePrefix + dataEntryName.substring(packagePrefix.length());
125
 
 
126
 
            return new RenamedDataEntry(dataEntry, newDataEntryName);
127
 
        }
 
146
        while (packagePrefix.length() > 0);
128
147
 
129
148
        return dataEntry;
130
149
    }