[izpack-changes] r1925 - in izpack-src/trunk: . src/lib/com/coi/tools/os/win src/lib/com/izforge/izpack src/lib/com/izforge/izpack/compiler src/lib/com/izforge/izpack/gui src/lib/com/izforge/izpack/installer src/lib/com/izforge/izpack/io src/lib/com/izforge/izpack/panels src/lib/com/izforge/izpack/rules src/lib/com/izforge/izpack/uninstaller src/lib/com/izforge/izpack/util src/lib/com/izforge/izpack/util/os src/lib/com/izforge/izpack/util/os/unix

noreply at berlios.de noreply at berlios.de
Thu Nov 29 23:29:01 CET 2007


Author: jponge
Date: 2007-11-29 23:28:10 +0100 (Thu, 29 Nov 2007)
New Revision: 1925

Modified:
   izpack-src/trunk/IzPack-head.ipr
   izpack-src/trunk/src/lib/com/coi/tools/os/win/NativeLibException.java
   izpack-src/trunk/src/lib/com/izforge/izpack/Pack.java
   izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
   izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackInfo.java
   izpack-src/trunk/src/lib/com/izforge/izpack/compiler/Packager.java
   izpack-src/trunk/src/lib/com/izforge/izpack/gui/IzPanelLayout.java
   izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/GUIInstaller.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/LayoutHelper.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/UnpackerBase.java
   izpack-src/trunk/src/lib/com/izforge/izpack/io/FileSpanningInputStream.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/DataCheckPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/JDKPathPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/NextMediaFileFilter.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksModel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/UserInputPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
   izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/Destroyer.java
   izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerConsole.java
   izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/Log.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/LogError.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/LogMessage.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/LogWarning.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/os/WrappedNativeLibException.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/os/unix/ShellScript.java
Log:
Code cleanups assited by the IntelliJ IDEA code analyzer.


Modified: izpack-src/trunk/IzPack-head.ipr
===================================================================
--- izpack-src/trunk/IzPack-head.ipr	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/IzPack-head.ipr	2007-11-29 22:28:10 UTC (rev 1925)
@@ -264,6 +264,7 @@
   <component name="VcsDirectoryMappings">
     <mapping directory="" vcs="svn" />
   </component>
+  <component name="WebServicesPlugin" addRequiredLibraries="true" />
   <component name="com.intellij.jsf.UserDefinedFacesConfigs">
     <option name="USER_DEFINED_CONFIGS">
       <value>

Modified: izpack-src/trunk/src/lib/com/coi/tools/os/win/NativeLibException.java
===================================================================
--- izpack-src/trunk/src/lib/com/coi/tools/os/win/NativeLibException.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/coi/tools/os/win/NativeLibException.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -286,7 +286,6 @@
             }
             catch (MissingResourceException missingresourceexception)
             { // do not throw, else look in next bundle.
-                ;
             }
         }
         return (s);

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/Pack.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/Pack.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/Pack.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -64,7 +64,7 @@
      * is a string and serves are key identifying each group of mutually
      * exclusive packs.
      */
