Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Bug in EndConnectionState.java

Jody,

thank you.

Here is another one:

ConnectionPageDecorator.java

The isPageComplete() method may be called before the setState method is
called and therefore the variable

page

is null.

so add
if(page==null){
    		  return false;
    	  }

would solve this problem

Whole method:


   @Override
    public boolean isPageComplete() {
    	  if(page==null){
    		  return false;
    	  }
          boolean complete = page.isPageComplete();
          if (complete && getState() instanceof EndConnectionState) {
              // set some context for the connection state
              EndConnectionState state = (EndConnectionState) getState();
              state.setServices(page.getServices());
              if (page instanceof AbstractUDIGImportPage) {
                  AbstractUDIGImportPage importPage =
(AbstractUDIGImportPage) page;
                  state.setSelectedResources(importPage.getResourceIDs());
              }
          }
        return complete;
    }


Regards,
Bastian Schäffer

Am 01.08.2010 05:20, schrieb Jody Garnett:
> I can make this change; now ... commit made as of -r31900
> 
> (This fix will of course not be in the 1.2-SNAPSHOT from a few days ago)
> 
> You may also want to get commit access for quick fixes such as this - we try and have an open project for just that reason.
> 
> Jody
> 
> On 31/07/2010, at 10:00 PM, Bastian Schäffer wrote:
> 
>> List,
>>
>> I noticed a bug in the EndConnectionState.java
>>
>> The variable
>>
>>  errors
>>
>>
>> is in some cases not initialized when the next() method is called.
>>
>> I would like to replace line 295
>>
>> if (errors.isEmpty()) {
>>
>> with
>>
>> if (errors != null && errors.isEmpty())
>>
>> to avoid NullPointerExceptions.
>>
>> Whole method:
>>
>> public State next() {
>>        // if errors occured, go a handling state, otherwise defer back
>> to pipe
>>        if ((getErrors() == null || getErrors().isEmpty()) && super. ==
>> null) {
>>            return null;
>>        } else {
>>            if (errors != null && errors.isEmpty()) {
>>                return new ConnectionErrorState(errors);
>>            } else {
>>                return nextState;
>>            }
>>
>>        }
>>
>>    }
>>
>>
>> @dev team: could you check that and perhaps modify the trunk?
>>
>> Regards,
>> Bastian Schäffer
>>
>>
>> -- 
>> Bastian Schäffer
>> Institute for Geoinformatics (IfGI), University of Muenster, Germany
>> Weseler Str. 253, 48151 Muenster
>> Fon: +49 (0)251 - 83-30046   Fax: +49 (0)251 - 83-39763
>> email: schaeffer@xxxxxxxxxxxxxxx
>> IfGI-site: http://ifgi.uni-muenster.de
>>
>>
>>
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
> 


-- 
Bastian Schäffer
Institute for Geoinformatics (IfGI), University of Muenster, Germany
Weseler Str. 253, 48151 Muenster
Fon: +49 (0)251 - 83-30046   Fax: +49 (0)251 - 83-39763
email: schaeffer@xxxxxxxxxxxxxxx
IfGI-site: http://ifgi.uni-muenster.de





Back to the top