From 15ac490af13f5ac022ce9bd05e4a25bc2094b194 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 15 Nov 2013 08:19:59 -0500 Subject: [PATCH] Now that we use Java 6, can finally deprecate IOException2. --- .../java/hudson/ClassicPluginStrategy.java | 15 ++++--- core/src/main/java/hudson/FilePath.java | 41 +++++++++---------- core/src/main/java/hudson/PluginManager.java | 7 ++-- core/src/main/java/hudson/Proc.java | 3 +- core/src/main/java/hudson/Util.java | 3 +- core/src/main/java/hudson/XmlFile.java | 17 ++++---- core/src/main/java/hudson/cli/CLIAction.java | 3 +- .../main/java/hudson/cli/CliProtocol2.java | 3 +- .../java/hudson/cli/InstallPluginCommand.java | 4 +- .../hudson/console/AnnotatedLargeText.java | 5 +-- .../main/java/hudson/console/ConsoleNote.java | 3 +- .../main/java/hudson/model/AbstractBuild.java | 2 +- .../main/java/hudson/model/AbstractItem.java | 3 +- core/src/main/java/hudson/model/Api.java | 3 +- .../hudson/model/DirectoryBrowserSupport.java | 3 +- .../java/hudson/model/DownloadService.java | 3 +- core/src/main/java/hudson/model/Run.java | 4 +- .../main/java/hudson/model/UpdateCenter.java | 9 ++-- core/src/main/java/hudson/model/View.java | 15 ++++--- .../node_monitors/ResponseTimeMonitor.java | 7 ---- .../os/windows/WindowsRemoteLauncher.java | 7 ++-- .../java/hudson/slaves/SlaveComputer.java | 4 +- .../main/java/hudson/tasks/Fingerprinter.java | 5 +-- .../java/hudson/tasks/junit/SuiteResult.java | 9 +--- .../java/hudson/tasks/junit/TestResult.java | 7 ++-- .../java/hudson/util/AtomicFileWriter.java | 2 +- .../main/java/hudson/util/IOException2.java | 12 ++---- .../java/hudson/util/RemotingDiagnostics.java | 2 +- .../util/io/ReopenableFileOutputStream.java | 4 +- .../main/java/hudson/util/io/TarArchiver.java | 3 +- .../main/java/hudson/util/ssh/SFTPClient.java | 3 +- .../hudson/widgets/RenderOnDemandClosure.java | 3 +- .../security/DefaultConfidentialStore.java | 5 +-- .../slaves/JnlpSlaveAgentProtocol2.java | 5 +-- .../META-INF/upgrade/IOException2.hint | 2 + core/src/test/java/hudson/FilePathTest.java | 5 +-- .../test/TemporaryDirectoryAllocator.java | 5 +-- 37 files changed, 92 insertions(+), 144 deletions(-) create mode 100644 core/src/main/resources/META-INF/upgrade/IOException2.hint diff --git a/core/src/main/java/hudson/ClassicPluginStrategy.java b/core/src/main/java/hudson/ClassicPluginStrategy.java index 481fa46871..2c5f92de39 100644 --- a/core/src/main/java/hudson/ClassicPluginStrategy.java +++ b/core/src/main/java/hudson/ClassicPluginStrategy.java @@ -29,7 +29,6 @@ import hudson.PluginWrapper.Dependency; import hudson.model.Hudson; import hudson.util.CyclicGraphDetector; import hudson.util.CyclicGraphDetector.CycleDetectedException; -import hudson.util.IOException2; import hudson.util.IOUtils; import hudson.util.MaskingClassLoader; import hudson.util.VersionNumber; @@ -117,7 +116,7 @@ public class ClassicPluginStrategy implements PluginStrategy { try { manifest = new Manifest(in); } catch (IOException e) { - throw new IOException2("Failed to load " + archive, e); + throw new IOException("Failed to load " + archive, e); } finally { in.close(); } @@ -350,13 +349,13 @@ public class ClassicPluginStrategy implements PluginStrategy { } wrapper.setPlugin((Plugin) o); } catch (LinkageError e) { - throw new IOException2("Unable to load " + className + " from " + wrapper.getShortName(),e); + throw new IOException("Unable to load " + className + " from " + wrapper.getShortName(),e); } catch (ClassNotFoundException e) { - throw new IOException2("Unable to load " + className + " from " + wrapper.getShortName(),e); + throw new IOException("Unable to load " + className + " from " + wrapper.getShortName(),e); } catch (IllegalAccessException e) { - throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e); + throw new IOException("Unable to create instance of " + className + " from " + wrapper.getShortName(),e); } catch (InstantiationException e) { - throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e); + throw new IOException("Unable to create instance of " + className + " from " + wrapper.getShortName(),e); } } @@ -367,7 +366,7 @@ public class ClassicPluginStrategy implements PluginStrategy { startPlugin(wrapper); } catch(Throwable t) { // gracefully handle any error in plugin. - throw new IOException2("Failed to initialize",t); + throw new IOException("Failed to initialize",t); } } finally { Thread.currentThread().setContextClassLoader(old); @@ -427,7 +426,7 @@ public class ClassicPluginStrategy implements PluginStrategy { unzipExceptClasses(archive, destDir, prj); createClassJarFromWebInfClasses(archive, destDir, prj); } catch (BuildException x) { - throw new IOException2("Failed to expand " + archive,x); + throw new IOException("Failed to expand " + archive,x); } try { diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index b2564edc70..df548f5583 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -43,7 +43,6 @@ import hudson.remoting.RemoteInputStream; import hudson.remoting.Which; import hudson.security.AccessControlled; import hudson.util.DirScanner; -import hudson.util.IOException2; import hudson.util.HeadBufferingStream; import hudson.util.FormValidation; import hudson.util.IOUtils; @@ -95,14 +94,12 @@ import java.util.concurrent.TimeoutException; import com.jcraft.jzlib.GZIPInputStream; import com.jcraft.jzlib.GZIPOutputStream; -import com.sun.jna.Native; import hudson.os.PosixException; import hudson.util.FileVisitor; import java.util.Enumeration; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; -import org.apache.tools.ant.taskdefs.Chmod; import org.apache.tools.zip.ZipFile; import org.apache.tools.zip.ZipEntry; @@ -636,7 +633,7 @@ public final class FilePath implements Serializable { } catch (IOException e) { // various people reported "java.io.IOException: Not in GZIP format" here, so diagnose this problem better in.fillSide(); - throw new IOException2(e.getMessage()+"\nstream="+Util.toHexString(in.getSideBuffer()),e); + throw new IOException(e.getMessage()+"\nstream="+Util.toHexString(in.getSideBuffer()),e); } } public OutputStream compress(OutputStream out) throws IOException { @@ -760,13 +757,13 @@ public final class FilePath implements Serializable { else untarFrom(cis,GZIP); } catch (IOException e) { - throw new IOException2(String.format("Failed to unpack %s (%d bytes read of total %d)", + throw new IOException(String.format("Failed to unpack %s (%d bytes read of total %d)", archive,cis.getByteCount(),con.getContentLength()),e); } timestamp.touch(sourceTimestamp); return true; } catch (IOException e) { - throw new IOException2("Failed to install "+archive+" to "+remote,e); + throw new IOException("Failed to install "+archive+" to "+remote,e); } } @@ -786,7 +783,7 @@ public final class FilePath implements Serializable { readFromTar("input stream", dir, GZIP.extract(cis)); } } catch (IOException x) { - throw new IOException2(String.format("Failed to unpack %s (%d bytes read)", archive, cis.getByteCount()), x); + throw new IOException(String.format("Failed to unpack %s (%d bytes read)", archive, cis.getByteCount()), x); } } finally { in.close(); @@ -843,7 +840,7 @@ public final class FilePath implements Serializable { } catch (IOException e) { throw e; } catch (Exception e) { - throw new IOException2(e); + throw new IOException(e); } } else { InputStream i = file.getInputStream(); @@ -910,7 +907,7 @@ public final class FilePath implements Serializable { throw e; // pass through so that the caller can catch it as AbortException } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. - throw new IOException2("remote file operation failed: "+remote+" at "+channel,e); + throw new IOException("remote file operation failed: "+remote+" at "+channel,e); } } else { // the file is on the local machine. @@ -992,7 +989,7 @@ public final class FilePath implements Serializable { .callAsync(wrapper); } catch (IOException e) { // wrap it into a new IOException so that we get the caller's stack trace as well. - throw new IOException2("remote file operation failed",e); + throw new IOException("remote file operation failed",e); } } @@ -1191,7 +1188,7 @@ public final class FilePath implements Serializable { } })); } catch (IOException e) { - throw new IOException2("Failed to create a temp file on "+remote,e); + throw new IOException("Failed to create a temp file on "+remote,e); } } @@ -1251,7 +1248,7 @@ public final class FilePath implements Serializable { try { f = File.createTempFile(prefix, suffix, dir); } catch (IOException e) { - throw new IOException2("Failed to create a temporary directory in "+dir,e); + throw new IOException("Failed to create a temporary directory in "+dir,e); } Writer w = new FileWriter(f); @@ -1265,7 +1262,7 @@ public final class FilePath implements Serializable { } })); } catch (IOException e) { - throw new IOException2("Failed to create a temp file on "+remote,e); + throw new IOException("Failed to create a temp file on "+remote,e); } } @@ -1295,7 +1292,7 @@ public final class FilePath implements Serializable { } })); } catch (IOException e) { - throw new IOException2("Failed to create a temp directory on "+remote,e); + throw new IOException("Failed to create a temp directory on "+remote,e); } } @@ -1749,7 +1746,7 @@ public final class FilePath implements Serializable { out.close(); } } catch (IOException e) { - throw new IOException2("Failed to copy "+this+" to "+target,e); + throw new IOException("Failed to copy "+this+" to "+target,e); } } @@ -1944,7 +1941,7 @@ public final class FilePath implements Serializable { future.get(); return future2.get(); } catch (ExecutionException e) { - throw new IOException2(e); + throw new IOException(e); } } else { // remote -> local copy @@ -1968,7 +1965,7 @@ public final class FilePath implements Serializable { throw e; // the remote side completed successfully, so the error must be local } catch (ExecutionException x) { // report both errors - throw new IOException2(Functions.printThrowable(e),x); + throw new IOException(Functions.printThrowable(e),x); } catch (TimeoutException _) { // remote is hanging throw e; @@ -1977,7 +1974,7 @@ public final class FilePath implements Serializable { try { return future.get(); } catch (ExecutionException e) { - throw new IOException2(e); + throw new IOException(e); } } } @@ -2049,12 +2046,12 @@ public final class FilePath implements Serializable { } } } catch(IOException e) { - throw new IOException2("Failed to extract "+name,e); + throw new IOException("Failed to extract "+name,e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // process this later - throw new IOException2("Failed to extract "+name,e); + throw new IOException("Failed to extract "+name,e); } catch (IllegalAccessException e) { - throw new IOException2("Failed to extract "+name,e); + throw new IOException("Failed to extract "+name,e); } finally { t.close(); } @@ -2438,7 +2435,7 @@ public final class FilePath implements Serializable { /** * Used to tunnel {@link InterruptedException} over a Java signature that only allows {@link IOException} */ - private static class TunneledInterruptedException extends IOException2 { + private static class TunneledInterruptedException extends IOException { private TunneledInterruptedException(InterruptedException cause) { super(cause); } diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index 7ce9dea6d3..dc657a9a0b 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -40,7 +40,6 @@ import hudson.security.Permission; import hudson.security.PermissionScope; import hudson.util.CyclicGraphDetector; import hudson.util.CyclicGraphDetector.CycleDetectedException; -import hudson.util.IOException2; import hudson.util.PersistedList; import hudson.util.Service; import hudson.util.VersionNumber; @@ -435,7 +434,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas failedPlugins.add(new FailedPlugin(sn, e)); activePlugins.remove(p); plugins.remove(p); - throw new IOException2("Failed to install "+ sn +" plugin",e); + throw new IOException("Failed to install "+ sn +" plugin",e); } // run initializers in the added plugin @@ -449,7 +448,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas try { new InitReactorRunner().run(r); } catch (ReactorException e) { - throw new IOException2("Failed to initialize "+ sn +" plugin",e); + throw new IOException("Failed to initialize "+ sn +" plugin",e); } LOGGER.info("Plugin " + sn + " dynamically installed"); } @@ -925,7 +924,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas } }); } catch (SAXException x) { - throw new IOException2("Failed to parse XML",x); + throw new IOException("Failed to parse XML",x); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible since we don't tweak XMLParser } diff --git a/core/src/main/java/hudson/Proc.java b/core/src/main/java/hudson/Proc.java index ca1f4a6767..b80d814458 100644 --- a/core/src/main/java/hudson/Proc.java +++ b/core/src/main/java/hudson/Proc.java @@ -28,7 +28,6 @@ import hudson.model.TaskListener; import hudson.remoting.Channel; import hudson.util.DaemonThreadFactory; import hudson.util.ExceptionCatchingThreadFactory; -import hudson.util.IOException2; import hudson.util.NullStream; import hudson.util.StreamCopyThread; import hudson.util.ProcessTree; @@ -454,7 +453,7 @@ public abstract class Proc { } catch (ExecutionException e) { if(e.getCause() instanceof IOException) throw (IOException)e.getCause(); - throw new IOException2("Failed to join the process",e); + throw new IOException("Failed to join the process",e); } catch (CancellationException x) { return -1; } diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index ad91672dc6..893cd6cb23 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -30,7 +30,6 @@ import edu.umd.cs.findbugs.annotations.SuppressWarnings; import hudson.Proc.LocalProc; import hudson.model.TaskListener; import hudson.os.PosixAPI; -import hudson.util.IOException2; import hudson.util.QuotedStringTokenizer; import hudson.util.VariableResolver; import hudson.util.jna.WinIOException; @@ -569,7 +568,7 @@ public class Util { } return toHexString(md5.digest()); } catch (NoSuchAlgorithmException e) { - throw new IOException2("MD5 not installed",e); // impossible + throw new IOException("MD5 not installed",e); // impossible } /* JENKINS-18178: confuses Maven 2 runner try { diff --git a/core/src/main/java/hudson/XmlFile.java b/core/src/main/java/hudson/XmlFile.java index 18a95412db..148578c469 100644 --- a/core/src/main/java/hudson/XmlFile.java +++ b/core/src/main/java/hudson/XmlFile.java @@ -32,7 +32,6 @@ import com.thoughtworks.xstream.io.xml.XppDriver; import hudson.diagnosis.OldDataMonitor; import hudson.model.Descriptor; import hudson.util.AtomicFileWriter; -import hudson.util.IOException2; import hudson.util.XStream2; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -142,11 +141,11 @@ public final class XmlFile { try { return xs.fromXML(in); } catch(StreamException e) { - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } catch(ConversionException e) { - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } catch(Error e) {// mostly reflection errors - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } finally { in.close(); } @@ -165,11 +164,11 @@ public final class XmlFile { // TODO: expose XStream the driver from XStream return xs.unmarshal(DEFAULT_DRIVER.createReader(in), o); } catch (StreamException e) { - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } catch(ConversionException e) { - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } catch(Error e) {// mostly reflection errors - throw new IOException2("Unable to read "+file,e); + throw new IOException("Unable to read "+file,e); } finally { in.close(); } @@ -183,7 +182,7 @@ public final class XmlFile { xs.toXML(o,w); w.commit(); } catch(StreamException e) { - throw new IOException2(e); + throw new IOException(e); } finally { w.abort(); } @@ -294,7 +293,7 @@ public final class XmlFile { // in such a case, assume UTF-8 rather than fail, since Jenkins internally always write XML in UTF-8 return "UTF-8"; } catch (SAXException e) { - throw new IOException2("Failed to detect encoding of "+file,e); + throw new IOException("Failed to detect encoding of "+file,e); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible } finally { diff --git a/core/src/main/java/hudson/cli/CLIAction.java b/core/src/main/java/hudson/cli/CLIAction.java index dd5327f0cf..3253fc2840 100644 --- a/core/src/main/java/hudson/cli/CLIAction.java +++ b/core/src/main/java/hudson/cli/CLIAction.java @@ -31,7 +31,6 @@ import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; -import hudson.util.IOException2; import hudson.model.UnprotectedRootAction; import jenkins.model.Jenkins; @@ -130,7 +129,7 @@ public class CLIAction implements UnprotectedRootAction, StaplerProxy { duplexChannels.get(uuid).upload(req,rsp); } } catch (InterruptedException e) { - throw new IOException2(e); + throw new IOException(e); } } } diff --git a/core/src/main/java/hudson/cli/CliProtocol2.java b/core/src/main/java/hudson/cli/CliProtocol2.java index f1cea1add3..bd3af1ee64 100644 --- a/core/src/main/java/hudson/cli/CliProtocol2.java +++ b/core/src/main/java/hudson/cli/CliProtocol2.java @@ -1,7 +1,6 @@ package hudson.cli; import hudson.Extension; -import hudson.util.IOException2; import jenkins.model.Jenkins; import javax.crypto.SecretKey; @@ -72,7 +71,7 @@ public class CliProtocol2 extends CliProtocol { runCli(c); } catch (GeneralSecurityException e) { - throw new IOException2("Failed to encrypt the CLI channel",e); + throw new IOException("Failed to encrypt the CLI channel",e); } } } diff --git a/core/src/main/java/hudson/cli/InstallPluginCommand.java b/core/src/main/java/hudson/cli/InstallPluginCommand.java index 38c04b3996..1fd23d81ac 100644 --- a/core/src/main/java/hudson/cli/InstallPluginCommand.java +++ b/core/src/main/java/hudson/cli/InstallPluginCommand.java @@ -26,7 +26,6 @@ package hudson.cli; import hudson.Extension; import hudson.FilePath; import hudson.PluginManager; -import hudson.util.IOException2; import jenkins.model.Jenkins; import hudson.model.UpdateSite; import hudson.model.UpdateSite.Data; @@ -35,6 +34,7 @@ import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Option; import java.io.File; +import java.io.IOException; import java.net.URL; import java.net.MalformedURLException; import java.util.HashSet; @@ -114,7 +114,7 @@ public class InstallPluginCommand extends CLICommand { stdout.println(Messages.InstallPluginCommand_InstallingFromUpdateCenter(source)); Throwable e = p.deploy(dynamicLoad).get().getError(); if (e!=null) - throw new IOException2("Failed to install plugin "+source,e); + throw new IOException("Failed to install plugin "+source,e); continue; } diff --git a/core/src/main/java/hudson/console/AnnotatedLargeText.java b/core/src/main/java/hudson/console/AnnotatedLargeText.java index 298e034bf1..4a3af765bd 100644 --- a/core/src/main/java/hudson/console/AnnotatedLargeText.java +++ b/core/src/main/java/hudson/console/AnnotatedLargeText.java @@ -28,8 +28,6 @@ package hudson.console; import com.trilead.ssh2.crypto.Base64; import jenkins.model.Jenkins; import hudson.remoting.ObjectInputStreamEx; -import hudson.util.IOException2; -import hudson.util.Secret; import hudson.util.TimeUnit2; import jenkins.security.CryptoConfidentialKey; import org.apache.commons.io.output.ByteArrayOutputStream; @@ -50,7 +48,6 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Writer; import java.nio.charset.Charset; -import java.security.GeneralSecurityException; import com.jcraft.jzlib.GZIPInputStream; import com.jcraft.jzlib.GZIPOutputStream; @@ -134,7 +131,7 @@ public class AnnotatedLargeText extends LargeText { } } } catch (ClassNotFoundException e) { - throw new IOException2(e); + throw new IOException(e); } // start from scratch return ConsoleAnnotator.initial(context==null ? null : context.getClass()); diff --git a/core/src/main/java/hudson/console/ConsoleNote.java b/core/src/main/java/hudson/console/ConsoleNote.java index c8ea004643..e4402c1330 100644 --- a/core/src/main/java/hudson/console/ConsoleNote.java +++ b/core/src/main/java/hudson/console/ConsoleNote.java @@ -30,7 +30,6 @@ import hudson.model.Describable; import jenkins.model.Jenkins; import hudson.model.Run; import hudson.remoting.ObjectInputStreamEx; -import hudson.util.IOException2; import hudson.util.IOUtils; import hudson.util.UnbufferedBase64InputStream; import org.apache.commons.codec.binary.Base64OutputStream; @@ -228,7 +227,7 @@ public abstract class ConsoleNote implements Serializable, Describable,R extends Abs try { l.onChangeLogParsed(build,listener,build.getChangeSet()); } catch (Exception e) { - throw new IOException2("Failed to parse changelog",e); + throw new IOException("Failed to parse changelog",e); } // Get a chance to do something after checkout and changelog is done diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java index 8a19a1d169..fd3b2693aa 100644 --- a/core/src/main/java/hudson/model/AbstractItem.java +++ b/core/src/main/java/hudson/model/AbstractItem.java @@ -40,7 +40,6 @@ import hudson.security.ACL; import hudson.util.AlternativeUiTextProvider; import hudson.util.AlternativeUiTextProvider.Message; import hudson.util.AtomicFileWriter; -import hudson.util.IOException2; import hudson.util.IOUtils; import jenkins.model.Jenkins; import org.apache.tools.ant.taskdefs.Copy; @@ -586,7 +585,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet new StreamResult(out)); out.close(); } catch (TransformerException e) { - throw new IOException2("Failed to persist configuration.xml", e); + throw new IOException("Failed to persist configuration.xml", e); } // try to reflect the changes by reloading diff --git a/core/src/main/java/hudson/model/Api.java b/core/src/main/java/hudson/model/Api.java index 652fcf9e85..71b617e46f 100644 --- a/core/src/main/java/hudson/model/Api.java +++ b/core/src/main/java/hudson/model/Api.java @@ -23,7 +23,6 @@ */ package hudson.model; -import hudson.util.IOException2; import jenkins.model.Jenkins; import jenkins.security.SecureRequester; @@ -152,7 +151,7 @@ public class Api extends AbstractModelObject { } catch (DocumentException e) { LOGGER.log(Level.FINER, "Failed to do XPath/wrapper handling. XML is as follows:"+sw, e); - throw new IOException2("Failed to do XPath/wrapper handling. Turn on FINER logging to view XML.",e); + throw new IOException("Failed to do XPath/wrapper handling. Turn on FINER logging to view XML.",e); } OutputStream o = rsp.getCompressedOutputStream(req); diff --git a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java index 7fd4dfd661..5fd72727db 100644 --- a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java +++ b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java @@ -25,7 +25,6 @@ package hudson.model; import hudson.FilePath; import hudson.Util; -import hudson.util.IOException2; import jenkins.model.Jenkins; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -122,7 +121,7 @@ public final class DirectoryBrowserSupport implements HttpResponse { try { serveFile(req,rsp,base,icon,serveDirIndex); } catch (InterruptedException e) { - throw new IOException2("interrupted",e); + throw new IOException("interrupted",e); } } diff --git a/core/src/main/java/hudson/model/DownloadService.java b/core/src/main/java/hudson/model/DownloadService.java index 4ca6c5b616..273dd56e83 100644 --- a/core/src/main/java/hudson/model/DownloadService.java +++ b/core/src/main/java/hudson/model/DownloadService.java @@ -28,7 +28,6 @@ import hudson.ExtensionList; import hudson.ExtensionPoint; import hudson.util.FormValidation; import hudson.util.FormValidation.Kind; -import hudson.util.IOException2; import hudson.util.IOUtils; import hudson.util.QuotedStringTokenizer; import hudson.util.TextFile; @@ -240,7 +239,7 @@ public class DownloadService extends PageDecorator { return JSONObject.fromObject(df.read()); } catch (JSONException e) { df.delete(); // if we keep this file, it will cause repeated failures - throw new IOException2("Failed to parse "+df+" into JSON",e); + throw new IOException("Failed to parse "+df+" into JSON",e); } return null; } diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index addc19fa9c..f32099bc70 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -34,7 +34,6 @@ import hudson.BulkChange; import hudson.EnvVars; import hudson.ExtensionPoint; import hudson.FeedAdapter; -import hudson.FilePath; import hudson.Util; import hudson.XmlFile; import hudson.cli.declarative.CLIMethod; @@ -55,7 +54,6 @@ import hudson.tasks.BuildWrapper; import hudson.tasks.test.AbstractTestResultAction; import hudson.util.FlushProofOutputStream; import hudson.util.FormApply; -import hudson.util.IOException2; import hudson.util.LogTaskListener; import hudson.util.XStream2; @@ -392,7 +390,7 @@ public abstract class Run ,RunT extends Run new java.io.IOException($t);; +new hudson.util.IOException2($s, $t) :: $s instanceof String && $t instanceof Throwable => new java.io.IOException($s, $t);; diff --git a/core/src/test/java/hudson/FilePathTest.java b/core/src/test/java/hudson/FilePathTest.java index 762d0e7d96..6749d1fa61 100644 --- a/core/src/test/java/hudson/FilePathTest.java +++ b/core/src/test/java/hudson/FilePathTest.java @@ -28,7 +28,6 @@ import hudson.FilePath.TarCompression; import hudson.model.TaskListener; import hudson.remoting.LocalChannel; import hudson.remoting.VirtualChannel; -import hudson.util.IOException2; import hudson.util.NullStream; import java.io.ByteArrayInputStream; @@ -142,9 +141,9 @@ public class FilePathTest extends ChannelTestCase { private Exception closed; private volatile int count; - private void checkNotClosed() throws IOException2 { + private void checkNotClosed() throws IOException { if (closed != null) - throw new IOException2(closed); + throw new IOException(closed); } @Override diff --git a/test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java b/test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java index d28442e984..e21dc4526e 100644 --- a/test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java +++ b/test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java @@ -24,7 +24,6 @@ package org.jvnet.hudson.test; import hudson.FilePath; -import hudson.util.IOException2; import java.io.File; import java.io.IOException; @@ -68,7 +67,7 @@ public class TemporaryDirectoryAllocator { tmpDirectories.add(f); return f; } catch (IOException e) { - throw new IOException2("Failed to create a temporary directory in "+base,e); + throw new IOException("Failed to create a temporary directory in "+base,e); } } @@ -84,7 +83,7 @@ public class TemporaryDirectoryAllocator { x = e; } tmpDirectories.clear(); - if (x!=null) throw new IOException2("Failed to clean up temp dirs",x); + if (x!=null) throw new IOException("Failed to clean up temp dirs",x); } /** -- GitLab