From: <kp...@us...> - 2011-12-14 08:47:34
|
Revision: 20640 http://jedit.svn.sourceforge.net/jedit/?rev=20640&view=rev Author: kpouer Date: 2011-12-14 08:47:25 +0000 (Wed, 14 Dec 2011) Log Message: ----------- fixed a NPE when ant command is net set Modified Paths: -------------- plugins/AntFarm/trunk/antfarm/TargetRunner.java Modified: plugins/AntFarm/trunk/antfarm/TargetRunner.java =================================================================== --- plugins/AntFarm/trunk/antfarm/TargetRunner.java 2011-12-13 22:58:09 UTC (rev 20639) +++ plugins/AntFarm/trunk/antfarm/TargetRunner.java 2011-12-14 08:47:25 UTC (rev 20640) @@ -20,7 +20,6 @@ import java.io.File; import java.io.PrintStream; -import java.util.Enumeration; import java.util.Properties; import javax.swing.JOptionPane; @@ -54,7 +53,7 @@ DefaultLogger _buildLogger = new DefaultLogger(); - Throwable _error = null; + Throwable _error; Target _target; @@ -85,6 +84,7 @@ init(target, buildFile, view, output, userProperties); } + @Override public void run() { AntFarmPlugin.getErrorSource().clear(); @@ -173,7 +173,7 @@ command += "\""; command += _buildFile.getAbsolutePath(); command += "\""; - command += " " + _target.getName(); + command += ' ' + _target.getName(); runAntCommand(command); } cleanup(); @@ -193,14 +193,13 @@ _project.setUserProperty("ant.version", Main.getAntVersion()); // set user-define properties - Enumeration e = _userProperties.keys(); - while (e.hasMoreElements()) - { - String arg = (String) e.nextElement(); - String value = (String) _userProperties.get(arg); - value = ConsolePlugin.expandSystemShellVariables(_view, value); - _project.setUserProperty(arg, value); - } + for (Object o : _userProperties.keySet()) + { + String arg = (String) o; + String value = _userProperties.getProperty(arg); + value = ConsolePlugin.expandSystemShellVariables(_view, value); + _project.setUserProperty(arg, value); + } _project.setUserProperty("ant.file", _buildFile.getAbsolutePath()); } @@ -243,7 +242,7 @@ private void addGlobalProperties() { - String name = null; + String name; int counter = 1; while ((name = jEdit.getProperty(PropertiesOptionPane.PROPERTY + counter + PropertiesOptionPane.NAME)) != null) @@ -260,13 +259,12 @@ private void runAntCommand(String args) { String command = jEdit.getProperty(AntFarmPlugin.OPTION_PREFIX + "command"); - if (command == null || command.equals("")) + if (command == null || command.isEmpty()) Log.log(Log.WARNING, this, "Please set the path to the Ant script you wish to use."); - - if (command != null) + else { - command = "\"" + command + "\""; + command = '"' + command + '"'; command += AntFarmShell.getAntCommandFragment(_userProperties); if (jEdit.getBooleanProperty(AntFarmPlugin.OPTION_PREFIX + "output-emacs")) @@ -335,21 +333,20 @@ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); - if (yesOrNo == JOptionPane.YES_OPTION) - { - String scriptFilePath = AntFarmOptionPane.promptForAntScript(_view); - jEdit.setProperty(AntFarmPlugin.OPTION_PREFIX + "command", scriptFilePath); - jEdit.setBooleanProperty(AntFarmPlugin.OPTION_PREFIX + "use-same-jvm", - false); - jEdit.propertiesChanged(); - return scriptFilePath; - } - else if (yesOrNo == JOptionPane.NO_OPTION) - { - jEdit.setBooleanProperty( - AntFarmPlugin.OPTION_PREFIX + "use-same-jvm", true); - jEdit.propertiesChanged(); - } - return null; + if (yesOrNo == JOptionPane.YES_OPTION) + { + String scriptFilePath = AntFarmOptionPane.promptForAntScript(_view); + jEdit.setProperty(AntFarmPlugin.OPTION_PREFIX + "command", scriptFilePath); + jEdit.setBooleanProperty(AntFarmPlugin.OPTION_PREFIX + "use-same-jvm", false); + jEdit.propertiesChanged(); + return scriptFilePath; + } + if (yesOrNo == JOptionPane.NO_OPTION) + { + jEdit.setBooleanProperty( + AntFarmPlugin.OPTION_PREFIX + "use-same-jvm", true); + jEdit.propertiesChanged(); + } + return null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |