Re: RFR: 8289539: The color returned by CheckBox.interiorBackground is incorrect

2022-11-02 Thread Andrey Turbanov
On Thu, 22 Sep 2022 06:59:59 GMT, Tejesh R  wrote:

> The color returned for `InteriorBackground` property is the default color 
> used for only _WindowsClassicLookAndFeel_. For _WindowsLookAndFeel_ the 
> `InteriorBackground` color is not been used when checkbox paint happens. In 
> _WindowsLookAndFeel_ the CheckBox check/uncheck is drawn using `ImageCache` 
> which is totally independent of `InteriorBackground` color in which the user 
> expects it to be.
> The proposed fix is to return null for _WindowsLookAndFeel_ (which is what 
> happens in other LookAndFeel like Metal/Synth/Motif/Aqua ) and return default 
> color which is the actual color used in _WindowsClassicLookAndFeel_.

test/jdk/javax/swing/JCheckBox/InteriorBackgroundTest.java line 64:

> 62: Color color = UIManager.getColor("CheckBox.interiorBackground");
> 63: 
> 64: if(laf.contains("WindowsLookAndFeel") && color != null) {

Suggestion:

if (laf.contains("WindowsLookAndFeel") && color != null) {

test/jdk/javax/swing/JCheckBox/InteriorBackgroundTest.java line 67:

> 65: throw new RuntimeException("CheckBox.interiorBackground not 
> Null for " +
> 66: laf);
> 67: } else if(laf.contains("WindowsClassicLookAndFeel") && color == 
> null) {

Suggestion:

} else if (laf.contains("WindowsClassicLookAndFeel") && color == null) {

-

PR: https://git.openjdk.org/jdk/pull/10385


Re: RFR: 6972078: Can not select single directory with GTKLookAndFeel [v2]

2022-11-02 Thread Abhishek Kumar
On Thu, 27 Oct 2022 09:37:07 GMT, Abhishek Kumar  wrote:

>I guess you can see in folders where you have only files...Testwise, maybe use 
>File.createTempFile for creating files and see..

I tried modifying the test case for different selection mode for all LAFs. 
In case of FILES_AND_DIRECTORIES and DIRECTORIES_ONLY, the test passed in all 
LAFs.
But when the selection mode is set to FILES_ONLY, the UI in GTK doesn't show 
the file lists and test is failing.

However If I test manually for each selection mode,  the behavior is same for 
all LAFs.

1) In case of FILES_AND_DIRECTORIES, able to select single as well as multiple 
directories or files.
2) In case of DIRECTORIES_ONLY, able to select single as well as multiple 
directories but not files.
3) In case of FILES_ONLY, able to select single as well as multiple files but 
not directories.

-

PR: https://git.openjdk.org/jdk/pull/10866


Integrated: 8252075: Documentation error in LayoutManager2 interface

2022-11-02 Thread Renjith Kannath Pariyangad
On Tue, 4 Oct 2022 07:00:04 GMT, Renjith Kannath Pariyangad  
wrote:

> Updated the documentation with proper meaningful message for better 
> understanding.

This pull request has now been integrated.

Changeset: 47d513ba
Author:Renjith 
Committer: Alexey Ivanov 
URL:   
https://git.openjdk.org/jdk/commit/47d513baa2062f428465616a33d12c5bac2f22b1
Stats: 5 lines in 1 file changed: 0 ins; 0 del; 5 mod

8252075: Documentation error in LayoutManager2 interface

Reviewed-by: aivanov

-

PR: https://git.openjdk.org/jdk/pull/10549


Re: RFR: 8278620: properties installed by javax.swing.LookAndFeel installColors and installColorsAndFont are not uninstalled

2022-11-02 Thread Alexey Ivanov
On Tue, 4 Oct 2022 22:52:30 GMT, SWinxy  wrote:

> Many `installDefaults` methods set the font, foreground, and background on 
> objects but their inverse methods `uninstallDefaults` do not remove them. 
> I've added an inverse method to remove the colors and font to call for the 
> `uninstallDefaults` methods that install defaults.
> 
> `AquaButtonUI` can call its super since it would otherwise be repeated code. 
> `BasicComboBoxUI` (weirdly) installs the properties again when it should be 
> uninstalling them, so I changed.
> 
> I noticed that, in a few subclasses, only one of calls to the super of 
> `installDefaults` and `uninstallDefaults` are made. That is, an overridden 
> `installDefaults` may call its super while the overridden `uninstallDefaults` 
> does not call its super (or vise versa). These classes are: 
> `AquaTabbedPaneUI`, `SynthMenuItemUI`, `SynthSplitPaneUI`, and 
> `XTextAreaPeer`.
> 
> Sorry I couldn't write a test; I wasn't sure how I should have accessed the 
> protected variable aside from creating extending classes for each class that 
> changed.
> 
> See also #6603, where this issue was discovered.

