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).
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; }
- blocks
-
JBIDE-9016 Review error handling code in as plugins
-
- Closed
-