JDK-4939397 : SPEC BUG: java.awt.TextComponent 5 issues
  • Type: Bug
  • Component: docs
  • Sub-Component: guides
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2003-10-17
  • Updated: 2017-05-16
  • Resolved: 2004-02-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 betaFixed
Related Reports
Relates :  
Description

Name: sdR10048			Date: 10/17/2003


Filed By      : SPB JCK team (###@###.###)
JDK           : java full version "1.5.0-beta-b23"

Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
public void setCaretPosition(int position)
Sets the position of the text insertion caret for this text component.
The caret position is constrained to be at or before the current 
selection end. If the caller supplies a value for position that is 
greater than the end of the component's text, the caret position 
is set to the end of the component's text. This happens silently 
and without failure. The caret position also cannot be set to less 
than zero, the beginning of the component's text. If the caller 
supplies a value for position that is less than zero, an I
llegalArgumentException is thrown. 

Parameters:
position - the position of the text insertion caret 
Throws: 
IllegalArgumentException - if the value supplied for position is less than zero

===

public int getCaretPosition()
Gets the position of the text insertion caret for this text component. 

Returns:
the position of the text insertion caret

===

public String getText()
Returns the text that is presented by this text component. 

...
---------- end-of-excerpt ---------------

Problem description
===================
The spec for the designated methods does not document some issues:

1. the default component's text value if it has not been set before

2. expected behaviour for setCaretPosition if text has not been set before

3. expected behaviour for getCaretPosition if text has not been set before

4. expected behaviour for getCaretPosition if caret position has not been set before

5. expected behaviour for getCaretPosition if text has been changed 
   so the caret position is out of the new text bounds

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: tiger-beta INTEGRATED IN: tiger-beta VERIFIED IN: tiger-b40
28-08-2004

PUBLIC COMMENTS .
28-08-2004

EVALUATION The spec for the designated methods does not document some issues. ###@###.### 2003-10-17 Ran some tests, had Brent review proposed doc changes. Approved by CCC. Fixed for tiger. ###@###.### 2003-12-03 ====================================================== The 5th bug issue is not resolved. ^C For example: textComponent.setText("LONG TEXT"); textComponent.setCaretPosition(6); textComponent.setText(""); System.out.println(textComponent.getCaretPosition()); That was the 5th bug issue (as I noted) but in the consequent CCC request it was mistakenly changed. From / 5. expected behaviour for getCaretPosition if text has been changed so the caret position is out of the new text bounds / to / 5. Expected behavior for getCaretPosition if text hasn't been ^^^^^^ changed so the caret position is out of the new text bounds. / -------------------------------- This will require a new CCC request and I can't resubmit under the same bug #, so I am closing this bug and creating a new bug. I am putting this back to integrated (since the other issues are fixed and integrated). See also bug #4995931. ###@###.### 2004-02-17
17-02-2004