I've started looking at this. It looks good, yet I just skimmed through the 
changes without thoroughly reviewing, I haven't run the tests yet.

-

PR: https://git.openjdk.org/jdk/pull/10565


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v2]

2022-11-02 Thread Alexey Ivanov
On Wed, 2 Nov 2022 04:04:14 GMT, ravi gupta  wrote:

>> This testcase verify that List Item selection via mouse/keys generates 
>> ItemEvent/ActionEvent appropriately.
>> 
>> a. Single click on the list generate ItemEvent and double click on item 
>> generates ActionEvent.
>> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
>> generates ActionEvent.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
>> all pass.
>
> ravi gupta has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8295774 : Write a test to verify that List Item selection events.

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 80:

> 78: robot = new Robot();
> 79: try {
> 80: 

I think this blank line in unnecessary.

test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 89:

> 87: Point listAt = list.getLocationOnScreen();
> 88: 
> 89: Dimension listDimension = list.getSize();

Would `size` or `listSize` be a better name?

I think the blank line between `listAt` and `listDimension` is not necessary, 
such as the one below before the `Robot.move` call.

test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 118:

> 116: EventQueue.invokeAndWait(() -> list.select(0));
> 117: 
> 118: if (itemStateChanged) {

You may add `Robot.waitForIdle` to be 100% sure; even though the selection 
occurs on the EDT, by the time `invokeAndWait` returns the listeners will have 
been notified. So, it should be pretty safe without it.

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v2]

2022-11-02 Thread Alexey Ivanov
On Wed, 2 Nov 2022 04:12:44 GMT, ravi gupta  wrote:

>> test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 140:
>> 
>>> 138: }
>>> 139: 
>>> 140: robot.setAutoDelay(waitDelay);
>> 
>> Why is delay increased here?
>
> This test verifies list section via mouse/keys events.
>  
> For mouse events, robot.setAutoDelay(100) worked well. But for key events 
> there were a few intermittent failures which  cleared out with a higher delay 
> via robot.setAutoDelay(1000)

I see. Would it be clearer if you have two constants:

private static final int MOUSE_DELAY = 100;
private static final int KEYBOARD_DELAY = 1000;


Then you would set the former initially and, before testing with key events, 
you would change to the latter. It'll make the intention much clearer and 
explain why it's changed.

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes [v5]

2022-11-02 Thread Alexey Ivanov
On Tue, 1 Nov 2022 16:29:16 GMT, Alexey Ivanov  wrote:

> `TitledBorder` is to be updates as well.

https://github.com/openjdk/jdk/blob/1a58cb1c023c876594e8a53d00703e564a922d36/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java#L373-L378

This hasn't been addressed yet. It requires the CSR to be updated.

-

PR: https://git.openjdk.org/jdk/pull/10740


Re: RFR: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes [v5]

2022-11-02 Thread Alexey Ivanov
On Mon, 31 Oct 2022 07:48:38 GMT, Prasanta Sadhukhan  
wrote:

>> The behavior of MatteBorder constructors taking Insets object as a parameter 
>> is undocumented. It would throw NPE if null object is passed to it, which 
>> should be documented in the spec.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Rectify javadoc of more border classes/methods

