-
Bug
-
Resolution: Fixed
-
P3
-
1.4.1
-
03
-
x86
-
windows_nt, windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2058584 | 1.4.2 | Leif Samuelsson | P3 | Resolved | Fixed | b12 |
Name: gm110360 Date: 09/13/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0
A DESCRIPTION OF THE PROBLEM :
Entering a bad pattern as the filename in a JFileChooser
causes uncaught java.util.regex.PatternSyntaxException.
For example, \C.* will cause this.
Also, there is a typo in the error message. Sequence
is spelled "squence".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run attached code.
2. Enter \C.* as the filename and hit enter.
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expect an error dialog for the user indicating a bad
pattern or something similar. Instead, there is an
uncaught exception.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.util.regex.PatternSyntaxException: Illegal/unsupported escape squence near
index 1
\C..*
^
at java.util.regex.Pattern.error(Pattern.java:1472)
at java.util.regex.Pattern.escape(Pattern.java:1900)
at java.util.regex.Pattern.atom(Pattern.java:1661)
at java.util.regex.Pattern.sequence(Pattern.java:1545)
at java.util.regex.Pattern.expr(Pattern.java:1489)
at java.util.regex.Pattern.compile(Pattern.java:1257)
at java.util.regex.Pattern.<init>(Pattern.java:1013)
at java.util.regex.Pattern.compile(Pattern.java:783)
at javax.swing.plaf.basic.BasicFileChooserUI$GlobFilter.setPattern
(BasicFileChooserUI.java:913)
at
javax.swing.plaf.basic.BasicFileChooserUI$ApproveSelectionAction.actionPerformed
(BasicFileChooserUI.java:756)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1502)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2422)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2468)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
at java.awt.Component.processEvent(Component.java:4830)
at java.awt.Container.processEvent(Container.java:1380)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.KeyboardFocusManager.redispatchEvent
(KeyboardFocusManager.java:1700)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent
(DefaultKeyboardFocusManager.java:568)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent
(DefaultKeyboardFocusManager.java:739)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions
(DefaultKeyboardFocusManager.java:673)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent
(DefaultKeyboardFocusManager.java:534)
at java.awt.Component.dispatchEventImpl(Component.java:3396)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Window.dispatchEventImpl(Window.java:1566)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class JFileChooserBug2 {
public static void main(String args[]) {
JFileChooser fc = new JFileChooser();
fc.showOpenDialog(null);
}
}
---------- END SOURCE ----------
(Review ID: 164457)
======================================================================
- backported by
-
JDK-2058584 Entering bad pattern in JFileChooser causes PatternSyntaxException
-
- Resolved
-
- duplicates
-
JDK-4788054 JFileChooser filter throws exception on filter *.*) on Windows
-
- Closed
-