Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FilterBuilder - _3 is null _3 is undefined error

    Environment
    SmartGWT version 4.0p EE (trial)

    BTW: Still waiting for any information about my Power version order nad Power version link on your side is not wotking

    Browser: Firefox 25.0.1
    System: Win 7, Win 8

    Calling the getCriteria() or even adding FilterBuilder object to a layout causes an wierd exeption. But actually not all methods called on an object of this class causes this error. For Example addPrompt("") works fine.

    "_3 is null" or "_3 is undefined"

    I had a similar problem in 3.1p but was surprisingly able to fix it with a delay on member add. But now nothing is working.

    Simple Example in onModuleLoad() :
    I

    Code:
    com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.form.FilterBuilder::create()([]): _3 is null
    	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
    	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
    	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
    	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    	at com.smartgwt.client.widgets.form.FilterBuilder.create(FilterBuilder.java)
    	at com.smartgwt.client.widgets.BaseWidget.getOrCreateJsObj(BaseWidget.java:469)
    	at com.smartgwt.client.widgets.layout.Layout.addMember(Layout.java:1263)
    	at com.evizone.rbp.ui.client.Com_evizone_rbp_UI.onModuleLoad(Com_evizone_rbp_UI.java:44)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
    	at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
    	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    	at java.lang.Thread.run(Thread.java:724)
    Code:
     
    public void onModuleLoad() {	
    		
    		VLayout layout = new VLayout();
    		try {
    			FilterBuilder filter = new FilterBuilder();
    			filter = new FilterBuilder();
    			layout.addMember(filter);	
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    }
    Code:
     
    public void onModuleLoad() {	
    		
    		try {
    			FilterBuilder filter = new FilterBuilder();
    			filter = new FilterBuilder();
    			filter.getCriteria();	
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    }

    #2
    The FilterBuilder class will not function without a specified DataSource. We will look at whether we can handle this more gracefully, but to resolve this you'll need to specify a DataSource before the FilterBuilder is actually created in JavaScript scope (in this case via the "addMember" call).

    Regards
    Isomorphic Software

    Comment


      #3
      Thank you that was helpful

      Comment


        #4
        Another null pointer problem

        version: v9.0p_2013-12-11/PowerEdition Deployment (built 2013-12-11)

        Adding criteria :
        Code:
         Criterion criterion = new Criterion(OperatorId.OR);		
        		for(Long userIDs  : params.getMessageFilter().getEmployeeIDs()){
        			Criterion userCrit = new Criterion(MessageInterface._employeeIDs, OperatorId.CONTAINS, ","+userIDs+",");
        			criterion.addCriteria(userCrit);
        		}
        causesnull pointer on addCriteria()

        but when Criterion criterion operator changed to AND everything works fine

        Comment


          #5
          I'm not able to create an NPE with the description you've provided. Can you provide a more direct test case, or modify the attached code below and demonstrate how you are able ot see this issue.

          Code:
          final FilterBuilder filter = new FilterBuilder();
          		filter.setDataSource(DataSource.get("supplyItem"));
          		
          		Button button = new Button();
          		button.addClickHandler(new ClickHandler() {
          			@Override
          			public void onClick(ClickEvent event) {
          				Criterion criterion = new Criterion(OperatorId.OR);		
          				Criterion userCrit = new Criterion("SKU", OperatorId.CONTAINS, "9");
          //				criterion.addCriteria(new Criteria("SKU", "9"));
          				criterion.addCriteria(userCrit);
          				filter.addCriterion(criterion);
          			}
          		});
          
          		VLayout layout = new VLayout();
          		layout.addMember(filter);	
          		layout.addMember(button);
          		layout.draw();

          Comment


            #6
            Sadly: NPE
            Attached Files

            Comment


              #7
              Can you clarify what you're saying - you ran the code we provided (which does not NPE for us) and yet somehow received an NPE?

              Comment


                #8
                Sorry for the rude answer, work overload. running your code in onModuleLoad resulted in the pop up shown on the image.

                Comment


                  #9
                  If it wasn't clear, this code must be run in a project where the "supplyItem" DataSource (which comes with the SDK) is present. For example, it can be dropped into onModuleLoad in the "builtinds" sample project.

                  Comment


                    #10
                    It was run in my project in onModulLoad() without any other code.

                    Comment


                      #11
                      That would be expected to fail (see above) although it fails with a very clean error message explaining exactly what's wrong (missing DataSource).

                      So, no apparent framework issue here, let us know if you can produce a test case that would be expected to work but does not.

                      Comment


                        #12
                        Firstly, I used an existing non null DS. Secondly the problem is not connected with the FilterBuilder I was talking about simple Criterion usage, i get the null regardless using/not using filterbuilder.

                        The NPE happens in line

                        Code:
                        if (this.getAttributeAsObject("value") != null || this.getCriteria().length != 0) {
                        in the
                        Code:
                         public void addCriteria(Criterion c)
                        method in Criterion.class

                        and it seems that if you add the first crit the
                        Code:
                        this.getCriteria().length
                        throws the exeption - although not sure, but exception indicates this lane

                        Comment


                          #13
                          You should see a fix for this in tonights nightly build of 4.0.

                          Isomorphic

                          Comment

                          Working...
                          X