[izpack-changes] izpack-src/src/lib/com/izforge/izpack/installer AutomatedInstaller.java,1.14,1.15 CompileWorker.java,1.14,1.15 GUIInstaller.java,1.36,1.37 InstallerBase.java,1.30,1.31 InstallerFrame.java,1.49,1.50 IzPanel.java,1.30,1.31 ProcessPanelWorker.java,1.13,1.14 Unpacker.java,1.50,1.51 WebAccessor.java,1.7,1.8

jponge nobody at sheep.berlios.de
Tue Mar 21 19:14:53 CET 2006


Update of /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer
In directory sheep:/tmp/cvs-serv3622/src/lib/com/izforge/izpack/installer

Modified Files:
	AutomatedInstaller.java CompileWorker.java GUIInstaller.java 
	InstallerBase.java InstallerFrame.java IzPanel.java 
	ProcessPanelWorker.java Unpacker.java WebAccessor.java 
Log Message:
Some fixes adviced by IntelliJ IDEA 5.1 code inspector.

Index: AutomatedInstaller.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- AutomatedInstaller.java	12 Mar 2006 16:32:24 -0000	1.14
+++ AutomatedInstaller.java	21 Mar 2006 18:14:45 -0000	1.15
@@ -246,7 +246,6 @@
                     System.err.println("ERROR: automated installation failed for panel "
                             + panelClassName);
                     e.printStackTrace();
-                    continue;
                 }
 
             }

Index: CompileWorker.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/CompileWorker.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- CompileWorker.java	12 Mar 2006 16:32:24 -0000	1.14
+++ CompileWorker.java	21 Mar 2006 18:14:45 -0000	1.15
@@ -67,9 +67,6 @@
 
     private VariableSubstitutor vs;
 
-    /** We spawn a thread to perform compilation. */
-    private Thread compilationThread;
-
     private XMLElement spec;
 
     private AutomatedInstallData idata;
@@ -102,7 +99,7 @@
         this.handler = handler;
         this.vs = new VariableSubstitutor(idata.getVariables());
 
-        this.compilationThread = null;
+        Thread compilationThread = null;
 
         if (!readSpec()) throw new IOException("Error reading compilation specification");
     }
@@ -168,9 +165,9 @@
     /** Start the compilation in a separate thread. */
     public void startThread()
     {
-        this.compilationThread = new Thread(this, "compilation thread");
+        Thread compilationThread = new Thread(this, "compilation thread");
         // will call this.run()
-        this.compilationThread.start();
+        compilationThread.start();
     }
 
     /**
@@ -387,16 +384,16 @@
         {
             XMLElement child = (XMLElement) toplevel_tags.nextElement();
 
-            if (child.getName().equals("classpath"))
+            if ("classpath".equals(child.getName()))
             {
                 changeClassPath(ourclasspath, child);
             }
-            else if (child.getName().equals("job"))
+            else if ("job".equals(child.getName()))
             {
                 CompilationJob subjob = collectJobsRecursive(child, ourclasspath);
                 if (subjob != null) this.jobs.add(subjob);
             }
-            else if (child.getName().equals("directory"))
+            else if ("directory".equals(child.getName()))
             {
                 String name = child.getAttribute("name");
 
@@ -409,7 +406,7 @@
                 }
 
             }
-            else if (child.getName().equals("file"))
+            else if ("file".equals(child.getName()))
             {
                 String name = child.getAttribute("name");
 
@@ -422,7 +419,7 @@
                 }
 
             }
-            else if (child.getName().equals("packdepency"))
+            else if ("packdepency".equals(child.getName()))
             {
                 String name = child.getAttribute("name");
 
@@ -622,7 +619,7 @@
             if (classpath_str.length() > 0)
             {
                 args.add("-classpath");
-                cmdline_len = cmdline_len + 11;
+                cmdline_len += 11;
                 args.add(classpath_str);
                 cmdline_len += classpath_str.length() + 1;
             }

Index: GUIInstaller.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/GUIInstaller.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- GUIInstaller.java	12 Mar 2006 16:32:24 -0000	1.36
+++ GUIInstaller.java	21 Mar 2006 18:14:45 -0000	1.37
@@ -286,17 +286,15 @@
         // Resolve whether button icons should be used or not.
         boolean useButtonIcons = true;
         if (installdata.guiPrefs.modifier.containsKey("useButtonIcons")
-                && ((String) installdata.guiPrefs.modifier.get("useButtonIcons"))
-                        .equalsIgnoreCase("no")) useButtonIcons = false;
+                && "no".equalsIgnoreCase((String) installdata.guiPrefs.modifier.get("useButtonIcons"))) useButtonIcons = false;
         ButtonFactory.useButtonIcons(useButtonIcons);
         boolean useLabelIcons = true;
         if (installdata.guiPrefs.modifier.containsKey("useLabelIcons")
-                && ((String) installdata.guiPrefs.modifier.get("useLabelIcons"))
-                        .equalsIgnoreCase("no")) useLabelIcons = false;
+                && "no".equalsIgnoreCase((String) installdata.guiPrefs.modifier.get("useLabelIcons"))) useLabelIcons = false;
         LabelFactory.setUseLabelIcons(useLabelIcons);
         if (laf == null)
         {
-            if (!syskey.equals("mac"))
+            if (!"mac".equals(syskey))
             {
                 String syslaf = UIManager.getSystemLookAndFeelClassName();
                 UIManager.setLookAndFeel(syslaf);
@@ -316,7 +314,7 @@
         }
 
         // Kunststoff (http://www.incors.org/)
-        if (laf.equals("kunststoff"))
+        if ("kunststoff".equals(laf))
         {
             ButtonFactory.useHighlightButtons();
             // Reset the use button icons state because useHighlightButtons
@@ -341,7 +339,7 @@
         }
 
         // Liquid (http://liquidlnf.sourceforge.net/)
-        if (laf.equals("liquid"))
+        if ("liquid".equals(laf))
         {
             UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
             lnf = "liquid";
@@ -350,7 +348,7 @@
             if (params.containsKey("decorate.frames"))
             {
                 String value = (String) params.get("decorate.frames");
-                if (value.equals("yes"))
+                if ("yes".equals(value))
                 {
                     JFrame.setDefaultLookAndFeelDecorated(true);
                 }
@@ -358,7 +356,7 @@
             if (params.containsKey("decorate.dialogs"))
             {
                 String value = (String) params.get("decorate.dialogs");
-                if (value.equals("yes"))
+                if ("yes".equals(value))
                 {
                     JDialog.setDefaultLookAndFeelDecorated(true);
                 }
@@ -368,7 +366,7 @@
         }
 
         // Metouia (http://mlf.sourceforge.net/)
-        if (laf.equals("metouia"))
+        if ("metouia".equals(laf))
         {
             UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel");
             lnf = "metouia";
@@ -376,7 +374,7 @@
         }
 
         // JGoodies Looks (http://looks.dev.java.net/)
-        if (laf.equals("looks"))
+        if ("looks".equals(laf))
         {
             Map variants = new TreeMap();
             variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel");
@@ -424,7 +422,7 @@
     protected boolean useFlags()
     {
         if (installdata.guiPrefs.modifier.containsKey("useFlags")
-                && ((String) installdata.guiPrefs.modifier.get("useFlags")).equalsIgnoreCase("no"))
+                && "no".equalsIgnoreCase((String) installdata.guiPrefs.modifier.get("useFlags")))
             return (false);
         return (true);
     }
@@ -466,9 +464,6 @@
         /** The combo box. */
         private JComboBox comboBox;
 
-        /** The ok button. */
-        private JButton okButton;
-
         /** The ISO3 to ISO2 HashMap */
         private HashMap iso3Toiso2 = null;
 
