Re: [OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-03 Thread Sergey Bylokhov
On Wed, 3 Mar 2021 19:44:33 GMT, Alexander Zvegintsev  
wrote:

>> src/java.desktop/share/classes/java/awt/color/ColorSpace.java line 454:
>> 
>>> 452:  * Returns the name of the component given the component index.
>>> 453:  *
>>> 454:  * @param  component the component index
>> 
>> All other methods use the "component" as a name of the component index.
>
> I guess it will require a CSR request.

nope, it is just renaming of the parameter

-

PR: https://git.openjdk.java.net/jdk/pull/2801


Re: [OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-03 Thread Alexey Ivanov
On Wed, 3 Mar 2021 03:46:59 GMT, Sergey Bylokhov  wrote:

> The java.awt.color.ColorSpace.getName()  method does not use any kind of 
> synchronization to properly initialize and use the static cache for the color 
> components names.

Marked as reviewed by aivanov (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/2801


Re: [OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-03 Thread Alexander Zvegintsev
On Wed, 3 Mar 2021 03:55:42 GMT, Sergey Bylokhov  wrote:

>> The java.awt.color.ColorSpace.getName()  method does not use any kind of 
>> synchronization to properly initialize and use the static cache for the 
>> color components names.
>
> src/java.desktop/share/classes/java/awt/color/ColorSpace.java line 454:
> 
>> 452:  * Returns the name of the component given the component index.
>> 453:  *
>> 454:  * @param  component the component index
> 
> All other methods use the "component" as a name of the component index.

I guess it will require a CSR request.

-

PR: https://git.openjdk.java.net/jdk/pull/2801


Re: [OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-03 Thread Alexander Zvegintsev
On Wed, 3 Mar 2021 03:46:59 GMT, Sergey Bylokhov  wrote:

> The java.awt.color.ColorSpace.getName()  method does not use any kind of 
> synchronization to properly initialize and use the static cache for the color 
> components names.

Marked as reviewed by azvegint (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/2801


[OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-02 Thread Sergey Bylokhov
The java.awt.color.ColorSpace.getName()  method does not use any kind of 
synchronization to properly initialize and use the static cache for the color 
components names.

-

Commit messages:
 - Update ColorSpace.java

Changes: https://git.openjdk.java.net/jdk/pull/2801/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=2801=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262915
  Stats: 53 lines in 1 file changed: 5 ins; 24 del; 24 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2801.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2801/head:pull/2801

PR: https://git.openjdk.java.net/jdk/pull/2801


Re: [OpenJDK 2D-Dev] RFR: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe

2021-03-02 Thread Sergey Bylokhov
On Wed, 3 Mar 2021 03:46:59 GMT, Sergey Bylokhov  wrote:

> The java.awt.color.ColorSpace.getName()  method does not use any kind of 
> synchronization to properly initialize and use the static cache for the color 
> components names.

src/java.desktop/share/classes/java/awt/color/ColorSpace.java line 115:

> 113:  * Lazy-initialized names of components in the color space.
> 114:  */
> 115: private transient volatile String [] compName;

The volatile keyword is the only one necessary to fix this bug, everything else 
is a cleanup.

src/java.desktop/share/classes/java/awt/color/ColorSpace.java line 454:

> 452:  * Returns the name of the component given the component index.
> 453:  *
> 454:  * @param  component the component index

All other methods use the "component" as a name of the component index.

src/java.desktop/share/classes/java/awt/color/ColorSpace.java line 459:

> 457: rangeCheck(idx);
> 458: if (compName == null) {
> 459: switch (type) {

the "switch statement" is replaced by the "switch expression"

-

PR: https://git.openjdk.java.net/jdk/pull/2801