-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b36
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085092 | emb-9 | Alexandr Scherbatiy | P2 | Resolved | Fixed | team |
This issue appeared after fixing JCK-7301914 (which itself appeared due to the spec update in JDK-7016396)
The spec
http://docs.oracle.com/javase/8/docs/api/javax/swing/text/View.html#getNextVisualPositionFrom-int-javax.swing.text.Position.Bias-java.awt.Shape-int-javax.swing.text.Position.Bias:A-
says:
"BadLocationException - the given position is not a valid position within the document"
However for positions larger than the siaze of the document BLE is not thrown.
Please consider the following code:
--------------------------------------------------------------
package temp;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
public class BLE {
public static void main(String[] args) throws BadLocationException {
SwingUtilities.invokeLater(() -> {
JFormattedTextField jtf = new JFormattedTextField();
NavigationFilter nf = new NavigationFilter();
jtf.setText("Test for Tests");
JFrame jf = new JFrame();
jf.getContentPane().add(jtf);
jf.pack();
jf.setVisible(true);
Graphics g = jf.getGraphics();
jf.paint(g);
Position.Bias[] biasRet = {Position.Bias.Forward};
try {
nf.getNextVisualPositionFrom(jtf, 500, Position.Bias.Backward, SwingConstants.EAST,biasRet);
nf.getNextVisualPositionFrom(jtf, Integer.MAX_VALUE, Position.Bias.Forward, SwingConstants.EAST,biasRet);
} catch (BadLocationException e) {
e.printStackTrace();
}
});
}
}
--------------------------------------------------------------
No BadLocationException is thrown.
In addition to this there is a problem with the spec for the following method
http://docs.oracle.com/javase/8/docs/api/javax/swing/text/NavigationFilter.html#getNextVisualPositionFrom-javax.swing.text.JTextComponent-int-javax.swing.text.Position.Bias-int-javax.swing.text.Position.Bias:A-
BadLocationException is present but not described.
The following test fails due to this problem
api/javax_swing/text/NavigationFilter/index.html#Methods[NavigationFilter0006]
The spec
http://docs.oracle.com/javase/8/docs/api/javax/swing/text/View.html#getNextVisualPositionFrom-int-javax.swing.text.Position.Bias-java.awt.Shape-int-javax.swing.text.Position.Bias:A-
says:
"BadLocationException - the given position is not a valid position within the document"
However for positions larger than the siaze of the document BLE is not thrown.
Please consider the following code:
--------------------------------------------------------------
package temp;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
public class BLE {
public static void main(String[] args) throws BadLocationException {
SwingUtilities.invokeLater(() -> {
JFormattedTextField jtf = new JFormattedTextField();
NavigationFilter nf = new NavigationFilter();
jtf.setText("Test for Tests");
JFrame jf = new JFrame();
jf.getContentPane().add(jtf);
jf.pack();
jf.setVisible(true);
Graphics g = jf.getGraphics();
jf.paint(g);
Position.Bias[] biasRet = {Position.Bias.Forward};
try {
nf.getNextVisualPositionFrom(jtf, 500, Position.Bias.Backward, SwingConstants.EAST,biasRet);
nf.getNextVisualPositionFrom(jtf, Integer.MAX_VALUE, Position.Bias.Forward, SwingConstants.EAST,biasRet);
} catch (BadLocationException e) {
e.printStackTrace();
}
});
}
}
--------------------------------------------------------------
No BadLocationException is thrown.
In addition to this there is a problem with the spec for the following method
http://docs.oracle.com/javase/8/docs/api/javax/swing/text/NavigationFilter.html#getNextVisualPositionFrom-javax.swing.text.JTextComponent-int-javax.swing.text.Position.Bias-int-javax.swing.text.Position.Bias:A-
BadLocationException is present but not described.
The following test fails due to this problem
api/javax_swing/text/NavigationFilter/index.html#Methods[NavigationFilter0006]
- backported by
-
JDK-8085092 BadLocationException is not thrown by javax.swing.text.View.getNextVisualPositionFrom() for invalid positions
-
- Resolved
-
- relates to
-
JDK-7016396 (spec) JCK test mentioned in 6735293 is still failing
-
- Closed
-