Skip to content

Commit f39d178

Browse files
authored
Merge pull request #2113 from SAP/pr-jdk-21.0.10+4
Merge to tag jdk-21.0.10+4
2 parents d9ecb99 + 2f89740 commit f39d178

File tree

23 files changed

+632
-34
lines changed

23 files changed

+632
-34
lines changed

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@ void write(ImageOutputStream ios,
376376
}
377377
thumbWidth = Math.min(thumbWidth, MAX_THUMB_WIDTH);
378378
thumbHeight = Math.min(thumbHeight, MAX_THUMB_HEIGHT);
379+
380+
int maxArea = (0xffff - DATA_SIZE - LENGTH_SIZE) / thumb.getSampleModel().getNumBands();
381+
if (thumbWidth * thumbHeight > maxArea) {
382+
writer.warningOccurred(JPEGImageWriter.WARNING_THUMB_CLIPPED);
383+
double scale = Math.sqrt( ((double)maxArea) / (double)(thumbWidth * thumbHeight) );
384+
thumbWidth = (int) (scale * thumbWidth);
385+
thumbHeight = (int) (scale * thumbHeight);
386+
}
387+
379388
thumbData = thumb.getRaster().getPixels(0, 0,
380389
thumbWidth, thumbHeight,
381390
(int []) null);

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -190,6 +190,9 @@ void write(ImageOutputStream ios) throws IOException {
190190

191191
static void write2bytes(ImageOutputStream ios,
192192
int value) throws IOException {
193+
if (value < 0 || value > 0xffff) {
194+
throw new IIOException("Invalid 2-byte value: " + value);
195+
}
193196
ios.write((value >> 8) & 0xff);
194197
ios.write(value & 0xff);
195198

src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -805,10 +805,10 @@ public void handleConfigureNotifyEvent(XEvent xev) {
805805
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
806806
insLog.fine(xe.toString());
807807
}
808-
checkIfOnNewScreen(toGlobal(new Rectangle(scaleDown(xe.get_x()),
808+
checkIfOnNewScreen(new Rectangle(scaleDown(xe.get_x()),
809809
scaleDown(xe.get_y()),
810810
scaleDown(xe.get_width()),
811-
scaleDown(xe.get_height()))));
811+
scaleDown(xe.get_height())));
812812

813813
Rectangle oldBounds = getBounds();
814814

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,15 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
882882
}
883883
}
884884
if (icon != null) {
885-
icon.paintIcon(c, g, x + VistaMenuItemCheckIconFactory.getIconWidth(),
886-
y + OFFSET);
885+
if (WindowsGraphicsUtils.isLeftToRight(c)) {
886+
icon.paintIcon(c, g,
887+
x + VistaMenuItemCheckIconFactory.getIconWidth(),
888+
y + OFFSET);
889+
} else {
890+
icon.paintIcon(c, g,
891+
x - VistaMenuItemCheckIconFactory.getIconWidth() + 2 * OFFSET,
892+
y + OFFSET);
893+
}
887894
}
888895
}
889896
private static WindowsMenuItemUIAccessor getAccessor(

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import javax.swing.JComponent;
4444
import javax.swing.JMenu;
4545
import javax.swing.JMenuItem;
46+
import javax.swing.SwingConstants;
4647
import javax.swing.UIManager;
4748
import javax.swing.plaf.ComponentUI;
4849
import javax.swing.plaf.UIResource;
@@ -215,8 +216,17 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g,
215216

216217
if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) {
217218
Rectangle rect = lr.getTextRect();
218-
219-
rect.x += lh.getAfterCheckIconGap();
219+
if (menuItem.getComponentOrientation().isLeftToRight()) {
220+
if (menuItem.getHorizontalTextPosition() != SwingConstants.LEADING
221+
&& menuItem.getHorizontalTextPosition() != SwingConstants.LEFT) {
222+
rect.x += lh.getAfterCheckIconGap();
223+
}
224+
} else {
225+
if (menuItem.getHorizontalTextPosition() != SwingConstants.LEADING
226+
&& menuItem.getHorizontalTextPosition() != SwingConstants.RIGHT) {
227+
rect.x -= lh.getAfterCheckIconGap();
228+
}
229+
}
220230

221231
lr.setTextRect(rect);
222232
}
@@ -232,7 +242,11 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g,
232242
}
233243
if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) {
234244
Rectangle rect = lr.getAccRect();
235-
rect.x += lh.getAfterCheckIconGap();
245+
if (menuItem.getComponentOrientation().isLeftToRight()) {
246+
rect.x += lh.getAfterCheckIconGap();
247+
} else {
248+
rect.x -= lh.getAfterCheckIconGap();
249+
}
236250
lr.setAccRect(rect);
237251
}
238252
SwingUtilities3.paintAccText(g, lh, lr, disabledForeground,

test/hotspot/jtreg/vmTestbase/gc/gctests/AllocateWithoutOomTest/AllocateWithoutOomTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
3737
*
3838
* @library /vmTestbase
3939
* /test/lib
40-
* @run main/othervm
40+
* @run main/othervm/timeout=480
4141
* -XX:-UseGCOverheadLimit
4242
* gc.gctests.AllocateWithoutOomTest.AllocateWithoutOomTest
4343
*/

test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings_Strings/TestDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
3636
*
3737
* @library /vmTestbase
3838
* /test/lib
39-
* @run main/othervm
39+
* @run main/othervm/timeout=480
4040
* -XX:-UseGCOverheadLimit
4141
* vm.gc.compact.Compact
4242
* -gp interned(randomString)

test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_NonbranchyTree/TestDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
3636
*
3737
* @library /vmTestbase
3838
* /test/lib
39-
* @run main/othervm
39+
* @run main/othervm/timeout=480
4040
* -XX:-UseGCOverheadLimit
4141
* vm.gc.compact.Compact
4242
* -gp nonbranchyTree(high)

test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_NonbranchyTree_ArrayOf/TestDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
3636
*
3737
* @library /vmTestbase
3838
* /test/lib
39-
* @run main/othervm
39+
* @run main/othervm/timeout=480
4040
* -XX:-UseGCOverheadLimit
4141
* vm.gc.compact.Compact
4242
* -gp nonbranchyTree(high)

test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_NonbranchyTree_TwoFields/TestDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
3636
*
3737
* @library /vmTestbase
3838
* /test/lib
39-
* @run main/othervm
39+
* @run main/othervm/timeout=480
4040
* -XX:-UseGCOverheadLimit
4141
* vm.gc.compact.Compact
4242
* -gp nonbranchyTree(high)

0 commit comments

Comments
 (0)