geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B.J. Reed (JIRA)" <j...@apache.org>
Subject [jira] Commented: (GERONIMODEVTOOLS-342) Setting the JRE on the Edit Server Runtime panel usually fails
Date Thu, 08 May 2008 15:06:55 GMT

    [ https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595279#action_12595279
] 

B.J. Reed commented on GERONIMODEVTOOLS-342:
--------------------------------------------

Actaully, the braces would only be around the next line...so to improve the code, it should
be ...

public void widgetSelected(SelectionEvent e) {
                                           int sel = combo.getSelectionIndex();
                                           IVMInstall vmInstall = null;
                                           if (sel > 0) {
                                               vmInstall = (IVMInstall) installedJREs.get(sel
- 1);
                                           }
                                           getRuntimeDelegate().setVMInstall(vmInstall);
                                           validate();
                                       } 

I did some investigation about setting to null and took me a whiile last night to track down
what's really happening here.

Basically, there is an assumption that the default JRE will always be the first item listed
in the combo box.  I believe that this is a good assumption based on the way that the combo
is filled.  The rest of the items in the combo come from an array of VM Installs so that combo
1 refers to array item 0 and combo 2 refers to array item 1 (hence the -1 which threw me for
a long time).  By passing a null into the setVMInstall, the code is essentially saying "don't
use the array list, the user specified the default VM" (which isn't in the array list)

I do think that adding the {  } to the if statement is a good idea and may reduce some further
confusion.

> Setting the JRE on the Edit Server Runtime panel usually fails
> --------------------------------------------------------------
>
>                 Key: GERONIMODEVTOOLS-342
>                 URL: https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-342
>             Project: Geronimo-Devtools
>          Issue Type: Bug
>          Components: eclipse-plugin
>    Affects Versions: 2.1.0
>            Reporter: Ted Kirby
>            Assignee: B.J. Reed
>            Priority: Minor
>             Fix For: 2.1.1
>
>         Attachments: GERONIMODEVTOOLS-342.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message