Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveDevil committed Jul 1, 2024
1 parent 500d25f commit e30ef2d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/IKVM.Image/IKVM.Image.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</PropertyGroup>

<ItemGroup>
<TzFile Include="africa;antarctica;asia;australasia;europe;northamerica;pacificnew;southamerica;backward;etcetera;gmt;jdk11_backward" />
<TzFile Include="africa;antarctica;asia;australasia;europe;northamerica;southamerica;backward;etcetera;gmt;jdk11_backward" />
</ItemGroup>

<Target Name="GenerateTZDB" DependsOnTargets="OpenJdkBuildTools;ResolveJava" Inputs="$(MSBuildThisFileFullPath);$(OpenJdkBuildToolsStampFile);@(TzFile->'$(TzDataDir)\%(Identity)')" Outputs="$(TzDbDat)">
Expand Down
20 changes: 19 additions & 1 deletion src/IKVM.Java/local/java/util/zip/ZipFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.jar.JarFile;
import java.util.stream.Stream;
import static java.util.zip.ZipConstants64.*;

Expand Down Expand Up @@ -96,6 +97,7 @@ public class ZipFile implements ZipConstants, Closeable
private LinkedHashMap<String, ZipEntry> entries;

private boolean closed = false;
private int manifestNum = 0; // number of META-INF/MANIFEST.MF, case insensitive
final boolean hasLocHeader;

/**
Expand Down Expand Up @@ -312,6 +314,10 @@ private void readEntries() throws IOException
{
entry.comment = inp.readString(commentLen, (flags & EFS) != 0);
}
if (isManifestName(entry.name))
{
manifestNum++;
}
entries.put(entry.name, entry);
}

Expand Down Expand Up @@ -896,13 +902,25 @@ public void addDummyByte()
}
}

private int getManifestNum() {
return manifestNum;
}

public static boolean isManifestName(String name)
{
return JarFile.MANIFEST_NAME.equalsIgnoreCase(name);
}

static {
sun.misc.SharedSecrets.setJavaUtilZipFileAccess(
new sun.misc.JavaUtilZipFileAccess() {
public boolean startsWithLocHeader(ZipFile zip) {
return zip.hasLocHeader;
}
public int getManifestNum(JarFile jar) {
return ((ZipFile)jar).getManifestNum();
}
}
);
}
}
}

0 comments on commit e30ef2d

Please sign in to comment.