geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1478399 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui: internal/GeronimoServerWizardFragment.java sections/PortEditor.java sections/ServerEditorPortsSection.java
Date Thu, 02 May 2013 15:02:51 GMT
Author: gawor
Date: Thu May  2 15:02:51 2013
New Revision: 1478399

URL: http://svn.apache.org/r1478399
Log:
GERONIMODEVTOOLS-795: Minor update - try to avoid NumberFormatExceptions

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoServerWizardFragment.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/PortEditor.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorPortsSection.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoServerWizardFragment.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoServerWizardFragment.java?rev=1478399&r1=1478398&r2=1478399&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoServerWizardFragment.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoServerWizardFragment.java
Thu May  2 15:02:51 2013
@@ -136,7 +136,8 @@ public class GeronimoServerWizardFragmen
 
         @Override
         protected void setPortOffset(Text portOffset) {
-            getGeronimoServer().setPortOffset(Integer.parseInt(portOffset.getText()));
+            int value = toInt(portOffset.getText(), 0);
+            getGeronimoServer().setPortOffset(value);
         }
 
         @Override

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/PortEditor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/PortEditor.java?rev=1478399&r1=1478398&r2=1478399&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/PortEditor.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/PortEditor.java
Thu May  2 15:02:51 2013
@@ -146,4 +146,11 @@ public abstract class PortEditor {
         return gs;
     }
 
+    protected int toInt(String value, int defaultValue) {
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            return defaultValue;
+        }
+    }
 }   

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorPortsSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorPortsSection.java?rev=1478399&r1=1478398&r2=1478399&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorPortsSection.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorPortsSection.java
Thu May  2 15:02:51 2013
@@ -89,7 +89,7 @@ public class ServerEditorPortsSection ex
         
         @Override
         protected void setPortOffset(Text portOffset) {
-            int value = Integer.parseInt(portOffset.getText());
+            int value = toInt(portOffset.getText(), 0);
             execute(new TextSetPropertyCommand(server, "PortOffset", int.class, value, portOffset));
         }
 



Mime
View raw message