Skip to content

Commit

Permalink
Merge master jdk-11.0.21+4 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Aug 24, 2023
2 parents 746cce7 + 82fe313 commit 5fbcc9f
Show file tree
Hide file tree
Showing 355 changed files with 22,565 additions and 21,640 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/build-cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ on:
required: false
type: string
default: '10'
apt-gcc-version:
required: false
type: string
default: '10.3.0-1ubuntu1~20.04'
apt-gcc-cross-suffix:
required: false
type: string
default: 'cross1'

jobs:
build-cross-compile:
Expand Down Expand Up @@ -93,10 +85,10 @@ jobs:
sudo apt-get update
sudo apt-get install --only-upgrade apt
sudo apt-get install \
gcc-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \
g++-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \
gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \
g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \
gcc-${{ inputs.gcc-major-version }} \
g++-${{ inputs.gcc-major-version }} \
gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} \
g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} \
libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
uses: ./.github/workflows/build-linux.yml
with:
platform: linux-x64
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
apt-gcc-version: '10'
# The linux-x64 jdk bundle is used as buildjdk for the cross-compile job
if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true'

Expand All @@ -147,7 +147,7 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
apt-gcc-version: '10'
extra-conf-options: '--disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -159,7 +159,7 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
apt-gcc-version: '10'
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -171,7 +171,7 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
apt-gcc-version: '10'
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -184,7 +184,7 @@ jobs:
make-target: 'hotspot'
# Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
apt-gcc-version: '10'
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand Down
53 changes: 43 additions & 10 deletions src/java.base/share/classes/java/util/zip/ZipFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import jdk.internal.ref.CleanerFactory;
import jdk.internal.vm.annotation.Stable;
import sun.nio.cs.UTF_8;
import sun.security.action.GetBooleanAction;
import sun.security.action.GetPropertyAction;
import java.security.AccessController;

