Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7187775

UIFactory.createMenu(String) cannot be used outside of javatest.jar

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • jt4.5
    • jt4.5
    • tools
    • b14
    • generic
    • generic

      An attempt to call UIFactory.createMenu(String) in the code outside of javatest.jar
      (UIfactory was created with the right, out-of-javatest.jar class reference provided as the parameter value)
      results in unexpected exception:

      Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Can't find bundle for base name com.sun.tck.midp.javatest.i18n, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
              at com.sun.javatest.ResourceLoader.getBundle(ResourceLoader.java:180)
              at com.sun.javatest.util.I18NResourceBundle.getKeys(I18NResourceBundle.java:161)
              at com.sun.javatest.tool.UIFactory$UIFactoryExt.hasKey(UIFactory.java:3592)
              at com.sun.javatest.tool.UIFactory$UIFactoryExt.getI18NString(UIFactory.java:3562)
              at com.sun.javatest.tool.UIFactory.initMenu(UIFactory.java:1509)
              at com.sun.javatest.tool.UIFactory.createMenu(UIFactory.java:1491)
              at com.sun.tck.midp.javatest.TCKSessionControl.getMenu(TCKSessionControl.java:234)
              at com.sun.javatest.exec.ExecTool.getMenuBar(ExecTool.java:203)
              at com.sun.javatest.tool.DeskView.addToolMenuItemsToFrameMenuBar(DeskView.java:369)
              at com.sun.javatest.tool.TabDeskView.setSelectedTool(TabDeskView.java:236)
              at com.sun.javatest.tool.Desktop.setSelectedTool(Desktop.java:367)
              at com.sun.javatest.exec.ExecToolManager.addNewExecTool(ExecToolManager.java:574)
              at com.sun.javatest.exec.ExecToolManager$2.actionPerformed(ExecToolManager.java:639)
              at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
              at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
              at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
              at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
              at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
              at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
              at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(BasicMenuItemUI.java:1327)
              at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:568)
              at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:465)
              at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:411)
              at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:305)
              at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
              at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
              at java.awt.Component.processMouseEvent(Component.java:6263)
              at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
              at java.awt.Component.processEvent(Component.java:6028)
              at java.awt.Container.processEvent(Container.java:2041)
              at java.awt.Component.dispatchEventImpl(Component.java:4630)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
              at java.awt.Container.dispatchEventImpl(Container.java:2085)
              at java.awt.Window.dispatchEventImpl(Window.java:2475)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


      ====================
      As Dima F. mentioned, the code is looking in the following way:


      I18NResourceBundle:
      private Object getObj(String key) throws MissingResourceException {
      if (delegate == null) {
      delegate = ResourceLoader.getBundle(name, Locale.getDefault(), classLoader);
      }
      ...
      }

      public Enumeration getKeys() {
      if (delegate == null) {
      delegate = ResourceLoader.getBundle(name);
      }
      ...
      }

      Thus, given that getKeys() is called first, the bundle doesn't include
      a reference to provide class' classloader.

            dfazunen Dmitry Fazunenko (Inactive)
            bkvartsk Boris Kvartskhava
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: