]
Denis Golovin updated JBIDE-9525:
---------------------------------
Fix Version/s: 3.3.0.M4
(was: 3.3.x)
PublishCopyUtil#copyFile throws an Exception but it's impl
catches it and returns an IStatus instead
----------------------------------------------------------------------------------------------------
Key: JBIDE-9525
URL:
https://issues.jboss.org/browse/JBIDE-9525
Project: Tools (JBoss Tools)
Issue Type: Enhancement
Components: JBossAS/Servers
Affects Versions: 3.3.0.M3
Reporter: Andre Dietisheim
Assignee: Rob Stryker
Priority: Minor
Fix For: 3.3.0.M4
see
https://source.jboss.org/cru/REV-JBIDE-4/#c79
PublishCopyUtil#copyFile should either throw Exceptions or return status objects. The
current impl where exceptions are declared in the method signature but catched in the impl
makes no sense. We have to decide what strategy to take (either throw or catch and return
status).
{code}
private IStatus copyFile(InputStream in, IPath to, long ts, IModuleFile mf) throws
CoreException {
File tempFile = null;
try {
File file = to.toFile();
tempFile = writeToTempFile(in, to);
moveTempFile(tempFile, file);
if (ts != IResource.NULL_STAMP && ts != 0)
file.setLastModified(ts);
} catch (CoreException e) {
throw e;
} catch (Exception e) {
IPath path = mf.getModuleRelativePath().append(mf.getName());
return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL,
NLS.bind(Messages.errorCopyingFile, path.toOSString(), e.getLocalizedMessage()), null);
} finally {
if (tempFile != null && tempFile.exists())
tempFile.deleteOnExit();
try {
if (in != null)
in.close();
} catch (Exception ex) {
// ignore
}
}
return null;
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: