You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Ross Gardler (JIRA)" <ji...@apache.org> on 2005/08/01 16:21:36 UTC

[jira] Closed: (FOR-590) Enhance the Forrest Seed Project wizard with site configuration options

     [ http://issues.apache.org/jira/browse/FOR-590?page=all ]
     
Ross Gardler closed FOR-590:
----------------------------

    Fix Version: 0.8-dev
     Resolution: Fixed
      Assign To: Ross Gardler

This is not the solution I intended in my recomendation onlist. However, it is a better solution ;-)

I particularly like the fact that the same technique can easily be reused for different config files.

Excellent stuff!

> Enhance the Forrest Seed Project wizard with site configuration options
> -----------------------------------------------------------------------
>
>          Key: FOR-590
>          URL: http://issues.apache.org/jira/browse/FOR-590
>      Project: Forrest
>         Type: New Feature
>   Components: Tool: Eclipse config
>     Versions: 0.8-dev
>     Reporter: Anil Ramnanan
>     Assignee: Ross Gardler
>      Fix For: 0.8-dev
>  Attachments: org.apache.forrest.290705.zip, org.apache.forrest.310705.zip
>
> The new site configuration option needs to allow the user to set more configuration options for the site they are building.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Handling errors and logging in Java (was Re: [jira] Closed: (FOR-590) Enhance the Forrest Seed Project wizard with site configuration options)

Posted by Ross Gardler <rg...@apache.org>.
Anil Ramnanan wrote:
> Ross Gardler wrote:
> 

..

>>
>> it doesn't work. I get the extra page but the wizard does 
>> not complete when I click finish.
>>

...

> Does the wizard create the project but just does not close when you 
> click on finish or does it not do anything at all ?

The wizard behaves as I would expect, with the new config page being 
presented. When I click on the Finish button the progress dialog 
appears, does its stuff then disappears. The wizard dialog remains on 
screen, I have to press the cancel button to get rid of it.

The project is created, but no configs are setup as per the wizard 
selections.

I've done some debugging and find that there is an error being caused by 
the following code, from NewProjectWizard.performFinsih():


try {
   getContainer().run(false, true, op);
} catch (InvocationTargetException e) {
   return false; // TODO: should open error dialog and log
} catch (InterruptedException e) {
   return false; // canceled
}

The line getContainer.run(false, true, op); causes an 
InvocationTargetException if there are no plugins selected in the plugin 
page.

This can of error trapping is *very* bad practice. What the above code 
does is trap an error and allow the application to proceed as if nothing 
happened. There is not even a log of the error being generated to allow 
us to find out what happened.

At the very least the above code (and all code like it) should be:

try {
   getContainer().run(false, true, op);
} catch (InvocationTargetException e) {
   logger.error("Failed to correctly setup the project", e);
   return false; // FIXME: report this error to the user
} catch (InterruptedException e) {
   logger.debug("Project setup appears to have been cancelled", e);
   return false; // canceled
}

(I've added this to SVN)

Even this is not really because of the FIXME. However, it is a big 
improvement in that the FIXME will attract attention to the issue and we 
will now have a log entry for the problem which will mean we don't have 
to use the debugger to work out what is going on (a very inneficient 
process). Except...

The log4j system is not being correctly initialised (see warnings in the 
Console when the plugin is run). Therefore there is nowhere for the log 
messages to go :-(

I've added the necessary config code for log4j, now we have logging 
output to:

- forrestEclipse.log (in the workspace root)
- and port 4445 (I recomend installing the Ganymede plugin to make use 
of this, I find it the best way to read logs)

The config file for log4j is in conf/log4j.xml

---

Now using this new logging output you can see that the problem is:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out 
of range: -1
	at java.lang.String.substring(Unknown Source)
	at 
org.apache.forrest.eclipse.wizards.ActivatePluginsPage.getSelectedPlugins(ActivatePluginsPage.java:245)

I'll leave it to you to solve this problem - I'm going out for a meal.

Ross



Re: [jira] Closed: (FOR-590) Enhance the Forrest Seed Project wizard with site configuration options

Posted by Anil Ramnanan <li...@peppersauce.org>.
Ross Gardler wrote:

> Hmmm...
>
> Seems I made a mistake with the patches. I got confused because there 
> were too patch files in the second zip. I second said it was a reverse 
> patch, this usually happens when the changes have already been applied 
> (or when it really is a reverse patch of course). So I guessed that 
> the second patch had been included in the first.
>
> However, now it doesn't work. I get the extra page but the wizard does 
> not complete when I click finish.
>
I did a diff and the only difference I can see is the inclusion of the 
line import org.w3c.dom.Node;
I have the lastest update from SVN and it seems to work fine.

Does the wizard create the project but just does not close when you 
click on finish or does it not do anything at all ?

Anil


Re: [jira] Closed: (FOR-590) Enhance the Forrest Seed Project wizard with site configuration options

Posted by Ross Gardler <rg...@apache.org>.
Anil Ramnanan wrote:
> Ross Gardler (JIRA) wrote:
> 
>>     Ross Gardler closed FOR-590:
>> ----------------------------
>>
>>    Fix Version: 0.8-dev
>>     Resolution: Fixed
>>      Assign To: Ross Gardler
>>
>> This is not the solution I intended in my recomendation onlist. 
>> However, it is a better solution ;-)
>>
>> I particularly like the fact that the same technique can easily be 
>> reused for different config files.
>>
>> Excellent stuff!
>>
> Thanks. I took the time to do it this way to do it since we don't know 
> for sure what the other config files may be needed or what they would 
> have in them yet. This way, I can easly adapt the wizard for different 
> config files that we may use in the future. I would like to refine it 
> some more in the future so that I can dynamically build a wizard based 
> on a list of configuration files.


Hmmm...

Seems I made a mistake with the patches. I got confused because there 
were too patch files in the second zip. I second said it was a reverse 
patch, this usually happens when the changes have already been applied 
(or when it really is a reverse patch of course). So I guessed that the 
second patch had been included in the first.

However, now it doesn't work. I get the extra page but the wizard does 
not complete when I click finish.

Can you please do a diff between the affected files on your machine and 
those in SVN. perhaps you can tell me what I have done wrong and I'll 
fix it.

Thanks.

Ross

Re: [jira] Closed: (FOR-590) Enhance the Forrest Seed Project wizard with site configuration options

Posted by Anil Ramnanan <li...@peppersauce.org>.
Ross Gardler (JIRA) wrote:

>     
>Ross Gardler closed FOR-590:
>----------------------------
>
>    Fix Version: 0.8-dev
>     Resolution: Fixed
>      Assign To: Ross Gardler
>
>This is not the solution I intended in my recomendation onlist. However, it is a better solution ;-)
>
>I particularly like the fact that the same technique can easily be reused for different config files.
>
>Excellent stuff!
>
Thanks. I took the time to do it this way to do it since we don't know 
for sure what the other config files may be needed or what they would 
have in them yet. This way, I can easly adapt the wizard for different 
config files that we may use in the future. I would like to refine it 
some more in the future so that I can dynamically build a wizard based 
on a list of configuration files.

Regards,
Anil