-    public String excludeGroup = new String();
+    public String excludeGroup = "";
 
     /** The group the pack is associated with. The pack group identifies
      * packs with common functionality to allow for grouping of packs in a

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -146,7 +146,7 @@
      */
     public CompilerConfig(String filename, String basedir, String kind, String output) throws CompilerException
     {
-        this(filename, basedir, kind, output, (PackagerListener) null);
+        this(filename, basedir, kind, output, null);
     }
     /**
      * The constructor.
@@ -175,7 +175,7 @@
     public CompilerConfig(String filename, String base, String kind, String output, String compr_format, 
             PackagerListener listener) throws CompilerException
     {
-        this(filename,base,kind,output, compr_format,listener, (String) null);
+        this(filename,base,kind,output, compr_format,listener, null);
     }
 
     /**
@@ -190,7 +190,7 @@
     public CompilerConfig(String basedir, String kind, String output, PackagerListener listener,
             String installText) throws CompilerException
     {
-        this((String) null, basedir, kind, output, "default", listener, installText);
+        this(null, basedir, kind, output, "default", listener, installText);
     }
     /**
      * 
@@ -2166,7 +2166,7 @@
                 // Calls the compiler
                 CmdlinePackagerListener listener = new CmdlinePackagerListener();
                 CompilerConfig compiler = new CompilerConfig(filename, base, kind, output, 
-                        compr_format, compr_level, listener, (String) null);
+                        compr_format, compr_level, listener, null);
                 compiler.executeCompiler();
 
                 // Waits

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackInfo.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackInfo.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackInfo.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -82,7 +82,7 @@
      */
     public PackInfo(String name, String id, String description, boolean required, boolean loose, String excludegroup, boolean uninstall)
     {
-        boolean ispreselected = (excludegroup == null) ? true : false;
+        boolean ispreselected = (excludegroup == null);
         pack = new Pack(name, id, description, null, null, required, ispreselected, loose, excludegroup, uninstall);
         colour = PackInfo.WHITE;
     }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/Packager.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/Packager.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/Packager.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -333,7 +333,7 @@
             if (packJarsSeparate) packStream.closeAlways();
 
             XMLElement child = new XMLElement("pack");
-            child.setAttribute("nbytes", new Long(pack.nbytes).toString());
+            child.setAttribute("nbytes", Long.toString(pack.nbytes));
             child.setAttribute("name", pack.name);
             if(pack.id != null) child.setAttribute("id", pack.id);
             root.addChild(child);

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/gui/IzPanelLayout.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/gui/IzPanelLayout.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/gui/IzPanelLayout.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -416,7 +416,7 @@
                                 .getView()).getLineWrap()) size.width = 1000;
                     }
                 }
-                ((JComponent) constraints.component).setPreferredSize(size);
+                constraints.component.setPreferredSize(size);
 
             }
             height += stretchPart;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -760,7 +760,7 @@
     private int topBuffer(int usedHeight, Container parent)
     {
         int amount = ((int) parent.getSize().getHeight()) - usedHeight;
-        amount = (int) (amount * topBuffer) / 100;
+        amount = amount * topBuffer / 100;
 
         return (amount);
     }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -411,7 +411,6 @@
                                 + panelClassName );
                         e.printStackTrace();
                         this.result = false;
-                        continue;
                     }
     
                 }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/GUIInstaller.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/GUIInstaller.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/GUIInstaller.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -442,7 +442,6 @@
             }
 
             UIManager.setLookAndFeel(variant);