import static java.util.zip.ZipConstants64.*;
Expand Down Expand Up @@ -120,12 +120,12 @@ class ZipFile implements ZipConstants, Closeable {
public static final int OPEN_READ = 0x1;

/**
* Flag which specifies whether the validation of the Zip64 extra
* fields should be disabled
* Flag to specify whether the Extra ZIP64 validation should be
* disabled.
*/
private static final boolean disableZip64ExtraFieldValidation =
AccessController.doPrivileged
(new GetBooleanAction("jdk.util.zip.disableZip64ExtraFieldValidation"));
private static final boolean DISABLE_ZIP64_EXTRA_VALIDATION =
getDisableZip64ExtraFieldValidation();

/**
* Mode flag to open a zip file and mark it for deletion. The file will be
* deleted some time between the moment that it is opened and the moment
Expand Down Expand Up @@ -1131,6 +1131,22 @@ private String[] getMetaInfEntryNames() {
private static boolean isWindows;
private static final JavaLangAccess JLA;

/**
* Returns the value of the System property which indicates whether the
* Extra ZIP64 validation should be disabled.
*/
static boolean getDisableZip64ExtraFieldValidation() {
boolean result;
String value = GetPropertyAction.privilegedGetProperty(
"jdk.util.zip.disableZip64ExtraFieldValidation");
if (value == null) {
result = false;
} else {
result = value.isEmpty() || value.equalsIgnoreCase("true");
}
return result;
}

static {
SharedSecrets.setJavaUtilZipFileAccess(
new JavaUtilZipFileAccess() {
Expand Down Expand Up @@ -1241,25 +1257,32 @@ private void checkExtraFields(int cenPos, int startingOffset,
zerror("Invalid CEN header (extra data field size too long)");
}
int currentOffset = startingOffset;
while (currentOffset < extraEndOffset) {
// Walk through each Extra Header. Each Extra Header Must consist of:
// Header ID - 2 bytes
// Data Size - 2 bytes:
while (currentOffset + Integer.BYTES <= extraEndOffset) {
int tag = get16(cen, currentOffset);
currentOffset += Short.BYTES;

int tagBlockSize = get16(cen, currentOffset);
currentOffset += Short.BYTES;
int tagBlockEndingOffset = currentOffset + tagBlockSize;

// The ending offset for this tag block should not go past the
// offset for the end of the extra field
if (tagBlockEndingOffset > extraEndOffset) {
zerror("Invalid CEN header (invalid zip64 extra data field size)");
zerror(String.format(
"Invalid CEN header (invalid extra data field size for " +
"tag: 0x%04x at %d)",
tag, cenPos));
}
currentOffset += Short.BYTES;

if (tag == ZIP64_EXTID) {
// Get the compressed size;
long csize = CENSIZ(cen, cenPos);
// Get the uncompressed size;
long size = CENLEN(cen, cenPos);

checkZip64ExtraFieldValues(currentOffset, tagBlockSize,
csize, size);
}
Expand All @@ -1283,6 +1306,16 @@ private void checkZip64ExtraFieldValues(int off, int blockSize, long csize,
long size)
throws ZipException {
byte[] cen = this.cen;
// if ZIP64_EXTID blocksize == 0, which may occur with some older
// versions of Apache Ant and Commons Compress, validate csize and size
// to make sure neither field == ZIP64_MAGICVAL
if (blockSize == 0) {
if (csize == ZIP64_MAGICVAL || size == ZIP64_MAGICVAL) {
zerror("Invalid CEN header (invalid zip64 extra data field size)");
}
// Only validate the ZIP64_EXTID data if the block size > 0
return;
}
// Validate the Zip64 Extended Information Extra Field (0x0001)
// length.
if (!isZip64ExtBlockSizeValid(blockSize)) {
Expand Down Expand Up @@ -1693,7 +1726,7 @@ private void initCEN(int knownTotal, ZipCoder zc) throws IOException {
} else {
checkEncoding(zc, cen, pos + CENHDR, nlen);
}
if (elen > 0 && !disableZip64ExtraFieldValidation) {
if (elen > 0 && !DISABLE_ZIP64_EXTRA_VALIDATION) {
long extraStartingOffset = pos + CENHDR + nlen;
if ((int)extraStartingOffset != extraStartingOffset) {
zerror("invalid CEN header (bad extra offset)");
Expand Down
19 changes: 19 additions & 0 deletions src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.PageRanges;
import javax.print.attribute.standard.Sides;
import javax.print.attribute.Attribute;

import sun.java2d.*;
Expand Down Expand Up @@ -682,6 +683,24 @@ private Rectangle2D getPageFormatArea(PageFormat page) {
return pageFormatArea;
}

private int getSides() {
return (this.sidesAttr == null) ? -1 : this.sidesAttr.getValue();
}

private void setSides(int sides) {
if (attributes == null) {
return;
}

final Sides[] sidesTable = new Sides[] {Sides.ONE_SIDED, Sides.TWO_SIDED_LONG_EDGE, Sides.TWO_SIDED_SHORT_EDGE};

if (sides >= 0 && sides < sidesTable.length) {
Sides s = sidesTable[sides];
attributes.add(s);
this.sidesAttr = s;
}
}

private boolean cancelCheck() {
// This is called from the native side.

Expand Down
42 changes: 42 additions & 0 deletions src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#import "GeomUtilities.h"
#import "JNIUtilities.h"

#define ONE_SIDED 0
#define TWO_SIDED_LONG_EDGE 1
#define TWO_SIDED_SHORT_EDGE 2

static jclass sjc_Paper = NULL;
static jclass sjc_PageFormat = NULL;
static jclass sjc_CPrinterJob = NULL;
Expand Down Expand Up @@ -351,6 +355,24 @@ static void javaPageFormatToNSPrintInfo(JNIEnv* env, jobject srcPrintJob, jobjec
[dstPrintInfo setPrinter:printer];
}

static jint duplexModeToSides(PMDuplexMode duplexMode) {
switch(duplexMode) {
case kPMDuplexNone: return ONE_SIDED;
case kPMDuplexTumble: return TWO_SIDED_SHORT_EDGE;
case kPMDuplexNoTumble: return TWO_SIDED_LONG_EDGE;
default: return -1;
}
}

static PMDuplexMode sidesToDuplexMode(jint sides) {
switch(sides) {
case ONE_SIDED: return kPMDuplexNone;
case TWO_SIDED_SHORT_EDGE: return kPMDuplexTumble;
case TWO_SIDED_LONG_EDGE: return kPMDuplexNoTumble;
default: return kPMDuplexNone;
}
}

static void nsPrintInfoToJavaPrinterJob(JNIEnv* env, NSPrintInfo* src, jobject dstPrinterJob, jobject dstPageable)
{
GET_CPRINTERJOB_CLASS();
Expand All @@ -360,6 +382,7 @@ static void nsPrintInfoToJavaPrinterJob(JNIEnv* env, NSPrintInfo* src, jobject d
DECLARE_METHOD(jm_setPageRangeAttribute, sjc_CPrinterJob, "setPageRangeAttribute", "(IIZ)V");
DECLARE_METHOD(jm_setPrintToFile, sjc_CPrinterJob, "setPrintToFile", "(Z)V");
DECLARE_METHOD(jm_setDestinationFile, sjc_CPrinterJob, "setDestinationFile", "(Ljava/lang/String;)V");
DECLARE_METHOD(jm_setSides, sjc_CPrinterJob, "setSides", "(I)V");

// get the selected printer's name, and set the appropriate PrintService on the Java side
NSString *name = [[src printer] name];
Expand Down Expand Up @@ -420,6 +443,12 @@ static void nsPrintInfoToJavaPrinterJob(JNIEnv* env, NSPrintInfo* src, jobject d
jFirstPage, jLastPage, isRangeSet); // AWT_THREADING Safe (known object)
CHECK_EXCEPTION();

PMDuplexMode duplexSetting;
if (PMGetDuplex(src.PMPrintSettings, &duplexSetting) == noErr) {
jint sides = duplexModeToSides(duplexSetting);
(*env)->CallVoidMethod(env, dstPrinterJob, jm_setSides, sides); // AWT_THREADING Safe (known object)
CHECK_EXCEPTION();
}
}
}

Expand All @@ -438,6 +467,8 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
DECLARE_METHOD(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
DECLARE_METHOD(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
DECLARE_METHOD(jm_getDestinationFile, sjc_CPrinterJob, "getDestinationFile", "()Ljava/lang/String;");
DECLARE_METHOD(jm_getSides, sjc_CPrinterJob, "getSides", "()I");


NSMutableDictionary* printingDictionary = [dst dictionary];

Expand Down Expand Up @@ -496,6 +527,17 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
} else {
[dst setJobDisposition:NSPrintSpoolJob];
}

jint sides = (*env)->CallIntMethod(env, srcPrinterJob, jm_getSides);
CHECK_EXCEPTION();

if (sides >= 0) {
PMDuplexMode duplexMode = sidesToDuplexMode(sides);
PMPrintSettings printSettings = dst.PMPrintSettings;
if (PMSetDuplex(printSettings, duplexMode) == noErr) {
[dst updateFromPMPrintSettings];
}
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ public PrintService[] run() {
return false;
}

this.attributes = attributes;

if (!service.equals(newService)) {
try {
setPrintService(newService);
Expand Down
Loading

0 comments on commit 5fbcc9f

Please sign in to comment.