Author: adietish
Date: 2011-08-11 07:07:22 -0400 (Thu, 11 Aug 2011)
New Revision: 33810
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/StreamUtils.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
Log:
[JBIDE-9524] catched IOException instead Exception
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2011-08-11
10:57:49 UTC (rev 33809)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2011-08-11
11:07:22 UTC (rev 33810)
@@ -15,7 +15,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -43,6 +42,7 @@
import org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.StreamUtils;
import org.jboss.ide.eclipse.as.core.util.internal.FileUtils;
/**
* Utility class with an assortment of useful file methods.
@@ -174,18 +174,14 @@
try {
FileUtils.writeTo(in, to);
return Status.OK_STATUS;
- } catch (Exception e) {
+ } catch (IOException e) {
//Trace.trace(Trace.SEVERE, "Error copying file", e);
return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL,
NLS.bind(Messages.errorCopyingFile, new String[] {to, e.getLocalizedMessage()}), e);
} finally {
- try {
- if (in != null)
- in.close();
- } catch (Exception ex) {
- // ignore
- }
+ StreamUtils.safeClose(in);
}
}
+
/**
* Copy a file from a to b. Closes the input stream after use.
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/StreamUtils.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/StreamUtils.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/StreamUtils.java 2011-08-11
11:07:22 UTC (rev 33810)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author André Dietisheim
+ */
+public class StreamUtils {
+
+ public static void safeClose(InputStream in) {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/StreamUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain