Author: adietish
Date: 2011-06-01 11:17:07 -0400 (Wed, 01 Jun 2011)
New Revision: 31731
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
Log:
[JBIDE-8920] extracted method to get better readable code (no functional change!)
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-06-01
13:21:55 UTC (rev 31730)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2011-06-01
15:17:07 UTC (rev 31731)
@@ -232,12 +232,7 @@
try {
InputStream in = new FileInputStream(tempFile);
IStatus status = copyFile(in, file.getPath());
- if (!status.isOK()) {
- MultiStatus status2 = new MultiStatus(ServerPlugin.PLUGIN_ID, 0,
NLS.bind(Messages.errorDeleting, file.toString()), null);
- status2.add(status);
- throw new CoreException(status2);
- }
- return;
+ throwOnErrorStatus(file, status);
} catch (FileNotFoundException e) {
// shouldn't occur
} finally {
@@ -254,6 +249,14 @@
NLS.bind(org.jboss.ide.eclipse.as.core.Messages.PublishRenameFailure,
tempFile.toString(), file.getAbsolutePath()), null));
}
+
+ private void throwOnErrorStatus(File file, IStatus status) throws CoreException {
+ if (!status.isOK()) {
+ MultiStatus status2 = new MultiStatus(ServerPlugin.PLUGIN_ID, 0,
NLS.bind(Messages.errorDeleting, file.toString()), null);
+ status2.add(status);
+ throw new CoreException(status2);
+ }
+ }
/**
* Safe rename. Will try multiple times before giving up.
Show replies by date