From 7ae21709bb6dbdc092052acb5098bfa5cb316d9e Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 29 Mar 2007 15:09:14 +0000
Subject: [PATCH] These refactorings are essential in anticipation of a new quicksetup application for the upgrader feature (issue 598).  These changes were reviewed by Josu. 

---
 opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java
index 9d46da2..9e9b706 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java
@@ -37,7 +37,8 @@
 import javax.jnlp.UnavailableServiceException;
 
 import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.installer.InstallException;
+import org.opends.quicksetup.QuickSetupException;
+import org.opends.quicksetup.webstart.JnlpProperties;
 import org.opends.quicksetup.util.Utils;
 
 /**
@@ -48,12 +49,11 @@
  * (quicksetup.jar) to display the Web Start installer dialog.  Then QuickSetup
  * will call this class and it will download the jar files.  Until this class is
  * not finished the WebStartInstaller will be on the
- * InstallProgressStep.DOWNLOADING step.
+ * ProgressStep.DOWNLOADING step.
  */
 public class WebStartDownloader implements DownloadServiceListener,
-    JnlpProperties
-{
-  private InstallException ex;
+        JnlpProperties {
+  private QuickSetupException ex;
 
   private boolean isFinished;
 
@@ -88,7 +88,7 @@
      * Upgrading a jar file.
      */
     UPGRADING
-    };
+    }
 
   /**
    * Starts the downloading of the jar files.  If forceDownload is set to
@@ -113,7 +113,8 @@
         {
           // This is a bug
           ex =
-              new InstallException(InstallException.Type.BUG, getExceptionMsg(
+              new QuickSetupException(QuickSetupException.Type.BUG,
+                      getExceptionMsg(
                   "bug-msg", mfe), mfe);
         } catch (IOException ioe)
         {
@@ -130,13 +131,14 @@
           String[] arg =
             { buf.toString() };
           ex =
-              new InstallException(InstallException.Type.DOWNLOAD_ERROR,
+              new QuickSetupException(QuickSetupException.Type.DOWNLOAD_ERROR,
                   getExceptionMsg("downloading-error", arg, ioe), ioe);
         } catch (Throwable t)
         {
           // This is a bug
           ex =
-              new InstallException(InstallException.Type.BUG, getExceptionMsg(
+              new QuickSetupException(QuickSetupException.Type.BUG,
+                      getExceptionMsg(
                   "bug-msg", t), t);
         }
       }
@@ -202,9 +204,9 @@
    * @throws IOException if a network problem occurs.
    */
   private void startDownload(boolean forceDownload)
-      throws MalformedURLException, IOException
+      throws IOException
   {
-    DownloadService ds = null;
+    DownloadService ds;
     try
     {
       ds =
@@ -308,12 +310,12 @@
   }
 
   /**
-   * Returns the InstallException that has occurred during the download or
+   * Returns the QuickSetupException that has occurred during the download or
    * <CODE>null</CODE> if no exception occurred.
-   * @return the InstallException that has occurred during the download or
+   * @return the QuickSetupException that has occurred during the download or
    * <CODE>null</CODE> if no exception occurred.
    */
-  public InstallException getException()
+  public QuickSetupException getException()
   {
     return ex;
   }
@@ -324,7 +326,7 @@
   public void downloadFailed(URL url, String version)
   {
     ex =
-        new InstallException(InstallException.Type.DOWNLOAD_ERROR, getMsg(
+        new QuickSetupException(QuickSetupException.Type.DOWNLOAD_ERROR, getMsg(
             "downloading-error", new String[]
               { url.toString() }), null);
   }
@@ -390,10 +392,8 @@
    */
   private int getPercentage(int currentJarRatio)
   {
-    int perc =
-        currentPercMin
+    return currentPercMin
             + (currentJarRatio * (currentPercMax - currentPercMin) / 100);
-    return perc;
   }
 
   /**

--
Gitblit v1.10.0