author | mchung |
Fri, 20 Jun 2014 13:36:10 -0700 | |
changeset 25303 | 5f9e68207588 |
parent 22163 | 3651128c74eb |
permissions | -rw-r--r-- |
655
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
1 |
/* |
13631
dc1212c348f9
7191449: update copyright year to match last edit in jdk8 langtools repository
jjh
parents:
13076
diff
changeset
|
2 |
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
655
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
4 |
* |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
655
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
655
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
10 |
* |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
15 |
* accompanied this code). |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
16 |
* |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
20 |
* |
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
655
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
24 |
*/ |
1ebc7ce89018
6705945: com.sun.tools.javac.zip files do not have valid copyright
jjg
parents:
10
diff
changeset
|
25 |
|
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
26 |
package com.sun.tools.javac.file; |
10 | 27 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
28 |
|
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
29 |
import java.io.File; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
30 |
import java.io.FileNotFoundException; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
31 |
import java.io.IOException; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
32 |
import java.io.RandomAccessFile; |
4073
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
33 |
import java.lang.ref.Reference; |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
34 |
import java.lang.ref.SoftReference; |
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
35 |
import java.util.ArrayList; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
36 |
import java.util.Arrays; |
865
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
37 |
import java.util.Calendar; |
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
38 |
import java.util.Collections; |
13076
cb848b70d7f4
7177701: error: Filling jar message during javax/imageio/metadata/IIOMetadataFormatImpl compilation
mcimadamore
parents:
8837
diff
changeset
|
39 |
import java.util.LinkedHashMap; |
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
40 |
import java.util.HashMap; |
10 | 41 |
import java.util.List; |
731
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
42 |
import java.util.Map; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
43 |
import java.util.Set; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
44 |
import java.util.zip.DataFormatException; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
45 |
import java.util.zip.Inflater; |
1dd22bdb9ca5
6714364: refactor javac File handling code into new javac.file package
jjg
parents:
655
diff
changeset
|
46 |
import java.util.zip.ZipException; |
10 | 47 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
48 |
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
49 |
import com.sun.tools.javac.file.RelativePath.RelativeFile; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
50 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
51 |
/** |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
52 |
* This class implements the building of index of a zip archive and access to |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
53 |
* its context. It also uses a prebuilt index if available. |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
54 |
* It supports invocations where it will serialize an optimized zip index file |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
55 |
* to disk. |
10 | 56 |
* |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
57 |
* In order to use a secondary index file, set "usezipindex" in the Options |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
58 |
* object when JavacFileManager is invoked. (You can pass "-XDusezipindex" on |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
59 |
* the command line.) |
10 | 60 |
* |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
61 |
* Location where to look for/generate optimized zip index files can be |
14259 | 62 |
* provided using "{@code -XDcachezipindexdir=<directory>}". If this flag is not |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
63 |
* provided, the default location is the value of the "java.io.tmpdir" system |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
64 |
* property. |
10 | 65 |
* |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
66 |
* If "-XDwritezipindexfiles" is specified, there will be new optimized index |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
67 |
* file created for each archive, used by the compiler for compilation, at the |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
68 |
* location specified by the "cachezipindexdir" option. |
10 | 69 |
* |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
70 |
* If system property nonBatchMode option is specified the compiler will use |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
71 |
* timestamp checking to reindex the zip files if it is needed. In batch mode |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
72 |
* the timestamps are not checked and the compiler uses the cached indexes. |
3380
a6c2bcab0fec
6865399: some javac files are missing Sun internal API comment
jjg
parents:
1789
diff
changeset
|
73 |
* |
5847
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
74 |
* <p><b>This is NOT part of any supported API. |
3380
a6c2bcab0fec
6865399: some javac files are missing Sun internal API comment
jjg
parents:
1789
diff
changeset
|
75 |
* If you write code that depends on this, you do so at your own risk. |
a6c2bcab0fec
6865399: some javac files are missing Sun internal API comment
jjg
parents:
1789
diff
changeset
|
76 |
* This code and its internal interfaces are subject to change or |
a6c2bcab0fec
6865399: some javac files are missing Sun internal API comment
jjg
parents:
1789
diff
changeset
|
77 |
* deletion without notice.</b> |
10 | 78 |
*/ |
79 |
public class ZipFileIndex { |
|
80 |
private static final String MIN_CHAR = String.valueOf(Character.MIN_VALUE); |
|
81 |
private static final String MAX_CHAR = String.valueOf(Character.MAX_VALUE); |
|
82 |
||
83 |
public final static long NOT_MODIFIED = Long.MIN_VALUE; |
|
84 |
||
85 |
||
14801
d66cab4ef397
8003967: detect and remove all mutable implicit static enum fields in langtools
vromero
parents:
14259
diff
changeset
|
86 |
private static final boolean NON_BATCH_MODE = System.getProperty("nonBatchMode") != null;// TODO: Use -XD compiler switch for this. |
10 | 87 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
88 |
private Map<RelativeDirectory, DirectoryEntry> directories = |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
89 |
Collections.<RelativeDirectory, DirectoryEntry>emptyMap(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
90 |
private Set<RelativeDirectory> allDirs = |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
91 |
Collections.<RelativeDirectory>emptySet(); |
10 | 92 |
|
93 |
// ZipFileIndex data entries |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
94 |
final File zipFile; |
4073
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
95 |
private Reference<File> absFileRef; |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
96 |
long zipFileLastModified = NOT_MODIFIED; |
10 | 97 |
private RandomAccessFile zipRandomFile; |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
98 |
private Entry[] entries; |
10 | 99 |
|
100 |
private boolean readFromIndex = false; |
|
101 |
private File zipIndexFile = null; |
|
102 |
private boolean triedToReadIndex = false; |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
103 |
final RelativeDirectory symbolFilePrefix; |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
104 |
private final int symbolFilePrefixLength; |
10 | 105 |
private boolean hasPopulatedData = false; |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
106 |
long lastReferenceTimeStamp = NOT_MODIFIED; |
10 | 107 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
108 |
private final boolean usePreindexedCache; |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
109 |
private final String preindexedCacheLocation; |
10 | 110 |
|
111 |
private boolean writeIndex = false; |
|
112 |
||
22163 | 113 |
private Map<String, SoftReference<RelativeDirectory>> relativeDirectoryCache = new HashMap<>(); |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
114 |
|
10 | 115 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
116 |
public synchronized boolean isOpen() { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
117 |
return (zipRandomFile != null); |
10 | 118 |
} |
119 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
120 |
ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex, |
10 | 121 |
boolean useCache, String cacheLocation) throws IOException { |
122 |
this.zipFile = zipFile; |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
123 |
this.symbolFilePrefix = symbolFilePrefix; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
124 |
this.symbolFilePrefixLength = (symbolFilePrefix == null ? 0 : |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
125 |
symbolFilePrefix.getPath().getBytes("UTF-8").length); |
10 | 126 |
this.writeIndex = writeIndex; |
127 |
this.usePreindexedCache = useCache; |
|
128 |
this.preindexedCacheLocation = cacheLocation; |
|
129 |
||
130 |
if (zipFile != null) { |
|
131 |
this.zipFileLastModified = zipFile.lastModified(); |
|
132 |
} |
|
133 |
||
134 |
// Validate integrity of the zip file |
|
135 |
checkIndex(); |
|
136 |
} |
|
137 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
138 |
@Override |
10 | 139 |
public String toString() { |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
140 |
return "ZipFileIndex[" + zipFile + "]"; |
10 | 141 |
} |
142 |
||
143 |
// Just in case... |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
144 |
@Override |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
145 |
protected void finalize() throws Throwable { |
10 | 146 |
closeFile(); |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
147 |
super.finalize(); |
10 | 148 |
} |
149 |
||
150 |
private boolean isUpToDate() { |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
151 |
if (zipFile != null |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
152 |
&& ((!NON_BATCH_MODE) || zipFileLastModified == zipFile.lastModified()) |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
153 |
&& hasPopulatedData) { |
10 | 154 |
return true; |
155 |
} |
|
156 |
||
157 |
return false; |
|
158 |
} |
|
159 |
||
160 |
/** |
|
161 |
* Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and |
|
162 |
* if its the same as the one at the time the index was build we don't need to reopen anything. |
|
163 |
*/ |
|
164 |
private void checkIndex() throws IOException { |
|
165 |
boolean isUpToDate = true; |
|
166 |
if (!isUpToDate()) { |
|
167 |
closeFile(); |
|
168 |
isUpToDate = false; |
|
169 |
} |
|
170 |
||
171 |
if (zipRandomFile != null || isUpToDate) { |
|
172 |
lastReferenceTimeStamp = System.currentTimeMillis(); |
|
173 |
return; |
|
174 |
} |
|
175 |
||
176 |
hasPopulatedData = true; |
|
177 |
||
178 |
if (readIndex()) { |
|
179 |
lastReferenceTimeStamp = System.currentTimeMillis(); |
|
180 |
return; |
|
181 |
} |
|
182 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
183 |
directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
184 |
allDirs = Collections.<RelativeDirectory>emptySet(); |
10 | 185 |
|
186 |
try { |
|
187 |
openFile(); |
|
188 |
long totalLength = zipRandomFile.length(); |
|
189 |
ZipDirectory directory = new ZipDirectory(zipRandomFile, 0L, totalLength, this); |
|
190 |
directory.buildIndex(); |
|
191 |
} finally { |
|
192 |
if (zipRandomFile != null) { |
|
193 |
closeFile(); |
|
194 |
} |
|
195 |
} |
|
196 |
||
197 |
lastReferenceTimeStamp = System.currentTimeMillis(); |
|
198 |
} |
|
199 |
||
200 |
private void openFile() throws FileNotFoundException { |
|
201 |
if (zipRandomFile == null && zipFile != null) { |
|
202 |
zipRandomFile = new RandomAccessFile(zipFile, "r"); |
|
203 |
} |
|
204 |
} |
|
205 |
||
206 |
private void cleanupState() { |
|
207 |
// Make sure there is a valid but empty index if the file doesn't exist |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
208 |
entries = Entry.EMPTY_ARRAY; |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
209 |
directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap(); |
10 | 210 |
zipFileLastModified = NOT_MODIFIED; |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
211 |
allDirs = Collections.<RelativeDirectory>emptySet(); |
10 | 212 |
} |
213 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
214 |
public synchronized void close() { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
215 |
writeIndex(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
216 |
closeFile(); |
10 | 217 |
} |
218 |
||
219 |
private void closeFile() { |
|
220 |
if (zipRandomFile != null) { |
|
221 |
try { |
|
222 |
zipRandomFile.close(); |
|
223 |
} catch (IOException ex) { |
|
224 |
} |
|
225 |
zipRandomFile = null; |
|
226 |
} |
|
227 |
} |
|
228 |
||
229 |
/** |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
230 |
* Returns the ZipFileIndexEntry for a path, if there is one. |
10 | 231 |
*/ |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
232 |
synchronized Entry getZipIndexEntry(RelativePath path) { |
10 | 233 |
try { |
234 |
checkIndex(); |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
235 |
DirectoryEntry de = directories.get(path.dirname()); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
236 |
String lookFor = path.basename(); |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
237 |
return (de == null) ? null : de.getEntry(lookFor); |
10 | 238 |
} |
239 |
catch (IOException e) { |
|
240 |
return null; |
|
241 |
} |
|
242 |
} |
|
243 |
||
244 |
/** |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
245 |
* Returns a javac List of filenames within a directory in the ZipFileIndex. |
10 | 246 |
*/ |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
247 |
public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) { |
10 | 248 |
try { |
249 |
checkIndex(); |
|
250 |
||
251 |
DirectoryEntry de = directories.get(path); |
|
252 |
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getFiles(); |
|
253 |
||
254 |
if (ret == null) { |
|
255 |
return com.sun.tools.javac.util.List.<String>nil(); |
|
256 |
} |
|
257 |
return ret; |
|
258 |
} |
|
259 |
catch (IOException e) { |
|
260 |
return com.sun.tools.javac.util.List.<String>nil(); |
|
261 |
} |
|
262 |
} |
|
263 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
264 |
public synchronized List<String> getDirectories(RelativeDirectory path) { |
10 | 265 |
try { |
266 |
checkIndex(); |
|
267 |
||
268 |
DirectoryEntry de = directories.get(path); |
|
269 |
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getDirectories(); |
|
270 |
||
271 |
if (ret == null) { |
|
272 |
return com.sun.tools.javac.util.List.<String>nil(); |
|
273 |
} |
|
274 |
||
275 |
return ret; |
|
276 |
} |
|
277 |
catch (IOException e) { |
|
278 |
return com.sun.tools.javac.util.List.<String>nil(); |
|
279 |
} |
|
280 |
} |
|
281 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
282 |
public synchronized Set<RelativeDirectory> getAllDirectories() { |
10 | 283 |
try { |
284 |
checkIndex(); |
|
285 |
if (allDirs == Collections.EMPTY_SET) { |
|
22163 | 286 |
allDirs = new java.util.LinkedHashSet<>(directories.keySet()); |
10 | 287 |
} |
288 |
||
289 |
return allDirs; |
|
290 |
} |
|
291 |
catch (IOException e) { |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
292 |
return Collections.<RelativeDirectory>emptySet(); |
10 | 293 |
} |
294 |
} |
|
295 |
||
296 |
/** |
|
297 |
* Tests if a specific path exists in the zip. This method will return true |
|
298 |
* for file entries and directories. |
|
299 |
* |
|
300 |
* @param path A path within the zip. |
|
301 |
* @return True if the path is a file or dir, false otherwise. |
|
302 |
*/ |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
303 |
public synchronized boolean contains(RelativePath path) { |
10 | 304 |
try { |
305 |
checkIndex(); |
|
306 |
return getZipIndexEntry(path) != null; |
|
307 |
} |
|
308 |
catch (IOException e) { |
|
309 |
return false; |
|
310 |
} |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
311 |
} |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
312 |
|
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
313 |
public synchronized boolean isDirectory(RelativePath path) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
314 |
// The top level in a zip file is always a directory. |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
315 |
if (path.getPath().length() == 0) { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
316 |
lastReferenceTimeStamp = System.currentTimeMillis(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
317 |
return true; |
10 | 318 |
} |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
319 |
|
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
320 |
checkIndex(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
321 |
return directories.get(path) != null; |
10 | 322 |
} |
323 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
324 |
public synchronized long getLastModified(RelativeFile path) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
325 |
Entry entry = getZipIndexEntry(path); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
326 |
if (entry == null) |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
327 |
throw new FileNotFoundException(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
328 |
return entry.getLastModified(); |
10 | 329 |
} |
330 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
331 |
public synchronized int length(RelativeFile path) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
332 |
Entry entry = getZipIndexEntry(path); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
333 |
if (entry == null) |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
334 |
throw new FileNotFoundException(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
335 |
|
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
336 |
if (entry.isDir) { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
337 |
return 0; |
10 | 338 |
} |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
339 |
|
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
340 |
byte[] header = getHeader(entry); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
341 |
// entry is not compressed? |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
342 |
if (get2ByteLittleEndian(header, 8) == 0) { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
343 |
return entry.compressedSize; |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
344 |
} else { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
345 |
return entry.size; |
10 | 346 |
} |
347 |
} |
|
348 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
349 |
public synchronized byte[] read(RelativeFile path) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
350 |
Entry entry = getZipIndexEntry(path); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
351 |
if (entry == null) |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
352 |
throw new FileNotFoundException("Path not found in ZIP: " + path.path); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
353 |
return read(entry); |
10 | 354 |
} |
355 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
356 |
synchronized byte[] read(Entry entry) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
357 |
openFile(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
358 |
byte[] result = readBytes(entry); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
359 |
closeFile(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
360 |
return result; |
10 | 361 |
} |
362 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
363 |
public synchronized int read(RelativeFile path, byte[] buffer) throws IOException { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
364 |
Entry entry = getZipIndexEntry(path); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
365 |
if (entry == null) |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
366 |
throw new FileNotFoundException(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
367 |
return read(entry, buffer); |
10 | 368 |
} |
369 |
||
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
370 |
synchronized int read(Entry entry, byte[] buffer) |
10 | 371 |
throws IOException { |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
372 |
int result = readBytes(entry, buffer); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
373 |
return result; |
10 | 374 |
} |
375 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
376 |
private byte[] readBytes(Entry entry) throws IOException { |
10 | 377 |
byte[] header = getHeader(entry); |
378 |
int csize = entry.compressedSize; |
|
379 |
byte[] cbuf = new byte[csize]; |
|
380 |
zipRandomFile.skipBytes(get2ByteLittleEndian(header, 26) + get2ByteLittleEndian(header, 28)); |
|
381 |
zipRandomFile.readFully(cbuf, 0, csize); |
|
382 |
||
383 |
// is this compressed - offset 8 in the ZipEntry header |
|
384 |
if (get2ByteLittleEndian(header, 8) == 0) |
|
385 |
return cbuf; |
|
386 |
||
387 |
int size = entry.size; |
|
388 |
byte[] buf = new byte[size]; |
|
389 |
if (inflate(cbuf, buf) != size) |
|
390 |
throw new ZipException("corrupted zip file"); |
|
391 |
||
392 |
return buf; |
|
393 |
} |
|
394 |
||
395 |
/** |
|
396 |
* |
|
397 |
*/ |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
398 |
private int readBytes(Entry entry, byte[] buffer) throws IOException { |
10 | 399 |
byte[] header = getHeader(entry); |
400 |
||
401 |
// entry is not compressed? |
|
402 |
if (get2ByteLittleEndian(header, 8) == 0) { |
|
403 |
zipRandomFile.skipBytes(get2ByteLittleEndian(header, 26) + get2ByteLittleEndian(header, 28)); |
|
404 |
int offset = 0; |
|
405 |
int size = buffer.length; |
|
406 |
while (offset < size) { |
|
407 |
int count = zipRandomFile.read(buffer, offset, size - offset); |
|
408 |
if (count == -1) |
|
409 |
break; |
|
410 |
offset += count; |
|
411 |
} |
|
412 |
return entry.size; |
|
413 |
} |
|
414 |
||
415 |
int csize = entry.compressedSize; |
|
416 |
byte[] cbuf = new byte[csize]; |
|
417 |
zipRandomFile.skipBytes(get2ByteLittleEndian(header, 26) + get2ByteLittleEndian(header, 28)); |
|
418 |
zipRandomFile.readFully(cbuf, 0, csize); |
|
419 |
||
420 |
int count = inflate(cbuf, buffer); |
|
421 |
if (count == -1) |
|
422 |
throw new ZipException("corrupted zip file"); |
|
423 |
||
424 |
return entry.size; |
|
425 |
} |
|
426 |
||
427 |
//---------------------------------------------------------------------------- |
|
428 |
// Zip utilities |
|
429 |
//---------------------------------------------------------------------------- |
|
430 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
431 |
private byte[] getHeader(Entry entry) throws IOException { |
10 | 432 |
zipRandomFile.seek(entry.offset); |
433 |
byte[] header = new byte[30]; |
|
434 |
zipRandomFile.readFully(header); |
|
435 |
if (get4ByteLittleEndian(header, 0) != 0x04034b50) |
|
436 |
throw new ZipException("corrupted zip file"); |
|
437 |
if ((get2ByteLittleEndian(header, 6) & 1) != 0) |
|
438 |
throw new ZipException("encrypted zip file"); // offset 6 in the header of the ZipFileEntry |
|
439 |
return header; |
|
440 |
} |
|
441 |
||
442 |
/* |
|
443 |
* Inflate using the java.util.zip.Inflater class |
|
444 |
*/ |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
445 |
private SoftReference<Inflater> inflaterRef; |
10 | 446 |
private int inflate(byte[] src, byte[] dest) { |
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
447 |
Inflater inflater = (inflaterRef == null ? null : inflaterRef.get()); |
10 | 448 |
|
449 |
// construct the inflater object or reuse an existing one |
|
450 |
if (inflater == null) |
|
22163 | 451 |
inflaterRef = new SoftReference<>(inflater = new Inflater(true)); |
10 | 452 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
453 |
inflater.reset(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
454 |
inflater.setInput(src); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
455 |
try { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
456 |
return inflater.inflate(dest); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
457 |
} catch (DataFormatException ex) { |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
458 |
return -1; |
10 | 459 |
} |
460 |
} |
|
461 |
||
462 |
/** |
|
463 |
* return the two bytes buf[pos], buf[pos+1] as an unsigned integer in little |
|
464 |
* endian format. |
|
465 |
*/ |
|
466 |
private static int get2ByteLittleEndian(byte[] buf, int pos) { |
|
467 |
return (buf[pos] & 0xFF) + ((buf[pos+1] & 0xFF) << 8); |
|
468 |
} |
|
469 |
||
470 |
/** |
|
471 |
* return the 4 bytes buf[i..i+3] as an integer in little endian format. |
|
472 |
*/ |
|
473 |
private static int get4ByteLittleEndian(byte[] buf, int pos) { |
|
474 |
return (buf[pos] & 0xFF) + ((buf[pos + 1] & 0xFF) << 8) + |
|
475 |
((buf[pos + 2] & 0xFF) << 16) + ((buf[pos + 3] & 0xFF) << 24); |
|
476 |
} |
|
477 |
||
478 |
/* ---------------------------------------------------------------------------- |
|
479 |
* ZipDirectory |
|
480 |
* ----------------------------------------------------------------------------*/ |
|
481 |
||
482 |
private class ZipDirectory { |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
483 |
private RelativeDirectory lastDir; |
10 | 484 |
private int lastStart; |
485 |
private int lastLen; |
|
486 |
||
487 |
byte[] zipDir; |
|
488 |
RandomAccessFile zipRandomFile = null; |
|
489 |
ZipFileIndex zipFileIndex = null; |
|
490 |
||
491 |
public ZipDirectory(RandomAccessFile zipRandomFile, long start, long end, ZipFileIndex index) throws IOException { |
|
492 |
this.zipRandomFile = zipRandomFile; |
|
493 |
this.zipFileIndex = index; |
|
8837 | 494 |
hasValidHeader(); |
495 |
findCENRecord(start, end); |
|
496 |
} |
|
10 | 497 |
|
8837 | 498 |
/* |
499 |
* the zip entry signature should be at offset 0, otherwise allow the |
|
500 |
* calling logic to take evasive action by throwing ZipFormatException. |
|
501 |
*/ |
|
502 |
private boolean hasValidHeader() throws IOException { |
|
503 |
final long pos = zipRandomFile.getFilePointer(); |
|
504 |
try { |
|
505 |
if (zipRandomFile.read() == 'P') { |
|
506 |
if (zipRandomFile.read() == 'K') { |
|
507 |
if (zipRandomFile.read() == 0x03) { |
|
508 |
if (zipRandomFile.read() == 0x04) { |
|
509 |
return true; |
|
510 |
} |
|
511 |
} |
|
512 |
} |
|
513 |
} |
|
514 |
} finally { |
|
515 |
zipRandomFile.seek(pos); |
|
516 |
} |
|
517 |
throw new ZipFormatException("invalid zip magic"); |
|
10 | 518 |
} |
519 |
||
520 |
/* |
|
521 |
* Reads zip file central directory. |
|
522 |
* For more details see readCEN in zip_util.c from the JDK sources. |
|
523 |
* This is a Java port of that function. |
|
524 |
*/ |
|
525 |
private void findCENRecord(long start, long end) throws IOException { |
|
526 |
long totalLength = end - start; |
|
527 |
int endbuflen = 1024; |
|
528 |
byte[] endbuf = new byte[endbuflen]; |
|
529 |
long endbufend = end - start; |
|
530 |
||
531 |
// There is a variable-length field after the dir offset record. We need to do consequential search. |
|
532 |
while (endbufend >= 22) { |
|
533 |
if (endbufend < endbuflen) |
|
534 |
endbuflen = (int)endbufend; |
|
535 |
long endbufpos = endbufend - endbuflen; |
|
536 |
zipRandomFile.seek(start + endbufpos); |
|
537 |
zipRandomFile.readFully(endbuf, 0, endbuflen); |
|
538 |
int i = endbuflen - 22; |
|
539 |
while (i >= 0 && |
|
540 |
!(endbuf[i] == 0x50 && |
|
541 |
endbuf[i + 1] == 0x4b && |
|
542 |
endbuf[i + 2] == 0x05 && |
|
543 |
endbuf[i + 3] == 0x06 && |
|
544 |
endbufpos + i + 22 + |
|
545 |
get2ByteLittleEndian(endbuf, i + 20) == totalLength)) { |
|
546 |
i--; |
|
547 |
} |
|
548 |
||
549 |
if (i >= 0) { |
|
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
550 |
zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12)]; |
8837 | 551 |
int sz = get4ByteLittleEndian(endbuf, i + 16); |
552 |
// a negative offset or the entries field indicates a |
|
553 |
// potential zip64 archive |
|
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
554 |
if (sz < 0 || get2ByteLittleEndian(endbuf, i + 10) == 0xffff) { |
8837 | 555 |
throw new ZipFormatException("detected a zip64 archive"); |
556 |
} |
|
557 |
zipRandomFile.seek(start + sz); |
|
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
558 |
zipRandomFile.readFully(zipDir, 0, zipDir.length); |
10 | 559 |
return; |
560 |
} else { |
|
561 |
endbufend = endbufpos + 21; |
|
562 |
} |
|
563 |
} |
|
564 |
throw new ZipException("cannot read zip file"); |
|
565 |
} |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
566 |
|
10 | 567 |
private void buildIndex() throws IOException { |
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
568 |
int len = zipDir.length; |
10 | 569 |
|
570 |
// Add each of the files |
|
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
571 |
if (len > 0) { |
22163 | 572 |
directories = new LinkedHashMap<>(); |
573 |
ArrayList<Entry> entryList = new ArrayList<>(); |
|
14964
391288e42c67
8003512: javac doesn't work with jar files with >64k entries
vromero
parents:
14801
diff
changeset
|
574 |
for (int pos = 0; pos < len; ) { |
10 | 575 |
pos = readEntry(pos, entryList, directories); |
576 |
} |
|
577 |
||
578 |
// Add the accumulated dirs into the same list |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
579 |
for (RelativeDirectory d: directories.keySet()) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
580 |
// use shared RelativeDirectory objects for parent dirs |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
581 |
RelativeDirectory parent = getRelativeDirectory(d.dirname().getPath()); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
582 |
String file = d.basename(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
583 |
Entry zipFileIndexEntry = new Entry(parent, file); |
10 | 584 |
zipFileIndexEntry.isDir = true; |
585 |
entryList.add(zipFileIndexEntry); |
|
586 |
} |
|
587 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
588 |
entries = entryList.toArray(new Entry[entryList.size()]); |
10 | 589 |
Arrays.sort(entries); |
590 |
} else { |
|
591 |
cleanupState(); |
|
592 |
} |
|
593 |
} |
|
594 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
595 |
private int readEntry(int pos, List<Entry> entryList, |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
596 |
Map<RelativeDirectory, DirectoryEntry> directories) throws IOException { |
10 | 597 |
if (get4ByteLittleEndian(zipDir, pos) != 0x02014b50) { |
598 |
throw new ZipException("cannot read zip file entry"); |
|
599 |
} |
|
600 |
||
601 |
int dirStart = pos + 46; |
|
602 |
int fileStart = dirStart; |
|
603 |
int fileEnd = fileStart + get2ByteLittleEndian(zipDir, pos + 28); |
|
604 |
||
605 |
if (zipFileIndex.symbolFilePrefixLength != 0 && |
|
606 |
((fileEnd - fileStart) >= symbolFilePrefixLength)) { |
|
607 |
dirStart += zipFileIndex.symbolFilePrefixLength; |
|
608 |
fileStart += zipFileIndex.symbolFilePrefixLength; |
|
609 |
} |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
610 |
// Force any '\' to '/'. Keep the position of the last separator. |
10 | 611 |
for (int index = fileStart; index < fileEnd; index++) { |
612 |
byte nextByte = zipDir[index]; |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
613 |
if (nextByte == (byte)'\\') { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
614 |
zipDir[index] = (byte)'/'; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
615 |
fileStart = index + 1; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
616 |
} else if (nextByte == (byte)'/') { |
10 | 617 |
fileStart = index + 1; |
618 |
} |
|
619 |
} |
|
620 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
621 |
RelativeDirectory directory = null; |
10 | 622 |
if (fileStart == dirStart) |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
623 |
directory = getRelativeDirectory(""); |
10 | 624 |
else if (lastDir != null && lastLen == fileStart - dirStart - 1) { |
625 |
int index = lastLen - 1; |
|
626 |
while (zipDir[lastStart + index] == zipDir[dirStart + index]) { |
|
627 |
if (index == 0) { |
|
628 |
directory = lastDir; |
|
629 |
break; |
|
630 |
} |
|
631 |
index--; |
|
632 |
} |
|
633 |
} |
|
634 |
||
635 |
// Sub directories |
|
636 |
if (directory == null) { |
|
637 |
lastStart = dirStart; |
|
638 |
lastLen = fileStart - dirStart - 1; |
|
639 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
640 |
directory = getRelativeDirectory(new String(zipDir, dirStart, lastLen, "UTF-8")); |
10 | 641 |
lastDir = directory; |
642 |
||
643 |
// Enter also all the parent directories |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
644 |
RelativeDirectory tempDirectory = directory; |
10 | 645 |
|
646 |
while (directories.get(tempDirectory) == null) { |
|
647 |
directories.put(tempDirectory, new DirectoryEntry(tempDirectory, zipFileIndex)); |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
648 |
if (tempDirectory.path.indexOf("/") == tempDirectory.path.length() - 1) |
10 | 649 |
break; |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
650 |
else { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
651 |
// use shared RelativeDirectory objects for parent dirs |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
652 |
tempDirectory = getRelativeDirectory(tempDirectory.dirname().getPath()); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
653 |
} |
10 | 654 |
} |
655 |
} |
|
656 |
else { |
|
657 |
if (directories.get(directory) == null) { |
|
658 |
directories.put(directory, new DirectoryEntry(directory, zipFileIndex)); |
|
659 |
} |
|
660 |
} |
|
661 |
||
662 |
// For each dir create also a file |
|
663 |
if (fileStart != fileEnd) { |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
664 |
Entry entry = new Entry(directory, |
10 | 665 |
new String(zipDir, fileStart, fileEnd - fileStart, "UTF-8")); |
666 |
||
667 |
entry.setNativeTime(get4ByteLittleEndian(zipDir, pos + 12)); |
|
668 |
entry.compressedSize = get4ByteLittleEndian(zipDir, pos + 20); |
|
669 |
entry.size = get4ByteLittleEndian(zipDir, pos + 24); |
|
670 |
entry.offset = get4ByteLittleEndian(zipDir, pos + 42); |
|
671 |
entryList.add(entry); |
|
672 |
} |
|
673 |
||
674 |
return pos + 46 + |
|
675 |
get2ByteLittleEndian(zipDir, pos + 28) + |
|
676 |
get2ByteLittleEndian(zipDir, pos + 30) + |
|
677 |
get2ByteLittleEndian(zipDir, pos + 32); |
|
678 |
} |
|
679 |
} |
|
680 |
||
681 |
/** |
|
682 |
* Returns the last modified timestamp of a zip file. |
|
683 |
* @return long |
|
684 |
*/ |
|
685 |
public long getZipFileLastModified() throws IOException { |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
686 |
synchronized (this) { |
10 | 687 |
checkIndex(); |
688 |
return zipFileLastModified; |
|
689 |
} |
|
690 |
} |
|
691 |
||
692 |
/** ------------------------------------------------------------------------ |
|
693 |
* DirectoryEntry class |
|
694 |
* -------------------------------------------------------------------------*/ |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
695 |
|
10 | 696 |
static class DirectoryEntry { |
697 |
private boolean filesInited; |
|
698 |
private boolean directoriesInited; |
|
699 |
private boolean zipFileEntriesInited; |
|
700 |
private boolean entriesInited; |
|
701 |
||
702 |
private long writtenOffsetOffset = 0; |
|
703 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
704 |
private RelativeDirectory dirName; |
10 | 705 |
|
706 |
private com.sun.tools.javac.util.List<String> zipFileEntriesFiles = com.sun.tools.javac.util.List.<String>nil(); |
|
707 |
private com.sun.tools.javac.util.List<String> zipFileEntriesDirectories = com.sun.tools.javac.util.List.<String>nil(); |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
708 |
private com.sun.tools.javac.util.List<Entry> zipFileEntries = com.sun.tools.javac.util.List.<Entry>nil(); |
10 | 709 |
|
22163 | 710 |
private List<Entry> entries = new ArrayList<>(); |
10 | 711 |
|
712 |
private ZipFileIndex zipFileIndex; |
|
713 |
||
714 |
private int numEntries; |
|
715 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
716 |
DirectoryEntry(RelativeDirectory dirName, ZipFileIndex index) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
717 |
filesInited = false; |
10 | 718 |
directoriesInited = false; |
719 |
entriesInited = false; |
|
720 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
721 |
this.dirName = dirName; |
10 | 722 |
this.zipFileIndex = index; |
723 |
} |
|
724 |
||
725 |
private com.sun.tools.javac.util.List<String> getFiles() { |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
726 |
if (!filesInited) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
727 |
initEntries(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
728 |
for (Entry e : entries) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
729 |
if (!e.isDir) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
730 |
zipFileEntriesFiles = zipFileEntriesFiles.append(e.name); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
731 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
732 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
733 |
filesInited = true; |
10 | 734 |
} |
735 |
return zipFileEntriesFiles; |
|
736 |
} |
|
737 |
||
738 |
private com.sun.tools.javac.util.List<String> getDirectories() { |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
739 |
if (!directoriesInited) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
740 |
initEntries(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
741 |
for (Entry e : entries) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
742 |
if (e.isDir) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
743 |
zipFileEntriesDirectories = zipFileEntriesDirectories.append(e.name); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
744 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
745 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
746 |
directoriesInited = true; |
10 | 747 |
} |
748 |
return zipFileEntriesDirectories; |
|
749 |
} |
|
750 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
751 |
private com.sun.tools.javac.util.List<Entry> getEntries() { |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
752 |
if (!zipFileEntriesInited) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
753 |
initEntries(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
754 |
zipFileEntries = com.sun.tools.javac.util.List.nil(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
755 |
for (Entry zfie : entries) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
756 |
zipFileEntries = zipFileEntries.append(zfie); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
757 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
758 |
zipFileEntriesInited = true; |
10 | 759 |
} |
760 |
return zipFileEntries; |
|
761 |
} |
|
762 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
763 |
private Entry getEntry(String rootName) { |
10 | 764 |
initEntries(); |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
765 |
int index = Collections.binarySearch(entries, new Entry(dirName, rootName)); |
10 | 766 |
if (index < 0) { |
767 |
return null; |
|
768 |
} |
|
769 |
||
770 |
return entries.get(index); |
|
771 |
} |
|
772 |
||
773 |
private void initEntries() { |
|
774 |
if (entriesInited) { |
|
775 |
return; |
|
776 |
} |
|
777 |
||
778 |
if (!zipFileIndex.readFromIndex) { |
|
779 |
int from = -Arrays.binarySearch(zipFileIndex.entries, |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
780 |
new Entry(dirName, ZipFileIndex.MIN_CHAR)) - 1; |
10 | 781 |
int to = -Arrays.binarySearch(zipFileIndex.entries, |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
782 |
new Entry(dirName, MAX_CHAR)) - 1; |
10 | 783 |
|
784 |
for (int i = from; i < to; i++) { |
|
785 |
entries.add(zipFileIndex.entries[i]); |
|
786 |
} |
|
787 |
} else { |
|
788 |
File indexFile = zipFileIndex.getIndexFile(); |
|
789 |
if (indexFile != null) { |
|
790 |
RandomAccessFile raf = null; |
|
791 |
try { |
|
792 |
raf = new RandomAccessFile(indexFile, "r"); |
|
793 |
raf.seek(writtenOffsetOffset); |
|
794 |
||
795 |
for (int nFiles = 0; nFiles < numEntries; nFiles++) { |
|
796 |
// Read the name bytes |
|
797 |
int zfieNameBytesLen = raf.readInt(); |
|
798 |
byte [] zfieNameBytes = new byte[zfieNameBytesLen]; |
|
799 |
raf.read(zfieNameBytes); |
|
800 |
String eName = new String(zfieNameBytes, "UTF-8"); |
|
801 |
||
802 |
// Read isDir |
|
803 |
boolean eIsDir = raf.readByte() == (byte)0 ? false : true; |
|
804 |
||
805 |
// Read offset of bytes in the real Jar/Zip file |
|
806 |
int eOffset = raf.readInt(); |
|
807 |
||
808 |
// Read size of the file in the real Jar/Zip file |
|
809 |
int eSize = raf.readInt(); |
|
810 |
||
811 |
// Read compressed size of the file in the real Jar/Zip file |
|
812 |
int eCsize = raf.readInt(); |
|
813 |
||
814 |
// Read java time stamp of the file in the real Jar/Zip file |
|
815 |
long eJavaTimestamp = raf.readLong(); |
|
816 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
817 |
Entry rfie = new Entry(dirName, eName); |
10 | 818 |
rfie.isDir = eIsDir; |
819 |
rfie.offset = eOffset; |
|
820 |
rfie.size = eSize; |
|
821 |
rfie.compressedSize = eCsize; |
|
822 |
rfie.javatime = eJavaTimestamp; |
|
823 |
entries.add(rfie); |
|
824 |
} |
|
825 |
} catch (Throwable t) { |
|
826 |
// Do nothing |
|
827 |
} finally { |
|
828 |
try { |
|
4418 | 829 |
if (raf != null) { |
10 | 830 |
raf.close(); |
831 |
} |
|
832 |
} catch (Throwable t) { |
|
833 |
// Do nothing |
|
834 |
} |
|
835 |
} |
|
836 |
} |
|
837 |
} |
|
838 |
||
839 |
entriesInited = true; |
|
840 |
} |
|
841 |
||
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
842 |
List<Entry> getEntriesAsCollection() { |
10 | 843 |
initEntries(); |
844 |
||
845 |
return entries; |
|
846 |
} |
|
847 |
} |
|
848 |
||
849 |
private boolean readIndex() { |
|
850 |
if (triedToReadIndex || !usePreindexedCache) { |
|
851 |
return false; |
|
852 |
} |
|
853 |
||
854 |
boolean ret = false; |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
855 |
synchronized (this) { |
10 | 856 |
triedToReadIndex = true; |
857 |
RandomAccessFile raf = null; |
|
858 |
try { |
|
859 |
File indexFileName = getIndexFile(); |
|
860 |
raf = new RandomAccessFile(indexFileName, "r"); |
|
861 |
||
862 |
long fileStamp = raf.readLong(); |
|
863 |
if (zipFile.lastModified() != fileStamp) { |
|
864 |
ret = false; |
|
865 |
} else { |
|
22163 | 866 |
directories = new LinkedHashMap<>(); |
10 | 867 |
int numDirs = raf.readInt(); |
868 |
for (int nDirs = 0; nDirs < numDirs; nDirs++) { |
|
869 |
int dirNameBytesLen = raf.readInt(); |
|
870 |
byte [] dirNameBytes = new byte[dirNameBytesLen]; |
|
871 |
raf.read(dirNameBytes); |
|
872 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
873 |
RelativeDirectory dirNameStr = getRelativeDirectory(new String(dirNameBytes, "UTF-8")); |
10 | 874 |
DirectoryEntry de = new DirectoryEntry(dirNameStr, this); |
875 |
de.numEntries = raf.readInt(); |
|
876 |
de.writtenOffsetOffset = raf.readLong(); |
|
877 |
directories.put(dirNameStr, de); |
|
878 |
} |
|
879 |
ret = true; |
|
880 |
zipFileLastModified = fileStamp; |
|
881 |
} |
|
882 |
} catch (Throwable t) { |
|
883 |
// Do nothing |
|
884 |
} finally { |
|
885 |
if (raf != null) { |
|
886 |
try { |
|
887 |
raf.close(); |
|
888 |
} catch (Throwable tt) { |
|
889 |
// Do nothing |
|
890 |
} |
|
891 |
} |
|
892 |
} |
|
893 |
if (ret == true) { |
|
894 |
readFromIndex = true; |
|
895 |
} |
|
896 |
} |
|
897 |
||
898 |
return ret; |
|
899 |
} |
|
900 |
||
901 |
private boolean writeIndex() { |
|
902 |
boolean ret = false; |
|
903 |
if (readFromIndex || !usePreindexedCache) { |
|
904 |
return true; |
|
905 |
} |
|
906 |
||
907 |
if (!writeIndex) { |
|
908 |
return true; |
|
909 |
} |
|
910 |
||
911 |
File indexFile = getIndexFile(); |
|
912 |
if (indexFile == null) { |
|
913 |
return false; |
|
914 |
} |
|
915 |
||
916 |
RandomAccessFile raf = null; |
|
917 |
long writtenSoFar = 0; |
|
918 |
try { |
|
919 |
raf = new RandomAccessFile(indexFile, "rw"); |
|
920 |
||
921 |
raf.writeLong(zipFileLastModified); |
|
922 |
writtenSoFar += 8; |
|
923 |
||
22163 | 924 |
List<DirectoryEntry> directoriesToWrite = new ArrayList<>(); |
925 |
Map<RelativeDirectory, Long> offsets = new HashMap<>(); |
|
10 | 926 |
raf.writeInt(directories.keySet().size()); |
927 |
writtenSoFar += 4; |
|
928 |
||
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
929 |
for (RelativeDirectory dirName: directories.keySet()) { |
10 | 930 |
DirectoryEntry dirEntry = directories.get(dirName); |
931 |
||
932 |
directoriesToWrite.add(dirEntry); |
|
933 |
||
934 |
// Write the dir name bytes |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
935 |
byte [] dirNameBytes = dirName.getPath().getBytes("UTF-8"); |
10 | 936 |
int dirNameBytesLen = dirNameBytes.length; |
937 |
raf.writeInt(dirNameBytesLen); |
|
938 |
writtenSoFar += 4; |
|
939 |
||
940 |
raf.write(dirNameBytes); |
|
941 |
writtenSoFar += dirNameBytesLen; |
|
942 |
||
943 |
// Write the number of files in the dir |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1205
diff
changeset
|
944 |
List<Entry> dirEntries = dirEntry.getEntriesAsCollection(); |
10 | 945 |
raf.writeInt(dirEntries.size()); |
946 |
writtenSoFar += 4; |
|
947 |
||
948 |
offsets.put(dirName, new Long(writtenSoFar)); |
|
949 |
||
950 |
// Write the offset of the file's data in the dir |
|
951 |
dirEntry.writtenOffsetOffset = 0L; |
|
952 |
raf.writeLong(0L); |
|
953 |
writtenSoFar += 8; |
|
954 |
} |
|
955 |
||
956 |
for (DirectoryEntry de : directoriesToWrite) { |
|
957 |
// Fix up the offset in the directory table |
|
958 |
long currFP = raf.getFilePointer(); |
|
959 |
||
960 |
long offsetOffset = offsets.get(de.dirName).longValue(); |
|
961 |
raf.seek(offsetOffset); |
|
962 |
raf.writeLong(writtenSoFar); |
|
963 |
||
964 |
raf.seek(currFP); |
|
965 |
||
966 |
// Now write each of the files in the DirectoryEntry |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
967 |
List<Entry> list = de.getEntriesAsCollection(); |
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
968 |
for (Entry zfie : list) { |
10 | 969 |
// Write the name bytes |
970 |
byte [] zfieNameBytes = zfie.name.getBytes("UTF-8"); |
|
971 |
int zfieNameBytesLen = zfieNameBytes.length; |
|
972 |
raf.writeInt(zfieNameBytesLen); |
|
973 |
writtenSoFar += 4; |
|
974 |
raf.write(zfieNameBytes); |
|
975 |
writtenSoFar += zfieNameBytesLen; |
|
976 |
||
977 |
// Write isDir |
|
978 |
raf.writeByte(zfie.isDir ? (byte)1 : (byte)0); |
|
979 |
writtenSoFar += 1; |
|
980 |
||
981 |
// Write offset of bytes in the real Jar/Zip file |
|
982 |
raf.writeInt(zfie.offset); |
|
983 |
writtenSoFar += 4; |
|
984 |
||
985 |
// Write size of the file in the real Jar/Zip file |
|
986 |
raf.writeInt(zfie.size); |
|
987 |
writtenSoFar += 4; |
|
988 |
||
989 |
// Write compressed size of the file in the real Jar/Zip file |
|
990 |
raf.writeInt(zfie.compressedSize); |
|
991 |
writtenSoFar += 4; |
|
992 |
||
993 |
// Write java time stamp of the file in the real Jar/Zip file |
|
994 |
raf.writeLong(zfie.getLastModified()); |
|
995 |
writtenSoFar += 8; |
|
996 |
} |
|
997 |
} |
|
998 |
} catch (Throwable t) { |
|
999 |
// Do nothing |
|
1000 |
} finally { |
|
1001 |
try { |
|
1002 |
if (raf != null) { |
|
1003 |
raf.close(); |
|
1004 |
} |
|
1005 |
} catch(IOException ioe) { |
|
1006 |
// Do nothing |
|
1007 |
} |
|
1008 |
} |
|
1009 |
||
1010 |
return ret; |
|
1011 |
} |
|
1012 |
||
1013 |
public boolean writeZipIndex() { |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
1014 |
synchronized (this) { |
10 | 1015 |
return writeIndex(); |
1016 |
} |
|
1017 |
} |
|
1018 |
||
1019 |
private File getIndexFile() { |
|
1020 |
if (zipIndexFile == null) { |
|
1021 |
if (zipFile == null) { |
|
1022 |
return null; |
|
1023 |
} |
|
1024 |
||
1025 |
zipIndexFile = new File((preindexedCacheLocation == null ? "" : preindexedCacheLocation) + |
|
1026 |
zipFile.getName() + ".index"); |
|
1027 |
} |
|
1028 |
||
1029 |
return zipIndexFile; |
|
1030 |
} |
|
1031 |
||
1032 |
public File getZipFile() { |
|
1033 |
return zipFile; |
|
1034 |
} |
|
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1035 |
|
4073
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1036 |
File getAbsoluteFile() { |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1037 |
File absFile = (absFileRef == null ? null : absFileRef.get()); |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1038 |
if (absFile == null) { |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1039 |
absFile = zipFile.getAbsoluteFile(); |
22163 | 1040 |
absFileRef = new SoftReference<>(absFile); |
4073
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1041 |
} |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1042 |
return absFile; |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1043 |
} |
9788f4549740
6838467: JSR199 FileObjects don't obey general contract of equals.
jjg
parents:
3380
diff
changeset
|
1044 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1045 |
private RelativeDirectory getRelativeDirectory(String path) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1046 |
RelativeDirectory rd; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1047 |
SoftReference<RelativeDirectory> ref = relativeDirectoryCache.get(path); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1048 |
if (ref != null) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1049 |
rd = ref.get(); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1050 |
if (rd != null) |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1051 |
return rd; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1052 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1053 |
rd = new RelativeDirectory(path); |
22163 | 1054 |
relativeDirectoryCache.put(path, new SoftReference<>(rd)); |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1055 |
return rd; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1056 |
} |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1057 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1058 |
static class Entry implements Comparable<Entry> { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1059 |
public static final Entry[] EMPTY_ARRAY = {}; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1060 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1061 |
// Directory related |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1062 |
RelativeDirectory dir; |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1063 |
boolean isDir; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1064 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1065 |
// File related |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1066 |
String name; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1067 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1068 |
int offset; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1069 |
int size; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1070 |
int compressedSize; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1071 |
long javatime; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1072 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1073 |
private int nativetime; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1074 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1075 |
public Entry(RelativePath path) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1076 |
this(path.dirname(), path.basename()); |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1077 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1078 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1079 |
public Entry(RelativeDirectory directory, String name) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1080 |
this.dir = directory; |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1081 |
this.name = name; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1082 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1083 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1084 |
public String getName() { |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1085 |
return new RelativeFile(dir, name).getPath(); |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1086 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1087 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1088 |
public String getFileName() { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1089 |
return name; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1090 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1091 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1092 |
public long getLastModified() { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1093 |
if (javatime == 0) { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1094 |
javatime = dosToJavaTime(nativetime); |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1095 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1096 |
return javatime; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1097 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1098 |
|
865
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1099 |
// based on dosToJavaTime in java.util.Zip, but avoiding the |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1100 |
// use of deprecated Date constructor |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1101 |
private static long dosToJavaTime(int dtime) { |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1102 |
Calendar c = Calendar.getInstance(); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1103 |
c.set(Calendar.YEAR, ((dtime >> 25) & 0x7f) + 1980); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1104 |
c.set(Calendar.MONTH, ((dtime >> 21) & 0x0f) - 1); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1105 |
c.set(Calendar.DATE, ((dtime >> 16) & 0x1f)); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1106 |
c.set(Calendar.HOUR_OF_DAY, ((dtime >> 11) & 0x1f)); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1107 |
c.set(Calendar.MINUTE, ((dtime >> 5) & 0x3f)); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1108 |
c.set(Calendar.SECOND, ((dtime << 1) & 0x3e)); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1109 |
c.set(Calendar.MILLISECOND, 0); |
21668f049d28
6725036: javac returns incorrect value for lastModifiedTime() when source is a zip file archive
jjg
parents:
810
diff
changeset
|
1110 |
return c.getTimeInMillis(); |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1111 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1112 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1113 |
void setNativeTime(int natTime) { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1114 |
nativetime = natTime; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1115 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1116 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1117 |
public boolean isDirectory() { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1118 |
return isDir; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1119 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1120 |
|
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1121 |
public int compareTo(Entry other) { |
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1122 |
RelativeDirectory otherD = other.dir; |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1123 |
if (dir != otherD) { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1124 |
int c = dir.compareTo(otherD); |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1125 |
if (c != 0) |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1126 |
return c; |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1127 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1128 |
return name.compareTo(other.name); |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1129 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1130 |
|
1205
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1131 |
@Override |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1132 |
public boolean equals(Object o) { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1133 |
if (!(o instanceof Entry)) |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1134 |
return false; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1135 |
Entry other = (Entry) o; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1136 |
return dir.equals(other.dir) && name.equals(other.name); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1137 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1138 |
|
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1139 |
@Override |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1140 |
public int hashCode() { |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1141 |
int hash = 7; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1142 |
hash = 97 * hash + (this.dir != null ? this.dir.hashCode() : 0); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1143 |
hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1144 |
return hash; |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1145 |
} |
b316e32eb90c
6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
865
diff
changeset
|
1146 |
|
8223
638daa596494
6988106: javac report 'java.lang.IllegalMonitorStateException'
jjg
parents:
5847
diff
changeset
|
1147 |
@Override |
810
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1148 |
public String toString() { |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1149 |
return isDir ? ("Dir:" + dir + " : " + name) : |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1150 |
(dir + ":" + name); |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1151 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1152 |
} |
e4b6a6d206e6
6714365: refactor JavacFileManager to move nested classes to top level
jjg
parents:
731
diff
changeset
|
1153 |
|
8837 | 1154 |
/* |
1155 |
* Exception primarily used to implement a failover, used exclusively here. |
|
1156 |
*/ |
|
1157 |
||
1158 |
static final class ZipFormatException extends IOException { |
|
1159 |
private static final long serialVersionUID = 8000196834066748623L; |
|
1160 |
protected ZipFormatException(String message) { |
|
1161 |
super(message); |
|
1162 |
} |
|
1163 |
||
1164 |
protected ZipFormatException(String message, Throwable cause) { |
|
1165 |
super(message, cause); |
|
1166 |
} |
|
1167 |
} |
|
10 | 1168 |
} |