-						return;
         }
     }
 

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -1530,7 +1530,6 @@
             if (!canShow(installdata.curPanelNumber))
             {
                 this.navigateNext(last);
-                return;
             }
             else
             {
@@ -1564,7 +1563,6 @@
             if (!canShow(installdata.curPanelNumber))
             {
                 this.navigatePrevious(last);
-                return;
             }
             else
             {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/IzPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -398,7 +398,7 @@
         else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL)
             jo_choices = JOptionPane.YES_NO_CANCEL_OPTION;
 
-        int user_choice = JOptionPane.showConfirmDialog(this, (Object) question, title, jo_choices,
+        int user_choice = JOptionPane.showConfirmDialog(this, question, title, jo_choices,
                 JOptionPane.QUESTION_MESSAGE);
 
         if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/LayoutHelper.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/LayoutHelper.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/LayoutHelper.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -200,7 +200,6 @@
         if (isGridBag())
         {
             completeGridBagLayout();
-            return;
         }
         // TODO: impl for IzPanelLayout
     }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -649,7 +649,7 @@
 
             for (int k = 0; k < packs.size(); k++)
             {
-                required = (String) ((XMLElement) packs.elementAt(k)).getAttribute("name", "");
+                required = ((XMLElement) packs.elementAt(k)).getAttribute("name", "");
                 // System.out.println ("Attribute name is " + required);
                 if (selected.equals(required))
                 {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -64,7 +64,7 @@
         uninstallableFilesList = new ArrayList();
         executablesList = new ArrayList();
         additionalData = new HashMap();
-        rootScript = new String();
+        rootScript = "";
     }
     
     /** Constant RootFiles = "rootfiles" */
@@ -202,7 +202,7 @@
      */
     public void addRootUninstallScript( String aRootUninstallScript )
     {    
-        rootScript = new String( aRootUninstallScript==null?"":aRootUninstallScript );
+        rootScript = aRootUninstallScript == null ? "" : aRootUninstallScript;
     }
     
     /**

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/UnpackerBase.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/UnpackerBase.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/UnpackerBase.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -509,7 +509,7 @@
             // element of custom action array.
             i = retval.length - 1; // Should be so, but safe is safe ...
             retval[i] = new ArrayList();
-            Iterator iter = ((List) retval[AutomatedInstallData.INSTALLER_LISTENER_INDEX])
+            Iterator iter = retval[AutomatedInstallData.INSTALLER_LISTENER_INDEX]
                     .iterator();
             while (iter.hasNext())
             {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/io/FileSpanningInputStream.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/io/FileSpanningInputStream.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/io/FileSpanningInputStream.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -112,16 +112,7 @@
                         break;
                     }
                 }
-                if (errorfound)
-                {
-                    // there was an error
-                    valid = false;
-                }
-                else
-                {
-                    // magic number is valid
-                    valid = true;
-                }
+                valid = !errorfound;
             }
         }
         return valid;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/DataCheckPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/DataCheckPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/DataCheckPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -102,8 +102,7 @@
 	public void panelActivate()
 	{
         printDebugInfo();
-		return;
-	}	
+    }
 	
     /**
      * Get and return the list of pack names.

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -202,7 +202,7 @@
     public void valueChanged(ListSelectionEvent e)
     {
         Debug.trace("valueChanged: " + e);
-        if (e.getValueIsAdjusting() == false)
+        if (!e.getValueIsAdjusting())
         {
             ListSelectionModel lsm = (ListSelectionModel) e.getSource();
             if( lsm.isSelectionEmpty()  )
@@ -287,7 +287,7 @@
             //back and forth between the group selection panel and the packs selection panel
             p.revDependencies = null;
 
-            if( data.packNames.contains(p.name) == false )
+            if(!data.packNames.contains(p.name))
             {
                 iter.remove();
                 Debug.trace("Removed AvailablePack: "+p.name);
@@ -317,7 +317,7 @@
         while( iter.hasNext() )
         {
             String dependent = (String) iter.next();
-            if( data.packNames.contains(dependent) == false )
+            if(!data.packNames.contains(dependent))
             {
                 Debug.trace("Need dependent: "+dependent);
                 Pack dependentPack = (Pack) packsByName.get(dependent);
@@ -377,10 +377,10 @@
             {
                 Pack p = (Pack) iter.next();
                 Set groups = p.installGroups;
-                if( groups.size() == 0 || groups.contains(data.name) == true )
+                if( groups.size() == 0 || groups.contains(data.name))
                 {
                     // The pack may have already been added while traversing dependencies
-                    if( data.packNames.contains(p.name) == false )
+                    if(!data.packNames.contains(p.name))
                         addDependents(p, packsByName, data);
                 }
             }
@@ -545,7 +545,7 @@
                 btn.setSelected(true);
                 Debug.trace("Selected button#"+count);
             }
-            else if ( selectedGroup < 0 && madeSelection == false )
+            else if ( selectedGroup < 0 && !madeSelection)
             {
                 if( defaultGroup != null )
                 {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/JDKPathPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/JDKPathPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/JDKPathPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -293,7 +293,7 @@
     }
     private boolean verifyVersion()
     {
-        return( verifyVersionEx() > 0 ? false : true );
+        return(verifyVersionEx() <= 0 );
     }
 
     private boolean compareVersions(String in, String template, boolean isMin,

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/NextMediaFileFilter.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/NextMediaFileFilter.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/NextMediaFileFilter.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -44,12 +44,7 @@
       return true;
     }
     String filepath = f.getAbsolutePath();
-    if (filepath.endsWith(this.volumename)) {
-      return true;
-    }
-    else {
-      return false;
-    }
+      return filepath.endsWith(this.volumename);
   }
 
   /* (non-Javadoc)

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksModel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksModel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksModel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -555,7 +555,7 @@
         for (int i = 0; i < packs.size(); i++)
         {
             Pack pack = (Pack) packs.get(i);
-            if (pack.required == true){
+            if (pack.required){
                 String packid = pack.id;
                 if (packid != null){
                     if (!(!this.rules.canInstallPack(packid, this.variables) && this.rules.canInstallPackOptional(packid, this.variables))){

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -521,7 +521,6 @@
             programGroup.setText(suggestedProgramGroup);
             shortcut.setUserType(itsUserType = Shortcut.CURRENT_USER);
 
-            return;
         }
 
         // ----------------------------------------------------
@@ -535,7 +534,6 @@
             programGroup.setText(suggestedProgramGroup);
             shortcut.setUserType(itsUserType = Shortcut.ALL_USERS);
 
-            return;
         }
 
         // ----------------------------------------------------
@@ -551,7 +549,6 @@
                groupList.getSelectionModel().clearSelection();
             programGroup.setText(suggestedProgramGroup);
 
-            return;
         }
 
         // ----------------------------------------------------
@@ -565,7 +562,6 @@
             // add the file to the uninstaller
             addToUninstaller();
 
-            return;
         }
         else if (eventSource.equals(createShortcuts))
         {
@@ -989,7 +985,7 @@
             data.TryExec = shortcutSpec.getAttribute(
                     SPEC_TRYEXEC, "");
 
-            data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
+            data.createForAll = Boolean.valueOf(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
 
             // ** EndOf LINUX **//
             // temp =
@@ -1326,7 +1322,7 @@
                         // save the shortcut
                         shortcut.save();
                         
-                        if(data.type == Shortcut.APPLICATIONS || data.addToGroup == true)
+                        if(data.type == Shortcut.APPLICATIONS || data.addToGroup)
                         {
                            if(shortcut instanceof com.izforge.izpack.util.os.Unix_Shortcut)
                            {
@@ -1376,7 +1372,6 @@
             }
             catch (Throwable exception)
             {
-                continue;
             }
         }
         if(OsVersion.IS_UNIX) writeXDGMenuFile(startMenuShortcuts,
@@ -1448,7 +1443,7 @@
 
             for (int k = 0; k < packs.size(); k++)
             {
-                required = (String) ((XMLElement) packs.elementAt(k)).getAttribute(
+                required = ((XMLElement) packs.elementAt(k)).getAttribute(
                         SPEC_ATTRIBUTE_NAME, "");
 
                 if (selected.equals(required)) { return (true); }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanelAutomationHelper.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -208,7 +208,7 @@
 
             data.TryExec = dataElement.getAttribute(ShortcutPanel.SPEC_TRYEXEC, "");
 
-            data.createForAll = new Boolean(dataElement.getAttribute(ShortcutPanel.CREATE_FOR_ALL,
+            data.createForAll = Boolean.valueOf(dataElement.getAttribute(ShortcutPanel.CREATE_FOR_ALL,
                     "false"));
             data.userType = Integer.valueOf(
                     dataElement.getAttribute(ShortcutPanel.USER_TYPE, Integer
@@ -316,7 +316,6 @@
             }
             catch (Throwable exception)
             {
-                continue;
             }
         }
 

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/UserInputPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/UserInputPanel.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/UserInputPanel.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -1431,7 +1431,7 @@
         }
         if ((variable == null) || (ruleField == null)) { return (true); }
 
-        boolean success = validating ? ruleField.validateContents() : true;
+        boolean success = !validating || ruleField.validateContents();
         if (!success)
         {
             String message = "";
@@ -2064,7 +2064,7 @@
         if ((variable == null) || (passwordGroupsRead.contains(group))) { return (true); }
         passwordGroups.add(group);
 
-        boolean success = validating ? group.validateContents() : true;
+        boolean success = !validating || group.validateContents();
 
         if (!success)
         {
@@ -2858,7 +2858,7 @@
 
             for (int k = 0; k < packs.size(); k++)
             {
-                required = (String) ((XMLElement) packs.elementAt(k)).getAttribute(NAME, "");
+                required = ((XMLElement) packs.elementAt(k)).getAttribute(NAME, "");
                 if (selected.equals(required)) { return (true); }
             }
         }
@@ -2907,7 +2907,7 @@
 
             for (int k = 0; k < packs.size(); k++)
             {
-                required = (String) ((XMLElement) packs.elementAt(k)).getAttribute(NAME, "");
+                required = ((XMLElement) packs.elementAt(k)).getAttribute(NAME, "");
                 if (selected.equals(required)) { return (false); }
             }
         }
@@ -3186,7 +3186,7 @@
             boolean found = false;
             for (int x = 0; x < this.pathComboBox.getItemCount(); x++)
             {
-                if (((String) this.pathComboBox.getItemAt(x)).equals(selected))
+                if (this.pathComboBox.getItemAt(x).equals(selected))
                 {
                     found = true;
                 }
@@ -3406,7 +3406,6 @@
             {
                 if (vname == null)
                 {
-                    continue;
                 }
                 else
                 {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -280,7 +280,7 @@
 
     public boolean isConditionTrue(String id, Properties variables)
     {
-        Condition cond = (Condition) getCondition(id);
+        Condition cond = getCondition(id);
         if (cond == null)
         {
             Debug.trace("Condition (" + id + ") not found.");
@@ -346,7 +346,7 @@
             return true;
         }
         Debug.trace("there is a condition");
-        Condition condition = (Condition) getCondition((String) this.panelconditions.get(panelid));
+        Condition condition = getCondition((String) this.panelconditions.get(panelid));
         if (condition != null) { return condition.isTrue(); }
         return false;
     }
@@ -369,7 +369,7 @@
             return true;
         }
         Debug.trace("there is a condition");
-        Condition condition = (Condition) getCondition((String) this.packconditions.get(packid));
+        Condition condition = getCondition((String) this.packconditions.get(packid));
         if (condition != null) { return condition.isTrue(); }
         return false;
     }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/Destroyer.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/Destroyer.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/Destroyer.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -219,7 +219,7 @@
      */
     private String getRootScript() throws Exception
     {
-        String result = new String();
+        String result = "";
         ObjectInputStream in = new ObjectInputStream(Destroyer.class.getResourceAsStream("/"
                 + UninstallData.ROOTSCRIPT));
         
@@ -238,7 +238,7 @@
     {
         if(!"".equals(aRootScript))
         {
-            Debug.log("Will Execute: " + aRootScript.toString());
+            Debug.log("Will Execute: " + aRootScript);
 
             try
             {

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerConsole.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerConsole.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerConsole.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -88,7 +88,7 @@
        private boolean askOKCancel(String question, int defaultchoice)
        {
           if(defaultchoice == AUTO_ANSWER_MODE) return true;
-          boolean defaultanswer = defaultchoice == 1 ? true : false;
+          boolean defaultanswer = defaultchoice == 1;
           try
           {
              System.out.print(question + " (Ok/Cancel) [" + (defaultanswer?"O":"C") + "]:");
@@ -104,7 +104,7 @@
        private int askYesNoCancel(String question, int defaultchoice)
        {
           if(defaultchoice == AUTO_ANSWER_MODE) return AbstractUIHandler.ANSWER_YES;
-          boolean defaultanswer = defaultchoice == 1 ? true : false;
+          boolean defaultanswer = defaultchoice == 1;
           try
           {
              System.out.print(question + " (Yes/No/Cancel) [" + (defaultanswer?"Y":"N") + "]:");
@@ -121,7 +121,7 @@
        private int askYesNo(String question, int defaultchoice)
        {
           if(defaultchoice == AUTO_ANSWER_MODE) return AbstractUIHandler.ANSWER_YES;
-          boolean defaultanswer = defaultchoice == 1 ? true : false;
+          boolean defaultanswer = defaultchoice == 1;
           try
           {
              System.out.print(question + " (Yes/No) [" + (defaultanswer?"Y":"N") + "]:");

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -459,7 +459,7 @@
             else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL)
                 jo_choices = JOptionPane.YES_NO_CANCEL_OPTION;
 
-            int user_choice = JOptionPane.showConfirmDialog(null, (Object) question, title,
+            int user_choice = JOptionPane.showConfirmDialog(null, question, title,
                     jo_choices, JOptionPane.QUESTION_MESSAGE);
 
             if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -123,7 +123,7 @@
 
             return execOut[0];
 
-        else if (forceToGetStdOut == true)
+        else if (forceToGetStdOut)
             return execOut[0];
         else
             return execOut[1];

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/Log.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/Log.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/Log.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -22,11 +22,7 @@
 
 package com.izforge.izpack.util;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Vector;
-import java.util.Hashtable;
-import java.util.Enumeration;
+import java.util.*;
 import java.text.MessageFormat;
 import java.io.File;
 import java.io.FileWriter;
@@ -236,10 +232,7 @@
             {
                 String[] channelList = temp.split(",");
 
-                for (int i = 0; i < channelList.length; i++)
-                {
-                    channels.add(channelList[i]);
-                }
+                channels.addAll(Arrays.asList(channelList));
             }
         }
     }
@@ -726,7 +719,7 @@
         {
             message
                     .append(installData.langpack.getString(MESSAGE_PREFIX
-                            + Integer.toString(record.message - LogMessage.MESSAGE_BASE),
+                            + Integer.toString(record.message),
                             record.variables));
         }
         else
@@ -858,7 +851,7 @@
         }
         else
         {
-            message.append("Debug - " + record.channel + ": ");
+            message.append("Debug - ").append(record.channel).append(": ");
         }
 
         message.append(MessageFormat.format(record.template, record.variables));

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/LogError.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/LogError.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/LogError.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -37,7 +37,7 @@
    *  <li>name of the file that could not be written
    *  </ol>
    *   */
-  public static final int COULD_NOT_WRITE_FILE = ERROR_BASE + 0;
+  public static final int COULD_NOT_WRITE_FILE = ERROR_BASE;
 
   /** The highest legal error message number is less than this value.  */
   static final int MAX_ERROR  = ERROR_BASE + 1;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/LogMessage.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/LogMessage.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/LogMessage.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -32,6 +32,6 @@
   static final int MESSAGE_BASE = 0;
 
   /** The highest legal error message number is less than this value.  */
-  static final int MAX_MESSAGE  = MESSAGE_BASE + 0;
+  static final int MAX_MESSAGE  = 0;
 }
 

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/LogWarning.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/LogWarning.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/LogWarning.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -32,6 +32,6 @@
   static final int WARNING_BASE = 1000;
 
   /** The highest legal error message number is less than this value.  */
-  static final int MAX_WARNING  = WARNING_BASE + 0;
+  static final int MAX_WARNING  = WARNING_BASE;
 }
 

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/os/WrappedNativeLibException.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/os/WrappedNativeLibException.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/os/WrappedNativeLibException.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -110,7 +110,7 @@
                     }
                     if (nle.getOsErr() != 0)
                     {
-                        String val = (String) langpack
+                        String val = langpack
                                 .get("NativeLibException.libInternal.OsErrNumPraefix")
                                 + Integer.toString(nle.getOsErr());
                         if (val == null) break;
@@ -120,7 +120,7 @@
                     }
                     if (nle.getOsMessage() != null)
                     {
-                        String val = (String) langpack
+                        String val = langpack
                                 .get("NativeLibException.libInternal.OsErrStringPraefix")
                                 + nle.getOsMessage();
                         if (val == null) break;

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/os/unix/ShellScript.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/os/unix/ShellScript.java	2007-11-29 20:49:05 UTC (rev 1924)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/os/unix/ShellScript.java	2007-11-29 22:28:10 UTC (rev 1925)
@@ -92,7 +92,7 @@
      */
     public ShellScript(String aShell)
     {
-        content.append("#!/usr/bin/env " + aShell);
+        content.append("#!/usr/bin/env ").append(aShell);
         content.append(header);
     }
 



More information about the izpack-changes mailing list