Results 1 to 6 of 6

Thread: Error in

  1. #1
    Join Date
    Feb 2006
    Posts
    118

    Default 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. #2
    Join Date
    Feb 2006
    Posts
    118

    Default 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

  3. #3

    Default 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

  4. #4
    Join Date
    Feb 2006
    Posts
    118

    Default

    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

  5. #5
    Join Date
    Jul 2006
    Posts
    6

    Default

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

  6. #6
    Join Date
    Jul 2006
    Posts
    6

    Default

    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 at 10:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •