Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 23:39:19 GMT, Phil Race wrote: > Approving as critical to fix the NPE. There seems possible there may be > followup work in a later release. There will be. - PR: https://git.openjdk.org/jdk20/pull/122

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Tue, 7 Feb 2023 23:23:24 GMT, Alexander Zuev wrote: >> Check if the component is associated with the caret before calling methods >> from it. Added test case that will make sure that will not happen again. > > Alexander Zuev has updated the pull request incrementally with one additional >

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 23:17:59 GMT, Alexander Zuev wrote: > > But that seems wrong. Why is it not wrong ? > > It might be an oversight of the initial fix, if you think it is wrong we can > submit a bug and i can fix it. I definitely do not think it is critical and i > do not think it is related

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 23:14:18 GMT, Phil Race wrote: > But that seems wrong. Why is it not wrong ? It might be an oversight of the initial fix, if you think it is wrong we can submit a bug and i can fix it. I definitely do not think it is critical and i do not think it is related to the nature

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 23:07:40 GMT, Alexander Zuev wrote: > > How do you tell that apart from the app directly clearing it ? ie the APP > > calling setBlinkRate(0) ? > > I do not - while component is non-editable you can not change blink rate to > 0, once the component will become editable the

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 23:05:15 GMT, Phil Race wrote: > How do you tell that apart from the app directly clearing it ? ie the APP > calling setBlinkRate(0) ? I do not - while component is non-editable you can not change blink rate to 0, once the component will become editable the last non-zero

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 22:59:35 GMT, Alexander Zuev wrote: > > We surely don't want to keep the old blink rate just because a component is > > non-editable ? > > When we receive focus on non-editable component we set blink rate to 0 to > stop caret blinking. If we do not add this condition then

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 22:46:00 GMT, Phil Race wrote: > We surely don't want to keep the old blink rate just because a component is > non-editable ? When we receive focus on non-editable component we set blink rate to 0 to stop caret blinking. If we do not add this condition then we immediately

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 22:22:59 GMT, Alexander Zuev wrote: > > Why do we not clear these unconditionally ? > > What is the point of saving it if there's a non-editable component ? > > Because then when we set component non-editable the stored blink rate will be > lost and we will not be able to

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 21:40:04 GMT, Phil Race wrote: > Why do we not clear these unconditionally ? > What is the point of saving it if there's a non-editable component ? Because then when we set component non-editable the stored blink rate will be lost and we will not be able to restore it when

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Tue, 7 Feb 2023 23:23:24 GMT, Alexander Zuev wrote: >> Check if the component is associated with the caret before calling methods >> from it. Added test case that will make sure that will not happen again. > > Alexander Zuev has updated the pull request incrementally with one additional >

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 21:02:08 GMT, Phil Race wrote: >> Suppose I have this code >> >> Caret c = new DefaultCaret() >> c.setBlinkRate(50); >> c.install(editableJComponent); >> >> BEFORE 4512626 the JDK code looked like this >> >> if (rate != 0) { >> if (flasher == null) { >>

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 20:12:28 GMT, Phil Race wrote: >>> if we create a caret, then call setBlinkRate(), and then install() >>> then the blink rate appears to be ignored whereas before 4512626 it was >>> applied. >> >> Ok, if the text component is already visible and editable and focused and we

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Wed, 8 Feb 2023 18:12:40 GMT, Alexander Zuev wrote: >> So if I go back and look at the code before your previous fix, there was no >> check, >> so the timer is created and then I'd expect applies when the caret is >> installed on a component. >> Here that behaviour is changed, so that if we

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Alexander Zuev
On Wed, 8 Feb 2023 17:03:01 GMT, Phil Race wrote: > if we create a caret, then call setBlinkRate(), and then install() > then the blink rate appears to be ignored whereas before 4512626 it was > applied. Ok, if the text component is already visible and editable and focused and we install the

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-08 Thread Phil Race
On Tue, 7 Feb 2023 23:16:14 GMT, Alexander Zuev wrote: >> src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java line 1054: >> >>> 1052: if (rate != 0) { >>> 1053: if (component != null && component.isEditable()) { >>> 1054: if (flasher == null) {

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-07 Thread Harshitha Onkar
On Tue, 7 Feb 2023 23:23:24 GMT, Alexander Zuev wrote: >> Check if the component is associated with the caret before calling methods >> from it. Added test case that will make sure that will not happen again. > > Alexander Zuev has updated the pull request incrementally with one additional >

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-07 Thread Damon Nguyen
On Tue, 7 Feb 2023 23:23:24 GMT, Alexander Zuev wrote: >> Check if the component is associated with the caret before calling methods >> from it. Added test case that will make sure that will not happen again. > > Alexander Zuev has updated the pull request incrementally with one additional >

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE [v2]

2023-02-07 Thread Alexander Zuev
> Check if the component is associated with the caret before calling methods > from it. Added test case that will make sure that will not happen again. Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision: Fixe copyright year.

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE

2023-02-07 Thread Alexander Zuev
On Tue, 7 Feb 2023 23:07:55 GMT, Phil Race wrote: >> Check if the component is associated with the caret before calling methods >> from it. Added test case that will make sure that will not happen again. > > src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java line 1054: > >>

Re: [jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE

2023-02-07 Thread Phil Race
On Tue, 7 Feb 2023 22:49:55 GMT, Alexander Zuev wrote: > Check if the component is associated with the caret before calling methods > from it. Added test case that will make sure that will not happen again. src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java line 1054: > 1052:

[jdk20] RFR: 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE

2023-02-07 Thread Alexander Zuev
Check if the component is associated with the caret before calling methods from it. Added test case that will make sure that will not happen again. - Commit messages: - 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE Changes: