-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2beta3
-
generic
-
generic
-
Not verified
committedCharacterCount==string_length+1 does not throw IllegalArgumentException
committedCharacter count must be less than the string length, so string length+1
value on InputMethodEvent construction should raise IllegalArgument
Exception.
Problem on Windows 95 and Solaris
Compile and run the attached test code.
---------------------------------------------------------------------
import java.awt.event.InputMethodEvent;
import java.awt.font.TextHitInfo;
import java.awt.Canvas;
import java.text.AttributedString;
import java.text.AttributedCharacterIterator;
class test
{
static final String SAMPLE_STRING = "This is an attributed string.";
static AttributedCharacterIterator attrCharIterator;
public static void main( String args[] )
{
boolean exceptionCaught = false;
InputMethodEvent ime;
Canvas c = new Canvas();
attrCharIterator= new AttributedString( SAMPLE_STRING ).getIterator();
try
{
ime = new InputMethodEvent( c,
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
attrCharIterator,
SAMPLE_STRING.length()+1, null, null );
}
catch ( IllegalArgumentException iae )
{
exceptionCaught = true;
}
if ( exceptionCaught )
System.out.println( "passed." );
else
System.out.println( "failed. IllegalArgumentException is expected" );
}
}
committedCharacter count must be less than the string length, so string length+1
value on InputMethodEvent construction should raise IllegalArgument
Exception.
Problem on Windows 95 and Solaris
Compile and run the attached test code.
---------------------------------------------------------------------
import java.awt.event.InputMethodEvent;
import java.awt.font.TextHitInfo;
import java.awt.Canvas;
import java.text.AttributedString;
import java.text.AttributedCharacterIterator;
class test
{
static final String SAMPLE_STRING = "This is an attributed string.";
static AttributedCharacterIterator attrCharIterator;
public static void main( String args[] )
{
boolean exceptionCaught = false;
InputMethodEvent ime;
Canvas c = new Canvas();
attrCharIterator= new AttributedString( SAMPLE_STRING ).getIterator();
try
{
ime = new InputMethodEvent( c,
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
attrCharIterator,
SAMPLE_STRING.length()+1, null, null );
}
catch ( IllegalArgumentException iae )
{
exceptionCaught = true;
}
if ( exceptionCaught )
System.out.println( "passed." );
else
System.out.println( "failed. IllegalArgumentException is expected" );
}
}