@@ -539,7 +534,7 @@
             layout.addLayoutComponent(comboBox, gbConstraints);
             contentPane.add(comboBox);
 
-            okButton = new JButton("OK");
+            JButton okButton = new JButton("OK");
             okButton.addActionListener(this);
             gbConstraints.fill = GridBagConstraints.NONE;
             gbConstraints.gridy = 4;

Index: InstallerBase.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/InstallerBase.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- InstallerBase.java	12 Mar 2006 16:32:24 -0000	1.30
+++ InstallerBase.java	21 Mar 2006 18:14:45 -0000	1.31
@@ -160,7 +160,7 @@
 				
 
         installdata.setVariable("APPLICATIONS_DEFAULT_ROOT", dir);
-        dir = dir + File.separator;
+        dir += File.separator;
         installdata.setVariable(ScriptParser.JAVA_HOME, System.getProperty("java.home"));
         installdata.setVariable(ScriptParser.CLASS_PATH, System.getProperty("java.class.path"));
         installdata.setVariable(ScriptParser.USER_HOME, System.getProperty("user.home"));

Index: InstallerFrame.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/InstallerFrame.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- InstallerFrame.java	12 Mar 2006 16:32:24 -0000	1.49
+++ InstallerFrame.java	21 Mar 2006 18:14:46 -0000	1.50
@@ -532,7 +532,7 @@
                 {
                     String key = (String) keys.next();
                     Object contents = additionalData.get(key);
-                    if (key.equals("__uninstallLibs__"))
+                    if ("__uninstallLibs__".equals(key))
                     {
                         Iterator nativeLibIter = ((List) contents).iterator();
                         while (nativeLibIter != null && nativeLibIter.hasNext())
@@ -552,7 +552,7 @@
                             outJar.closeEntry();
                         }
                     }
-                    else if (key.equals("uninstallerListeners") || key.equals("uninstallerJars"))
+                    else if ("uninstallerListeners".equals(key) || "uninstallerJars".equals(key))
                     { // It is a ArrayList of ArrayLists which contains the
                         // full
                         // package paths of all needed class files.
@@ -767,7 +767,7 @@
             f.delete();
         }
         String fullCleanup = installdata.getVariable("InstallerFrame.cleanAllAtInterrupt");
-        if (fullCleanup == null || !fullCleanup.equalsIgnoreCase("no"))
+        if (fullCleanup == null || !"no".equalsIgnoreCase(fullCleanup))
             cleanWipe(new File(installdata.getInstallPath()));
     }
 
