Announcement Announcement Module
Collapse
No announcement yet.
Error in Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error in

    Hi folks,

    I am getting the following exception when using TableFormBuilder to create a form.

    Here is my code:

    Code:
    public class ConversationForm extends AbstractForm {
    
    	public ConversationForm(FormModel model) {
    		super(model, "ConversationForm");
    	}
    
    	@Override
    	protected JComponent createFormControl() {
    		TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());
    
    		formBuilder.add("requestMethod");
    		formBuilder.add("requestUrl");
    		formBuilder.add("requestVersion");
    		formBuilder.row();
    		formBuilder.add("requestContent");
    		formBuilder.row();
    		formBuilder.add("responseVersion");
    		formBuilder.add("responseStatus");
    		formBuilder.add("responseMessage");
    		formBuilder.row();
    		formBuilder.add("responseContent");
    		return formBuilder.getForm();
    	}
    }
    Code:
    java.lang.NullPointerException
    	at java.util.Hashtable.put(Unknown Source)
    	at javax.swing.text.JTextComponent$DefaultKeymap.addActionForKeyStroke(Unknown Source)
    	at org.springframework.richclient.text.TextComponentPopup.registerAccelerators(TextComponentPopup.java:156)
    	at org.springframework.richclient.text.TextComponentPopup.<init>(TextComponentPopup.java:108)
    	at org.springframework.richclient.text.TextComponentPopup.attachPopup(TextComponentPopup.java:67)
    	at org.springframework.richclient.text.TextComponentPopupInterceptorFactory$TextComponentPopupInterceptor.processComponent(TextComponentPopupInterceptorFactory.java:55)
    	at org.springframework.richclient.form.builder.support.ChainedInterceptorFactory$ChainedInterceptor.processComponent(ChainedInterceptorFactory.java:82)
    	at org.springframework.richclient.form.binding.support.AbstractBindingFactory.interceptBinding(AbstractBindingFactory.java:90)
    	at org.springframework.richclient.form.binding.support.AbstractBindingFactory.createBinding(AbstractBindingFactory.java:68)
    	at org.springframework.richclient.form.binding.support.AbstractBindingFactory.createBinding(AbstractBindingFactory.java:53)
    	at org.springframework.richclient.form.builder.AbstractFormBuilder.getDefaultBinding(AbstractFormBuilder.java:72)
    	at org.springframework.richclient.form.builder.TableFormBuilder.add(TableFormBuilder.java:55)
    	at org.springframework.richclient.form.builder.TableFormBuilder.add(TableFormBuilder.java:47)
    	at org.owasp.webscarab.ui.ConversationForm.createFormControl(ConversationForm.java:27)
    The null pointer seems to be that the value that is being passed to the HashTable is null (not the key). As best I can judge, this is related to the undoCommand globalID. I have tried to debug this, but I have been unsuccessful so far.

    Does anyone have any ideas?

    Thanks,

    Rogan

  • #2
    Error in TextComponentPopup

    The error seems to be the null when creating the TargetableActionCommand in the following code in TextComponentPopup.java:

    Code:
        protected CommandManager getCommandManager() {
            CommandManager commandManager;
            ApplicationWindow appWindow = Application.instance().getActiveWindow();
            if (appWindow == null || appWindow.getCommandManager() == null) {
                if (localCommandManager == null) {
                    localCommandManager = new DefaultCommandManager();
                }
                commandManager = localCommandManager;
            }
            else {
                commandManager = appWindow.getCommandManager();
            }
            for (int i = 0; i < COMMANDS.length; i++) {
                if (!commandManager.containsActionCommand(COMMANDS[i])) {
                    commandManager.registerCommand(new TargetableActionCommand(COMMANDS[i], null));
                }
            }
            return commandManager;
        }
    It is then immediately used to register keyboard shortcuts, and since it is null, we throw an exception.

    Rogan

    Comment


    • #3
      my Solution

      <bean id="messageSource"
      class="org.springframework.context.support.Resourc eBundleMessageSource">
      <property name="basenames">
      <list>

      <value>org.springframework.richclient.application. messages</value>
      </list>
      </property>
      </bean>


      add the red text in your <application-context>.xml, the hot keys of the commands will be taken out from the messages_xx.properties

      Comment


      • #4
        Thanks for the suggestion.

        I already had that in my application context, along with a reference to my own messages.properties file as well.

        I can't remember now, but I think I worked around this problem by making sure that the cut and paste global commands were always defined in the commands.context file (I didn't think I needed them since I would not be using them for my own purposes other than the usual copy and paste in text fields)

        Regards,

        Rogan

        Comment


        • #5
          I have exactly the same problem
          Can anyone please give instructions what to do?

          Comment


          • #6
            OK, I got it. Don't use the Eclipse XML formatter on the richclient-application-context.xml

            It inserted some spaces,
            so instead of
            Code:
            <value>org.springframework.richclient.application.messages</value>
            i had
            Code:
            <value>
                  org.springframework.richclient.application.messages
            </value>
            This messed things up. The labels weren't working, the hot keys...


            So, who's fault was it anyway? Mine, eclipse or Spring? Should Spring parse its XMLs better?
            Last edited by bambala2002; Jul 23rd, 2006, 11:46 AM.

            Comment

            Working...
            X