Before I can approve this PR, I would like to see the javadoc for border 
classes (those that are modified) updated so that all of them use 
*“Reinitializes”* as the first word in the description instead of 
*“Reinitialize”*, which aligns with [the javadoc style 
guide](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#styleguide):

> **Use 3rd person (descriptive) not 2nd person (prescriptive).**
> 
> The description is in 3rd person declarative rather than 2nd person 
> imperative.
>
> Gets the label. *(preferred)*
>
> Get the label. (avoid)

-

PR: https://git.openjdk.org/jdk/pull/10740


Re: RFR: 8295707: Create a regression test for JDK-7184401

2022-11-02 Thread Manukumar V S
On Thu, 20 Oct 2022 08:59:20 GMT, Srinivas Mandalika  
wrote:

> 8295707: Create a regression test for JDK-7184401
> 
> JDK-7184401 - JDk7u6 : Missing main menu bar in Netbeans after fix for 7162144
> Above bug got introduced due to a fix for 
> [JDK-7162144](https://bugs.openjdk.java.net/browse/JDK-7162144). 
> The issue was observed on the netbeans UI. 
> The test below recreates a standalone test to mimic the failure reported in 
> Netbeans in [JDK-7184401](https://bugs.openjdk.java.net/browse/JDK-7184401) 
> and verifies that it is working as expected after it got fixed via 
> [JDK-7189350](https://bugs.openjdk.java.net/browse/JDK-7189350))
> 
> The Test attempts to reproduce specific behavior of NetBeans at the certain 
> toolbar creation stage. Widgets are created on EDT; Another code posts some 
> events to them on EDT; From another thread some code calls explicitly 
> edt.interrupt().
> Before this got fixed, events from a second code got lost.
> 
> This review is for migrating tests from a closed test suite to open.
> Testing:
> 1.Tested the code on jdk7u6 to reproduce the issue - the UI hangs when run on 
> this build.
> 2. Tested the code on jdk7u361 b01 to validate the fix - the test passed.
> 3.Mach5 Testing(40 times per platform) in macos x64, linux x64 and windows 
> x64 - the .results are clean

test/jdk/java/awt/EventDispatchThread/InterruptEDTTest.java line 55:

> 53: robot = new Robot();
> 54: EventQueue.invokeAndWait(() -> {
> 55: edt = Thread.currentThread();

Why this adding listener code etc in EDT?

-

PR: https://git.openjdk.org/jdk/pull/10784


Re: RFR: 8294241: Deprecate URL public constructors [v3]

2022-11-02 Thread Alan Bateman
On Tue, 1 Nov 2022 16:14:20 GMT, Daniel Fuchs  wrote:

>> Deprecate URL constructors. Developers are encouraged to use `java.net.URI` 
>> to parse or construct any URL.
>> 
>> The `java.net.URL` class does not itself encode or decode any URL components 
>> according to the escaping mechanism defined in RFC2396. It is the 
>> responsibility of the caller to encode any fields, which need to be escaped 
>> prior to calling URL, and also to decode any escaped fields, that are 
>> returned from URL. 
>> 
>> This has lead to many issues in the past.  Indeed, if used improperly, there 
>> is no guarantee that `URL::toString` or `URL::toExternalForm` will lead to a 
>> URL string that can be parsed back into the same URL. This can lead to 
>> constructing misleading URLs. Another issue is with `equals()` and 
>> `hashCode()` which may have to perform a lookup, and do not take 
>> encoding/escaping into account.
>> 
>> In Java SE 1.4 a new class, `java.net.URI`, has been added to mitigate some 
>> of the shortcoming of `java.net.URL`. Conversion methods to create a URL 
>> from a URI were also added. However, it was left up to the developers to use 
>> `java.net.URI`, or not. This RFE proposes to deprecate all public 
>> constructors of `java.net.URL`, in order to provide a stronger warning about 
>> their potential misuses. To construct a URL, using `URI::toURL` should be 
>> preferred.
>> 
>> In order to provide an alternative to the constructors that take a stream 
>> handler as parameter, a new factory method `URL::fromURI(java.net.URI, 
>> java.net.URLStreamHandler)` is provided as  part of this change.
>> 
>> Places in the JDK code base that were constructing `java.net.URL` have been 
>> temporarily annotated with `@SuppressWarnings("deprecation")`.  Some related 
>> issues will be logged to revisit the calling code.
>> 
>> The CSR can be reviewed here: https://bugs.openjdk.org/browse/JDK-8295949
>
> Daniel Fuchs has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Integrated review feedback
>  - Merge branch 'master' into deprecate-url-ctor-8294241
>  - Updated after review comments. In particular var tmp => var => _unused - 
> and avoid var in java.xml
>  - Merge branch 'master' into deprecate-url-ctor-8294241
>  - Fix whitespace issues
>  - 8294241

Marked as reviewed by alanb (Reviewer).

-

PR: https://git.openjdk.org/jdk/pull/10874


Re: RFR: 8295707: Create a regression test for JDK-7184401

2022-11-02 Thread lawrence . andrews
On Thu, 20 Oct 2022 08:59:20 GMT, Srinivas Mandalika  
wrote:

> 8295707: Create a regression test for JDK-7184401
> 
> JDK-7184401 - JDk7u6 : Missing main menu bar in Netbeans after fix for 7162144
> Above bug got introduced due to a fix for 
> [JDK-7162144](https://bugs.openjdk.java.net/browse/JDK-7162144). 
> The issue was observed on the netbeans UI. 
> The test below recreates a standalone test to mimic the failure reported in 
> Netbeans in [JDK-7184401](https://bugs.openjdk.java.net/browse/JDK-7184401) 
> and verifies that it is working as expected after it got fixed via 
> [JDK-7189350](https://bugs.openjdk.java.net/browse/JDK-7189350))
> 
> The Test attempts to reproduce specific behavior of NetBeans at the certain 
> toolbar creation stage. Widgets are created on EDT; Another code posts some 
> events to them on EDT; From another thread some code calls explicitly 
> edt.interrupt().
> Before this got fixed, events from a second code got lost.
> 
> This review is for migrating tests from a closed test suite to open.
> Testing:
> 1.Tested the code on jdk7u6 to reproduce the issue - the UI hangs when run on 
> this build.
> 2. Tested the code on jdk7u361 b01 to validate the fix - the test passed.
> 3.Mach5 Testing(40 times per platform) in macos x64, linux x64 and windows 
> x64 - the .results are clean

test/jdk/java/awt/EventDispatchThread/InterruptEDTTest.java line 86:

> 84: ((sun.awt.SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
> 85: try {
> 86: EventQueue.invokeAndWait(() -> {

This is duplicate code in Line# 67 to Line# 72.

test/jdk/java/awt/EventDispatchThread/InterruptEDTTest.java line 92:

> 90: height = frame.getHeight();
> 91: });
> 92: robot.mouseMove(xLocation + width / 3, yLocation + height / 
> 3);

Line# 75 robot.mouseMove is called with in EDT? but where as here its not. Is 
there any reason for not invoking this in EDT ?

-

PR: https://git.openjdk.org/jdk/pull/10784


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v2]

2022-11-02 Thread Alexey Ivanov
On Wed, 2 Nov 2022 04:04:14 GMT, ravi gupta  wrote:

>> This testcase verify that List Item selection via mouse/keys generates 
>> ItemEvent/ActionEvent appropriately.
>> 
>> a. Single click on the list generate ItemEvent and double click on item 
>> generates ActionEvent.
>> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
>> generates ActionEvent.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
>> all pass.
>
> ravi gupta has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8295774 : Write a test to verify that List Item selection events.

@ravigupta30, I edited the JBS subject, you have to update the subject of the 
PR here.

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v3]

2022-11-02 Thread ravi gupta
> This testcase verify that List Item selection via mouse/keys generates 
> ItemEvent/ActionEvent appropriately.
> 
> a. Single click on the list generate ItemEvent and double click on item 
> generates ActionEvent.
> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
> generates ActionEvent.
> 
> Testing:
> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
> all pass.

ravi gupta has updated the pull request incrementally with one additional 
commit since the last revision:

  8295774: Write a test to verify that List Item selection events.

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10899/files
  - new: https://git.openjdk.org/jdk/pull/10899/files/984ab23f..69296bb4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=01-02

  Stats: 12 lines in 1 file changed: 2 ins; 3 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/10899.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10899/head:pull/10899

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v2]

2022-11-02 Thread ravi gupta
On Wed, 2 Nov 2022 11:16:15 GMT, Alexey Ivanov  wrote:

>> ravi gupta has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8295774 : Write a test to verify that List Item selection events.
>
> test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 80:
> 
>> 78: robot = new Robot();
>> 79: try {
>> 80: 
> 
> I think this blank line in unnecessary.

Resolved. removed blank line.

> test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 89:
> 
>> 87: Point listAt = list.getLocationOnScreen();
>> 88: 
>> 89: Dimension listDimension = list.getSize();
> 
> Would `size` or `listSize` be a better name?
> 
> I think the blank line between `listAt` and `listDimension` is not necessary, 
> such as the one below before the `Robot.move` call.

Resolved . Renamed as listSize and blank line removed.

> test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 118:
> 
>> 116: EventQueue.invokeAndWait(() -> list.select(0));
>> 117: 
>> 118: if (itemStateChanged) {
> 
> You may add `Robot.waitForIdle` to be 100% sure; even though the selection 
> occurs on the EDT, by the time `invokeAndWait` returns the listeners will 
> have been notified. So, it should be pretty safe without it.

Resolved . added robot.waitForIdle();

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v3]

2022-11-02 Thread ravi gupta
On Wed, 2 Nov 2022 11:02:34 GMT, Alexey Ivanov  wrote:

>> This test verifies list section via mouse/keys events.
>>  
>> For mouse events, robot.setAutoDelay(100) worked well. But for key events 
>> there were a few intermittent failures which  cleared out with a higher 
>> delay via robot.setAutoDelay(1000)
>
> I see. Would it be clearer if you have two constants:
> 
> private static final int MOUSE_DELAY = 100;
> private static final int KEYBOARD_DELAY = 1000;
> 
> 
> Then you would set the former initially and, before testing with key events, 
> you would change to the latter. It'll make the intention much clearer and 
> explain why it's changed.

Resolved . implemented as suggested.

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v3]

2022-11-02 Thread Alexey Ivanov
On Wed, 2 Nov 2022 14:38:52 GMT, ravi gupta  wrote:

>> This testcase verify that List Item selection via mouse/keys generates 
>> ItemEvent/ActionEvent appropriately.
>> 
>> a. Single click on the list generate ItemEvent and double click on item 
>> generates ActionEvent.
>> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
>> generates ActionEvent.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
>> all pass.
>
> ravi gupta has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8295774: Write a test to verify that List Item selection events.

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 90:

> 88: 
> 89: robot.mouseMove(listAt.x + listSize .width / 2,
> 90: listAt.y + listSize .height / 2);

No space before the dot:
Suggestion:

robot.mouseMove(listAt.x + listSize.width / 2,
listAt.y + listSize.height / 2);

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295737: macOS: Print content cut off when width > height with portrait orientation

2022-11-02 Thread Alexander Scherbatiy
On Fri, 21 Oct 2022 08:42:12 GMT, Alexander Scherbatiy  
wrote:

> A printed content is truncated on macOS if the content paper size width 
> larger than height with portrait orientation or width is less than height 
> with landscape orientation.
> 
> To reproduce the issue run the 
> [CutOffImage](https://bugs.openjdk.org/secure/attachment/101145/CutOffImage.java)
>  sample on MacOS.
> 
> Four rectangles are printed:
> 1. size 300x100, portrait orientation
> 2. size 300x100, landscape orientation
> 3. size 100x300, portrait orientation
> 4. size 100x300, landscape orientation
> 
> The first and fourth rectangles are truncated: [cut off 
> content](https://bugs.openjdk.org/secure/attachment/101153/before-fix-all.pdf)
> 
> The reason is that NSPrintInfo class does not allow to set paper size and 
> orientation independently.
> Setting paper size width large than height changes NSPrintInfo orientation to 
> landscape.
> Setting paper size width less than height changes NSPrintInfo orientation to 
> portrait.
> Updating NSPrintInfo orientation from landscape to portrait or from portrait 
> to landscape swaps NSPrintInfo paper width and height.
> 
> The Cocoa code that shows NSPrintInfo behavior:
> 
> #import 
> 
> int main()
> {
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> NSApp = [NSApplication sharedApplication];
> 
> #ifdef __MAC_10_9 // code for SDK 10.9 or newer
> #define NS_PORTRAIT NSPaperOrientationPortrait
> #define NS_LANDSCAPE NSPaperOrientationLandscape
> #else // code for SDK 10.8 or older
> #define NS_PORTRAIT NSPortraitOrientation
> #define NS_LANDSCAPE NSLandscapeOrientation
> #endif
> 
> printf("NS_PORTRAIT: %d\n", NS_PORTRAIT);
> printf("NS_LANDSCAPE: %d\n", NS_LANDSCAPE);
> 
> printf("create default print info\n");
> NSPrintInfo* defaultPrintInfo = [[NSPrintInfo sharedPrintInfo] copy];
> NSSize size = [defaultPrintInfo paperSize];
> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo 
> orientation], size.width, size.height);
> 
> printf("call setUpPrintOperationDefaultValues\n");
> [defaultPrintInfo setUpPrintOperationDefaultValues];
> size = [defaultPrintInfo paperSize];
> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo 
> orientation], size.width, size.height);
> 
> double w = 300.0;
> double h = 100.0;
> printf("set size: [%f, %f]\n", w, h);
> [defaultPrintInfo setPaperSize:NSMakeSize(w, h)];
> size = [defaultPrintInfo paperSize];
> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo 
> orientation], size.width, size.height);
> 
> printf("Set NS_PORTRAIT orientation\n");
> [defaultPrintInfo setOrientation: NS_PORTRAIT];
> size = [defaultPrintInfo paperSize];
> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo 
> orientation], size.width, size.height);
> 
> [NSApp run];
> 
> [NSApp release];
> [pool release];
> return(EXIT_SUCCESS);
> } 
> 
> 
> On macOS Mojave 10.14.5 it prints:
> 
> 
> NS_PORTRAIT: 0
> NS_LANDSCAPE: 1
> create default print info
> orientation: 0, paper size: [612.00, 792.00]
> call setUpPrintOperationDefaultValues
> orientation: 0, paper size: [612.00, 792.00]
> set size: [300.00, 100.00]
> orientation: 1, paper size: [300.00, 100.00] // orientation flip
> Set NS_PORTRAIT orientation
> orientation: 0, paper size: [100.00, 300.00] // size flip
> ``` 
> 
> There are four possible cases for printing a rectangle with different size 
> and orientation:
> 1. Input: paper size: (w > h), orientation portrait
>   [dstPrintInfo setPaperSize: NSMakeSize(w, h)]  // size: (w, h), 
> orientation: landscape
>   [dstPrintInfo setOrientation: NS_PORTRAIT] // size: (h, w), 
> orientation: portrait
>   Note: width and height are swapped
> 2. Input: paper size: (w > h), orientation landscape
>   [dstPrintInfo setPaperSize: NSMakeSize(h, w)]  // size: (h, w), 
> orientation: portrait
>   [dstPrintInfo setOrientation: NS_LANDSCAPE]  // size: (w, h), orientation: 
> landscape
> 3. Input: paper size: (w < h), orientation portrait
>   [dstPrintInfo setPaperSize: NSMakeSize(w, h)]  // size: (w, h), 
> orientation: portrait
>   [dstPrintInfo setOrientation: NS_PORTRAIT] // size: (w, h), 
> orientation: portrait
> 4. Input: paper size: (w < h), orientation landscape
>   [dstPrintInfo setPaperSize: NSMakeSize(h, w)]  // size: (h, w), 
> orientation: landscape
>   [dstPrintInfo setOrientation: NS_LANDSCAPE]  // size: (h, w), orientation: 
> landscape
>   Note: width and height are swapped
> 
> Only for cases 1 and 4 the final width and height are swapped.
> The proposed fix enlarges height for cases 1 and 4 to not cut the printed 
> rectangle.
> 
> It is not full fix which draws rectangles for cases 1 and 4 in the requested 
> size.
> Setting requested size leads that subsequent orientation flips width and 
> height.
> The fix only en

Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v4]

2022-11-02 Thread ravi gupta
> This testcase verify that List Item selection via mouse/keys generates 
> ItemEvent/ActionEvent appropriately.
> 
> a. Single click on the list generate ItemEvent and double click on item 
> generates ActionEvent.
> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
> generates ActionEvent.
> 
> Testing:
> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
> all pass.

ravi gupta has updated the pull request incrementally with one additional 
commit since the last revision:

  8295774: Write a test to verify that List Item selection events.

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10899/files
  - new: https://git.openjdk.org/jdk/pull/10899/files/69296bb4..814c3397

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=02-03

  Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/10899.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10899/head:pull/10899

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295774 : Write a test to verify that List Item selection events. [v4]

2022-11-02 Thread Alexey Ivanov
On Wed, 2 Nov 2022 14:51:02 GMT, ravi gupta  wrote:

>> This testcase verify that List Item selection via mouse/keys generates 
>> ItemEvent/ActionEvent appropriately.
>> 
>> a. Single click on the list generate ItemEvent and double click on item 
>> generates ActionEvent.
>> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
>> generates ActionEvent.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
>> all pass.
>
> ravi gupta has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8295774: Write a test to verify that List Item selection events.

Marked as reviewed by aivanov (Reviewer).

test/jdk/java/awt/event/ComponentEvent/ListItemEventsTest.java line 67:

> 65: });
> 66: list.addActionListener((event) -> {
> 67: System.out.println("Got an ActionEvent:" + event);

I prefer having a space after the colon in the string so that it's easier to 
read the message.

-

PR: https://git.openjdk.org/jdk/pull/10899


Re: RFR: 8295812: Skip the "half float" support in LittleCMS during the build

2022-11-02 Thread Magnus Ihse Bursie
On Sun, 23 Oct 2022 20:10:35 GMT, Sergey Bylokhov  wrote:

> The Java2d do not use "half" float in the image layouts, so we can disable it 
> in the LittleCMS library during the build. It is possible to do using 
> [this](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/native/liblcms/lcms2.h#L85)
>  public option:
> 
> 
> // Uncomment to get rid of the tables for "half" float support
> // #define CMS_NO_HALF_SUPPORT 1
> 
> 
> This change cuts not only the unused by java2d functions but also 
> [such](https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.desktop/share/native/liblcms/cmshalf.c#L63)
>  tables.
> 
> The size of liblcms decreased by 20 kB on Linux(536024 vs 515152) and 15 kB 
> on windows(246784 vs 231424). On macOS the  win is only 300 bytes.

Marked as reviewed by ihse (Reviewer).

Nicely spotted!

-

PR: https://git.openjdk.org/jdk/pull/10830


RFR: JDK-8295685: Update Libpng to 1.6.38

2022-11-02 Thread Harshitha Onkar
Updated libpng library to v1.6.38.

Following files have been updated -

- 12 source code files of libpng 
-  LICENSE, README, CHANGES files
- legal/libpng.md

-

Commit messages:
 - changed to unix style line endings
 - libpng update - v1.6.38

Changes: https://git.openjdk.org/jdk/pull/10953/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8295685
  Stats: 205 lines in 16 files changed: 83 ins; 33 del; 89 mod
  Patch: https://git.openjdk.org/jdk/pull/10953.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10953/head:pull/10953

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v2]

2022-11-02 Thread Harshitha Onkar
> Updated libpng library to v1.6.38.
> 
> Following files have been updated -
> 
> - 12 source code files of libpng 
> -  LICENSE, README, CHANGES files
> - legal/libpng.md

Harshitha Onkar has updated the pull request incrementally with one additional 
commit since the last revision:

  Updating.txt changes

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10953/files
  - new: https://git.openjdk.org/jdk/pull/10953/files/e5798056..fd4a9650

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=00-01

  Stats: 18 lines in 1 file changed: 11 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/10953.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10953/head:pull/10953

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v3]

2022-11-02 Thread Harshitha Onkar
> Updated libpng library to v1.6.38.
> 
> Following files have been updated -
> 
> - 12 source code files of libpng 
> - LICENSE, README, CHANGES, UPDATING text files
> - legal/libpng.md

Harshitha Onkar has updated the pull request incrementally with one additional 
commit since the last revision:

  updated instructions

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10953/files
  - new: https://git.openjdk.org/jdk/pull/10953/files/fd4a9650..6be50dc1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10953.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10953/head:pull/10953

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v3]

2022-11-02 Thread Alexander Zvegintsev
On Wed, 2 Nov 2022 21:15:02 GMT, Harshitha Onkar  wrote:

>> Updated libpng library to v1.6.38.
>> 
>> Following files have been updated -
>> 
>> - 12 source code files of libpng 
>> - LICENSE, README, CHANGES, UPDATING text files
>> - legal/libpng.md
>
> Harshitha Onkar has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   updated instructions

src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 7:

> 5: and in the embedded text, and extending the copyright date.
> 6: 
> 7: The updated info comes from the LICENSE and TRADEMARK files.

and AUTHORS

src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 51:

> 49: do
> 50: sed -e 's/[ ]* $//' ${f} > ${f}.tmp;
> 51: mv ${f}.tmp $f;

You can use `-i` option for `sed` instead of explicit temp file.

-i[SUFFIX], --in-place[=SUFFIX]

  edit files in place (makes backup if SUFFIX supplied)


So it can be simplified to `sed -i -e 's/[ ]* $//' ${f}`

BTW all 3 preparation actions can be performed in a single loop:



for f in *.c *.h;
do
  # replace tabs with spaces
  expand ${f} > ${f}.tmp;
  mv ${f}.tmp $f;

  # fix line endings to LF
  sed -i -e 's/\r$//g' ${f}

  # remove trailing spaces
  sed -i -e 's/[ ]* $//g' ${f} 
done

src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h line 1:

> 1: 

Not sure why this newline is needed.

-

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v3]

2022-11-02 Thread Harshitha Onkar
On Wed, 2 Nov 2022 21:18:43 GMT, Alexander Zvegintsev  
wrote:

>> Harshitha Onkar has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   updated instructions
>
> src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 51:
> 
>> 49: do
>> 50: sed -e 's/[ ]* $//' ${f} > ${f}.tmp;
>> 51: mv ${f}.tmp $f;
> 
> You can use `-i` option for `sed` instead of explicit temp file.
> 
> -i[SUFFIX], --in-place[=SUFFIX]
> 
>   edit files in place (makes backup if SUFFIX supplied)
> 
> 
> So it can be simplified to `sed -i -e 's/[ ]* $//' ${f}`
> 
> BTW all 3 preparation actions can be performed in a single loop:
> 
> 
> 
> for f in *.c *.h;
> do
>   # replace tabs with spaces
>   expand ${f} > ${f}.tmp;
>   mv ${f}.tmp $f;
> 
>   # fix line endings to LF
>   sed -i -e 's/\r$//g' ${f}
> 
>   # remove trailing spaces
>   sed -i -e 's/[ ]* $//g' ${f} 
> done

Thanks for the suggestion. I'll update it.

-

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v4]

2022-11-02 Thread Harshitha Onkar
> Updated libpng library to v1.6.38.
> 
> Following files have been updated -
> 
> - 12 source code files of libpng 
> - LICENSE, README, CHANGES, UPDATING text files
> - legal/libpng.md

Harshitha Onkar has updated the pull request incrementally with one additional 
commit since the last revision:

  consolidated script to remove trailing whitespaces and fix line endings

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10953/files
  - new: https://git.openjdk.org/jdk/pull/10953/files/6be50dc1..6fb39567

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10953&range=02-03

  Stats: 15 lines in 2 files changed: 0 ins; 2 del; 13 mod
  Patch: https://git.openjdk.org/jdk/pull/10953.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10953/head:pull/10953

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v3]

2022-11-02 Thread Harshitha Onkar
On Wed, 2 Nov 2022 22:20:03 GMT, Alexander Zvegintsev  
wrote:

>> Harshitha Onkar has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   updated instructions
>
> src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h line 1:
> 
>> 1: 
> 
> Not sure why this newline is needed.

Thanks for catching it. Updated.

-

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v4]

2022-11-02 Thread Alexander Zvegintsev
On Wed, 2 Nov 2022 23:24:18 GMT, Harshitha Onkar  wrote:

>> Updated libpng library to v1.6.38.
>> 
>> Following files have been updated -
>> 
>> - 12 source code files of libpng 
>> - LICENSE, README, CHANGES, UPDATING text files
>> - legal/libpng.md
>
> Harshitha Onkar has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   consolidated script to remove trailing whitespaces and fix line endings

src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 9:

> 7: The updated info comes from the LICENSE, TRADEMARK and AUTHORS files.
> 8: 
> 9: 2) Copy LICENSE, README, and CHANGES from the new version into OpenJDK's

I am not sure, but probably we might want also copy TRADEMARK and AUTHORS, 
since we started to pull info from them to `libpng.md`

src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 38:

> 36: 5) Run scripts to expand tabs and remove trailing white space from source 
> files.
> 37: 
> 38: First cd into the libpng folder and run the following scripts.

script without s?

src/java.desktop/share/native/libsplashscreen/libpng/UPDATING.txt line 54:

> 52: 
> 53: Make sure all the updated files have UNIX-STYLE (LF) line endings to avoid
> 54: whitespace errors.

This should be already handled by script above.

-

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: JDK-8295685: Update Libpng to 1.6.38 [v4]

2022-11-02 Thread Phil Race
On Wed, 2 Nov 2022 23:24:18 GMT, Harshitha Onkar  wrote:

>> Updated libpng library to v1.6.38.
>> 
>> Following files have been updated -
>> 
>> - 12 source code files of libpng 
>> - LICENSE, README, CHANGES, UPDATING text files
>> - legal/libpng.md
>
> Harshitha Onkar has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   consolidated script to remove trailing whitespaces and fix line endings

Looks fine on the understanding that you built  + tested on all platforms - 
running all automated tests.

-

Marked as reviewed by prr (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10953


Re: RFR: 6257207: JTable.getDefaultEditor throws NullPointerException [v4]

2022-11-02 Thread Prasanta Sadhukhan
> If getDefaultEditor() is called before the JTable model is setup, it results 
> in NPE.
> 
> This is because when JTable sets its model, which ends up firing a table 
> changed event. The testcase is listening for tableChanged events and querying 
> the editor. But the editor isn't installed until after the model is set which 
> results in NPE.
> Fix is to ensure initializeLocalVars() which initializes default editor is 
> setup before JTable sets its model.
> 
> No regression is observed in jtreg/jck testsuite with this change.

Prasanta Sadhukhan has updated the pull request incrementally with one 
additional commit since the last revision:

  Test review fix

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10871/files
  - new: https://git.openjdk.org/jdk/pull/10871/files/7ac0d1e8..a2c499fb

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10871&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10871&range=02-03

  Stats: 7 lines in 1 file changed: 1 ins; 3 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/10871.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10871/head:pull/10871

PR: https://git.openjdk.org/jdk/pull/10871


Re: RFR: 6257207: JTable.getDefaultEditor throws NullPointerException [v3]

2022-11-02 Thread Prasanta Sadhukhan
On Tue, 1 Nov 2022 16:45:45 GMT, Alexey Ivanov  wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Remove extra line
>
> test/jdk/javax/swing/JTable/JTableEditorNPE.java line 62:
> 
>> 60: });
>> 61: } finally {
>> 62: Thread.sleep(1000);
> 
> Is the `sleep` required?
> 
> If NPE is thrown, no UI appears at all; if NPE is not thrown, the UI may be 
> shown but not required.
> 
> Would it be enough to add the table to the frame and call `validate()`?

I added sleep to see the frame before it dispose but I agree it's not required 
for checking the fix..Modified as per comment...

-

PR: https://git.openjdk.org/jdk/pull/10871


Re: RFR: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes [v6]

2022-11-02 Thread Prasanta Sadhukhan
> The behavior of MatteBorder constructors taking Insets object as a parameter 
> is undocumented. It would throw NPE if null object is passed to it, which 
> should be documented in the spec.

Prasanta Sadhukhan has updated the pull request incrementally with one 
additional commit since the last revision:

  TitledBorder added

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10740/files
  - new: https://git.openjdk.org/jdk/pull/10740/files/e7081b0d..40891ee7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10740&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10740&range=04-05

  Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/10740.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10740/head:pull/10740

PR: https://git.openjdk.org/jdk/pull/10740


Re: RFR: 6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes [v7]

2022-11-02 Thread Prasanta Sadhukhan
> The behavior of MatteBorder constructors taking Insets object as a parameter 
> is undocumented. It would throw NPE if null object is passed to it, which 
> should be documented in the spec.

Prasanta Sadhukhan has updated the pull request incrementally with one 
additional commit since the last revision:

  AbstractBorder fix

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10740/files
  - new: https://git.openjdk.org/jdk/pull/10740/files/40891ee7..eaac0717

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10740&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10740&range=05-06

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10740.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10740/head:pull/10740

PR: https://git.openjdk.org/jdk/pull/10740


Re: RFR: 8295774: Write a test to verify List sends ItemEvent/ActionEvent [v5]

2022-11-02 Thread ravi gupta
> This testcase verify that List Item selection via mouse/keys generates 
> ItemEvent/ActionEvent appropriately.
> 
> a. Single click on the list generate ItemEvent and double click on item 
> generates ActionEvent.
> b. UP/DOWN keys on the list generate ItemEvent and enter key on item 
> generates ActionEvent.
> 
> Testing:
> Tested using Mach5(20 times per platform) in macos,linux and windows and got 
> all pass.

ravi gupta has updated the pull request incrementally with one additional 
commit since the last revision:

  8295774: Write a test to verify List sends ItemEvent/ActionEvent

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/10899/files
  - new: https://git.openjdk.org/jdk/pull/10899/files/814c3397..305b0122

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10899&range=03-04

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/10899.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10899/head:pull/10899

PR: https://git.openjdk.org/jdk/pull/10899