ictvmt / mvp4g

Automatically exported from code.google.com/p/mvp4g
0 stars 0 forks source link

NullPointerException with mvp4g-1.3.0 snapshot (ClassSourceFileComposer) #71

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Trying to compile a project using mvp4g-1.3.0-SNAPSHOT,jar

What is the expected output? What do you see instead?

Expected is compilation success, what I get is:

               [ERROR] Generator 'com.mvp4g.util.Mvp4gGenerator' threw an exception while rebinding 'com.****.ui.module.ModuleThatFails'
java.lang.NullPointerException
    at com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:152)
    at com.mvp4g.util.Mvp4gConfigurationFileWriter.writeEventHistoryConvertion(Mvp4gConfigurationFileWriter.java:846)
    at com.mvp4g.util.Mvp4gConfigurationFileWriter.writeEventBus(Mvp4gConfigurationFileWriter.java:719)
    at com.mvp4g.util.Mvp4gConfigurationFileWriter.writeConf(Mvp4gConfigurationFileWriter.java:134)
    at com.mvp4g.util.Mvp4gGenerator.writeClass(Mvp4gGenerator.java:161)
    at com.mvp4g.util.Mvp4gGenerator.createClass(Mvp4gGenerator.java:96)
    at com.mvp4g.util.Mvp4gGenerator.generate(Mvp4gGenerator.java:77)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662)

What version of the product are you using? On what operating system?

Ubuntu Linux 9.04, mvp4g-1.3.0-SNAPSHOT,jar

Please provide any additional information below.

No errors in the project, also I use mvp4g-ADT and it is also doesn't say 
anything (no errors in annotations). It is the main module fails to compile. It 
is defined with:

@Events(startView = ***View.class, module = ModuleThatFails.class, ginModules = 
{ ***GinModule.class }, historyOnStart = true)
public interface MainEventBus extends EventBusWithLookup {

The source for this module is:

public interface ModuleThatFails extends Mvp4gModule {

}

Original issue reported on code.google.com by shaman.sir on 18 Feb 2011 at 9:21

GoogleCodeExporter commented 8 years ago
If I use mvp4g-1.3.0.jar from examples/MailWithMvp4g/lib for compilation, I get 
the error about JClassType mentioned in issue 70, but no NPE, though

Original comment by shaman.sir on 18 Feb 2011 at 9:27

GoogleCodeExporter commented 8 years ago
mvp-1.3.0-snapshot is from mvp4g-1.3.0-for-gwt-2-2-0.zip package from 
Downloads: 
http://code.google.com/p/mvp4g/downloads/detail?name=mvp4g-1.3.0-for-gwt-2-2-0.z
ip

Original comment by shaman.sir on 18 Feb 2011 at 9:29

GoogleCodeExporter commented 8 years ago
I have removed an event like this from MainEventBus:

    @Event(handlers = ****Presenter.class, historyConverter = ***Converter.class)
    public void dialogs();

the NPE from ModuleThatFails is gone (it is parent module with several child 
modules), but still fails in the same place 
(Mvp4gConfigurationFileWriter.writeEventHistoryConvertion(Mvp4gConfigurationFile
Writer.java:846)) for all of the child modules

Original comment by akote...@iparkcorp.com on 18 Feb 2011 at 10:37

GoogleCodeExporter commented 8 years ago
What is parentParam in Mvp4gConfigurationFileWriter.writeEventBus()? it seems 
it is null for the cases when historyConverter (and even historyConverterName) 
is specified for some event in any EventBus (child or parent, no matter)

Or I am specifying historyConverters incorrectly?

Original comment by shaman.sir on 18 Feb 2011 at 11:01

GoogleCodeExporter commented 8 years ago
All of our HistoryConverters and EventBuses both have the parent classes if it 
is the case. But when I remove a parent class from HistoryConverter, nothing 
changes, NPE stays for this eventBus.

Original comment by shaman.sir on 18 Feb 2011 at 11:08

GoogleCodeExporter commented 8 years ago
I looked at the code and there is an error for events with history converter 
and no parameter.

For now, the workaround would be either to add a fake parameter to the event or 
associate the event with an history converter which type is 
HistoryConverterType.NONE.

Original comment by plcoir...@gmail.com on 18 Feb 2011 at 1:34

GoogleCodeExporter commented 8 years ago
I'd better wait some time for fix :)

Original comment by shaman.sir on 18 Feb 2011 at 1:50

GoogleCodeExporter commented 8 years ago
I've fixed it with this:

Line 840, Mvp4gConfigurationFile.java:

...
        switch ( type ) {
        case DEFAULT:
            sourceWriter.print( historyConverterElement.getName() );
            sourceWriter.print( "." );
            sourceWriter.print( event.getCalledMethod() );
            sourceWriter.print( "(" );
            if (param != null) sourceWriter.print( param );
            sourceWriter.print( ")" );
            break;
        case SIMPLE:
            sourceWriter.print( historyConverterElement.getName() );
            sourceWriter.print( ".convertToToken(\"" );
            sourceWriter.print( event.getName() );
            if (param != null) {
                sourceWriter.print( "\"," );
                sourceWriter.print( param );                
            } else {
                sourceWriter.print( "\"" );
            }
            sourceWriter.print( ")" );
            break;
...

Original comment by akote...@iparkcorp.com on 21 Feb 2011 at 4:32

GoogleCodeExporter commented 8 years ago
Thanks, I brought your correction to mvp4g-1.3.0 & 1.3.1

Original comment by plcoir...@gmail.com on 7 Mar 2011 at 9:16