-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
7
-
x86
-
linux
Run:
---%<---
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
public class UIDefaults_getError {
public static void main(String[] x) {
JComponent c = new JComponent() {
@Override
public String getUIClassID() {
return "fake";
}
@Override
public String toString() {
return "<the component>";
}
};
UIManager.getDefaults().put("fake", FakeID.class.getName());
UIManager.getDefaults().getUI(c);
}
public static class FakeID extends ComponentUI {
public static FakeID createUI(JComponent c) {
throw new IllegalStateException("Oops!");
}
}
}
---%<---
I get:
---%<---
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b04)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b04, mixed mode, sharing)
UIDefaults.getUI() failed: createUI() failed for <the component> java.lang.reflect.InvocationTargetException
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:706)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:117)
at javax.swing.UIDefaults.getUI(UIDefaults.java:752)
at UIDefaults_getError.main(UIDefaults_getError.java:17)
---%<---
Note that the original stack trace is lost; even its message is gone.
---%<---
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
public class UIDefaults_getError {
public static void main(String[] x) {
JComponent c = new JComponent() {
@Override
public String getUIClassID() {
return "fake";
}
@Override
public String toString() {
return "<the component>";
}
};
UIManager.getDefaults().put("fake", FakeID.class.getName());
UIManager.getDefaults().getUI(c);
}
public static class FakeID extends ComponentUI {
public static FakeID createUI(JComponent c) {
throw new IllegalStateException("Oops!");
}
}
}
---%<---
I get:
---%<---
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b04)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b04, mixed mode, sharing)
UIDefaults.getUI() failed: createUI() failed for <the component> java.lang.reflect.InvocationTargetException
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:706)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:117)
at javax.swing.UIDefaults.getUI(UIDefaults.java:752)
at UIDefaults_getError.main(UIDefaults_getError.java:17)
---%<---
Note that the original stack trace is lost; even its message is gone.
- duplicates
-
JDK-4870789 RFE: UIDefaults.getUIError() hides real error
- Open
-
JDK-4870789 RFE: UIDefaults.getUIError() hides real error
- Open