Commits

Anonymous committed e3e986d

Fix a few FindBugs issues.

Comments (0)

Files changed (16)

 OpenIDE-Module: org.netbeans.modules.android.core/2
 OpenIDE-Module-Layer: org/netbeans/modules/android/core/layer.xml
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/android/core/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.13
+OpenIDE-Module-Specification-Version: 1.14
 OpenIDE-Module-Java-Dependencies: Java > 1.6
 AutoUpdate-Show-In-Client: false
 

core/src/org/netbeans/modules/android/core/ddm/EmulatorControlSupport.java

 import com.android.ddmlib.EmulatorConsole;
 import com.android.ddmlib.EmulatorConsole.GsmMode;
 import com.android.ddmlib.IDevice;
+import com.google.common.base.Objects;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
 import org.openide.util.NbBundle;
   }
 
   private void processCommandResult(String result) {
-    if (EmulatorConsole.RESULT_OK == null && result == null ||
-        EmulatorConsole.RESULT_OK.equals(result)) {
+    if (Objects.equal(EmulatorConsole.RESULT_OK, result)) {
       return;
     }
     DialogDisplayer.getDefault().notify(

core/src/org/netbeans/modules/android/core/sdk/DalvikPlatform.java

 
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkManager;
+import com.google.common.base.Preconditions;
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
     private ClassPath sources;
     
     DalvikPlatform (SdkManager sdkManager, IAndroidTarget androidTarget) throws IOException {
+      Preconditions.checkNotNull(androidTarget);
       this.installFolder = FileUtil.toFileObject(new File(androidTarget.getLocation()));
 
       this.sdkManager = sdkManager;
       this.androidTarget = androidTarget;
 
-      this.bootLibs = 
-          androidTarget != null ? findAllLibraries(androidTarget) : findPlatformJar(installFolder);
+      this.bootLibs = findAllLibraries(androidTarget);
 
       LOG.log(Level.CONFIG, "DalvikPlatform created: install folder = {0}, installTarget = {1}, null = {2}",
           new Object[] { installFolder, androidTarget, null });

logcat/manifest.mf

 OpenIDE-Module-Layer: org/nyerel/nbandroid/logcat/layer.xml
 OpenIDE-Module-Localizing-Bundle: org/nyerel/nbandroid/logcat/Bundle.properties
 AutoUpdate-Show-In-Client: false
-OpenIDE-Module-Specification-Version: 1.6
+OpenIDE-Module-Specification-Version: 1.7
 OpenIDE-Module-Java-Dependencies: Java > 1.6
 

logcat/src/org/nyerel/nbandroid/logcat/LogFilterDialog.java

     // End of variables declaration//GEN-END:variables
 
     
-    class LogLevelListRenderer implements ListCellRenderer {
+    static class LogLevelListRenderer implements ListCellRenderer {
 
         @Override
         public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

project/manifest.mf

 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/android/project/Bundle.properties
 AutoUpdate-Show-In-Client: false
 OpenIDE-Module-Java-Dependencies: Java > 1.6
-OpenIDE-Module-Specification-Version: 1.25
+OpenIDE-Module-Specification-Version: 1.26
 

project/src/org/netbeans/modules/android/project/AndroidProjectUtil.java

       is = platformProvider.getInputStream();
       class MyErrorHandler implements ErrorHandler {
 
-        boolean ok = true;
-        
         @Override
         public void warning(SAXParseException ex) throws SAXException {
           LOG.log(Level.FINE, null, ex);
         @Override
         public void error(SAXParseException ex) throws SAXException {
           LOG.log(Level.INFO, null, ex);
-          ok = false;
         }
 
         @Override
         public void fatalError(SAXParseException ex) throws SAXException {
           LOG.log(Level.INFO, null, ex);
-          ok = false;
-        }
-        
-        boolean isOK() {
-          return ok;
         }
       }
       MyErrorHandler handler = new MyErrorHandler();

project/src/org/netbeans/modules/android/project/launch/ActivityLaunchAction.java

     }
     if (activity == null) {
       io.getOut().println("Launch activity not found.");
+      return false;
     }
     String command = "am start"
         + (launchInfo.debug ? " -D " : "")

project/src/org/netbeans/modules/android/project/launch/AndroidLauncherImpl.java

               /* Intended fall through */
               case 2:
                 msg = String.format(
-                    "Device not ready.",
+                    "Device not ready in {%1}.",
                     waitTime);
                 break;
               case 3:
                 msg = String.format(
-                    "New package not yet registered with the system.",
+                    "New package not yet registered with the system  in {%1}.",
                     waitTime);
                 break;
               default:
                 msg = String.format(
-                    "Device not ready (%2$d).",
+                    "Device not ready  in {%1} (%2$d).",
                     waitTime, type);
                 break;
 

project/src/org/netbeans/modules/android/project/ui/customizer/CustomizerProviderImpl.java

   }
     
   /** Listens to the actions on the Customizer's option buttons */
-  private class OptionListener extends WindowAdapter implements ActionListener {
+  private static class OptionListener extends WindowAdapter implements ActionListener {
 
     private final AndroidProject project;
     private final LaunchConfiguration launchConfig;

project/src/org/netbeans/modules/android/project/ui/wizards/ExportPackageAliasVisualPanel.java

 package org.netbeans.modules.android.project.ui.wizards;
 
 import com.google.common.base.Preconditions;
+import com.google.common.io.Closeables;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.security.KeyStore;
 
   @Override
   void read(WizardDescriptor settings) {
+    FileInputStream fis = null;
     try {
       exc = null;
       // get the alias list (also used as a keystore password test)
         String keystorePasswd = 
             (String) settings.getProperty(AndroidProjectProperties.PROP_KEY_STORE_PASSWD);
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        FileInputStream fis = new FileInputStream(keystore);
+        fis = new FileInputStream(keystore);
         keyStore.load(fis, keystorePasswd.toCharArray());
-        fis.close();
         
         aliases = keyStore.aliases();
       }
       onException(ex);
     } catch (IOException ex) {
       onException(ex);
+    } finally {
+      Closeables.closeQuietly(fis);
     }
   }
   

project/src/org/netbeans/modules/android/project/ui/wizards/ExportPackageWizardIterator.java

           JComponent jc = (JComponent) c;
           // Sets step number of a component
           // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
-          jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
+          jc.putClientProperty("WizardPanel_contentSelectedIndex", Integer.valueOf(i));
           // Sets steps names for a panel
           jc.putClientProperty("WizardPanel_contentData", steps);
           // Turn on subtitle creation on each step

project/src/org/netbeans/modules/android/project/ui/wizards/NewAndroidProjectWizardIterator.java

     resultSet.add(dir);
     handle.progress(NbBundle.getMessage(NewAndroidProjectWizardIterator.class,
         "LBL_NewAndroidProjectWizardIterator_WizardProgress_PreparingToOpen"), 4);
-    dirF = (dirF != null) ? dirF.getParentFile() : null;
+    dirF = dirF.getParentFile();
     if (dirF != null && dirF.exists()) {
       ProjectChooser.setProjectsFolder(dirF);
     }

project/src/org/netbeans/modules/android/project/ui/wizards/NewAndroidTestProjectWizardIterator.java

     resultSet.add(dir);
     handle.progress(NbBundle.getMessage(NewAndroidTestProjectWizardIterator.class,
         "LBL_NewAndroidProjectWizardIterator_WizardProgress_PreparingToOpen"), 4);
-    dirF = (dirF != null) ? dirF.getParentFile() : null;
+    dirF = dirF.getParentFile();
     if (dirF != null && dirF.exists()) {
       ProjectChooser.setProjectsFolder(dirF);
     }
 OpenIDE-Module-Layer: org/netbeans/modules/android/xml/resources/layer.xml
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/android/xml/resources/Bundle.properties
 OpenIDE-Module-Java-Dependencies: Java > 1.6
-OpenIDE-Module-Specification-Version: 1.4
+OpenIDE-Module-Specification-Version: 1.5
 

xml/src/org/netbeans/modules/android/xml/manifest/model/AndroidManifestModelFactory.java

     }
 
     public static AndroidManifestModelFactory getInstance() {
-        if (modelFactory == null) {
-            synchronized (instanceSyncPoint) {
-                AndroidManifestModelFactory _modelFactory = modelFactory;
-                if (_modelFactory == null) {
-                    modelFactory = new AndroidManifestModelFactory();
-                }
+        synchronized (instanceSyncPoint) {
+            AndroidManifestModelFactory _modelFactory = modelFactory;
+            if (_modelFactory == null) {
+                modelFactory = new AndroidManifestModelFactory();
             }
         }
         return modelFactory;
     }
 
+    @Override
     protected AndroidManifestModel createModel(ModelSource source) {
         return new AndroidManifestModel(source);
     }