@@ -824,8 +824,9 @@
      */
     public void setQuitButtonText(String text)
     {
-        if (text == null) text = langpack.getString("installer.quit");
-        quitButton.setText(text);
+        String text1 = text;
+        if (text1 == null) text1 = langpack.getString("installer.quit");
+        quitButton.setText(text1);
     }
 
     /*

Index: IzPanel.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/IzPanel.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- IzPanel.java	12 Mar 2006 16:32:24 -0000	1.30
+++ IzPanel.java	21 Mar 2006 18:14:46 -0000	1.31
@@ -718,7 +718,7 @@
         String todo = idata.getVariable("IzPanel.LayoutType");
         if (todo == null) // No command, no work.
             return;
-        if (todo.equals("BOTTOM"))
+        if ("BOTTOM".equals(todo))
         { // Make a header to push the rest to the bottom.
             Filler dummy = new Filler();
             GridBagConstraints gbConstraint = getNextYGridBagConstraints();
@@ -741,7 +741,7 @@
         String todo = idata.getVariable("IzPanel.LayoutType");
         if (todo == null) // No command, no work.
             return;
-        if (todo.equals("TOP"))
+        if ("TOP".equals(todo))
         { // Make a footer to push the rest to the top.
             Filler dummy = new Filler();
             GridBagConstraints gbConstraint = getNextYGridBagConstraints();

Index: ProcessPanelWorker.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ProcessPanelWorker.java	12 Mar 2006 16:32:25 -0000	1.13
+++ ProcessPanelWorker.java	21 Mar 2006 18:14:46 -0000	1.14
@@ -70,14 +70,10 @@
 
     private VariableSubstitutor vs;
 
-    private XMLElement spec;
-
     protected AbstractUIProcessHandler handler;
 
     private ArrayList jobs = new ArrayList();
 
-    private Thread processingThread = null;
-
     private static PrintWriter logfile = null;
 
     private String logfiledir = null;
@@ -120,11 +116,12 @@
         parser.setBuilder(new StdXMLBuilder());
         parser.setValidator(new NonValidator());
 
+        XMLElement spec;
         try
         {
             parser.setReader(new StdXMLReader(input));
 
-            this.spec = (XMLElement) parser.parse();
+            spec = (XMLElement) parser.parse();
         }
         catch (Exception e)
         {
@@ -133,7 +130,7 @@
             return false;
         }
 
-        if (!this.spec.hasChildren()) return false;
+        if (!spec.hasChildren()) return false;
 
         // Handle logfile
         XMLElement lfd = spec.getFirstChildNamed("logfiledir");
@@ -142,7 +139,7 @@
             logfiledir = lfd.getContent();
         }
 
-        for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();)
+        for (Iterator job_it = spec.getChildrenNamed("job").iterator(); job_it.hasNext();)
         {
             XMLElement job_el = (XMLElement) job_it.next();
 
@@ -298,9 +295,9 @@
     /** Start the compilation in a separate thread. */
     public void startThread()
     {
-        this.processingThread = new Thread(this, "processing thread");
+        Thread processingThread = new Thread(this, "processing thread");
         // will call this.run()
-        this.processingThread.start();
+        processingThread.start();
     }
 
     interface Processable
@@ -424,7 +421,7 @@
             catch (InterruptedException e)
             {}
 
-            if (t.isAlive() == false) return;
+            if (!t.isAlive()) return;
 
             t.interrupt();
             long hardTimeout = 500;

Index: Unpacker.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/Unpacker.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- Unpacker.java	12 Mar 2006 16:32:25 -0000	1.50
+++ Unpacker.java	21 Mar 2006 18:14:46 -0000	1.51
@@ -309,11 +309,11 @@
                 final Pack pack = ((Pack) packs.get(i));
                 String stepname = pack.name;// the message to be passed to the
                 // installpanel
-                if (langpack != null && !(pack.id == null || pack.id.equals("")))
+                if (langpack != null && !(pack.id == null || "".equals(pack.id)))
                 {
 
                     final String name = langpack.getString(pack.id);
-                    if (name != null && !name.equals(""))
+                    if (name != null && !"".equals(name))
                     {
                         stepname = name;
                     }
@@ -783,7 +783,7 @@
                     case '*': {
                         if (pos == element.length())
                         {
-                            element_re.append("[^" + File.separator + "]*");
+                            element_re.append("[^").append(File.separator).append("]*");
                             break;
                         }
 
@@ -798,7 +798,7 @@
                         }
                         else
                         {
-                            element_re.append("[^" + File.separator + "]*");
+                            element_re.append("[^").append(File.separator).append("]*");
                             // lookahead stays there
                         }
                         break;

Index: WebAccessor.java
===================================================================
RCS file: /cvsroot/izpack/izpack-src/src/lib/com/izforge/izpack/installer/WebAccessor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- WebAccessor.java	12 Mar 2006 16:32:25 -0000	1.7
+++ WebAccessor.java	21 Mar 2006 18:14:46 -0000	1.8
@@ -341,5 +341,5 @@
 
             return new PasswordAuthentication(nameField.getText(), passField.getPassword());
         }
-    };
+    }
 }




More information about the izpack-changes mailing list