protected InputStream inputStream(String name) throws java.io.FileNotFoundException { InputStream fis; File file = null; try { fis = new BufferedInputStream(new FileInputStream(file = getFile(name))); } catch (FileNotFoundException exc) { if ((file == null) || !file.exists()) { ExternalUtil.annotate(exc, NbBundle.getMessage(LocalFileSystem.class, "EXC_FileOutsideModified", getFile(name))); } throw exc; } return fis; }
protected void createData(String name) throws IOException { File f = getFile(name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile() ? false : true; isError = isError ? true : (!f.exists()); if (isError) { annotationMsg = NbBundle.getMessage(LocalFileSystem.class, "EXC_DataAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath()); creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { LOG.log(Level.INFO, "Trying to create new file {0}.", f.getPath()); ExternalUtil.annotate(creationException, annotationMsg); throw creationException; } }
ExternalUtil.annotate(ise, pae); throw ise;
retVal = (attr == null) ? attr : attr.get(params); } catch (Exception e) { ExternalUtil.annotate(e, "attrName = " + attrName); //NOI18N throw e;
final public void delete(FileLock lock) throws IOException { if (isFolder()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(AbstractFolder.class, "EXC_CannotDelete", // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName() ); ExternalUtil.annotate(iex, message); //NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete(lock); }
o = m.getAttribute(attrName); } catch (Exception e) { ExternalUtil.annotate(e, "fileName = " + fileName); //NOI18N ExternalUtil.exception(e);
protected InputStream inputStream (String name) throws java.io.FileNotFoundException { FileInputStream fis; File file = null; try { fis = new FileInputStream(file=getFile(name)); } catch(FileNotFoundException exc) { if (file == null || !file.exists()) ExternalUtil.annotate (exc, NbBundle.getMessage(LocalFileSystem.class,"EXC_FileOutsideModified")); throw exc; } return fis; }
protected InputStream inputStream (String name) throws java.io.FileNotFoundException { FileInputStream fis; File file = null; try { fis = new FileInputStream(file=getFile(name)); } catch(FileNotFoundException exc) { if (file == null || !file.exists()) ExternalUtil.annotate (exc, NbBundle.getMessage(LocalFileSystem.class,"EXC_FileOutsideModified")); throw exc; } return fis; }
/** * Annotates ex with all exceptions of unclosed streams. * @param ex that should be annotated */ public void annotate (Exception ex) { if (!ANNOTATE_UNCLOSED_STREAMS) { return; } synchronized (StreamPool.class) { if (iStreams != null) { Iterator itIs = iStreams.iterator (); NotifyInputStream nis; while (itIs.hasNext()) { nis = (NotifyInputStream) itIs.next(); Exception annotation = nis.getException (); if (annotation != null) ExternalUtil.annotate (ex,annotation); } } if (oStreams != null) { Iterator itOs = oStreams.iterator (); NotifyOutputStream nos; while (itOs.hasNext()) { nos = (NotifyOutputStream) itOs.next(); Exception annotation = nos.getException (); if (annotation != null) ExternalUtil.annotate (ex,annotation); } } } }
/** * Annotates ex with all exceptions of unclosed streams. * @param ex that should be annotated */ public void annotate (Exception ex) { if (!ANNOTATE_UNCLOSED_STREAMS) { return; } synchronized (StreamPool.class) { if (iStreams != null) { Iterator itIs = iStreams.iterator (); NotifyInputStream nis; while (itIs.hasNext()) { nis = (NotifyInputStream) itIs.next(); Exception annotation = nis.getException (); if (annotation != null) ExternalUtil.annotate (ex,annotation); } } if (oStreams != null) { Iterator itOs = oStreams.iterator (); NotifyOutputStream nos; while (itOs.hasNext()) { nos = (NotifyOutputStream) itOs.next(); Exception annotation = nos.getException (); if (annotation != null) ExternalUtil.annotate (ex,annotation); } } } }
private Object getAttribute (Object attrName, Object[] params) throws Exception { Attr attr; String origAttrName = (String)attrName; Object[] keyValuePair = ModifiedAttribute.translateInto((String)attrName,null); attrName = (String)keyValuePair[0]; synchronized (this) { attr = (Attr)map.get(attrName); } Object retVal = null; try { retVal = (attr == null)?attr : attr.get(params); } catch (Exception e) { ExternalUtil.annotate (e, "attrName = "+attrName); //NOI18N throw e; } if (retVal instanceof ModifiedAttribute) { Object res = ((ModifiedAttribute)retVal).getValue (origAttrName); if (res instanceof Attr) return ((Attr)res).get (params); else return res; } return retVal; }
private Object getAttribute (Object attrName, Object[] params) throws Exception { Attr attr; String origAttrName = (String)attrName; Object[] keyValuePair = ModifiedAttribute.translateInto((String)attrName,null); attrName = (String)keyValuePair[0]; synchronized (this) { attr = (Attr)map.get(attrName); } Object retVal = null; try { retVal = (attr == null)?attr : attr.get(params); } catch (Exception e) { ExternalUtil.annotate (e, "attrName = "+attrName); //NOI18N throw e; } if (retVal instanceof ModifiedAttribute) { Object res = ((ModifiedAttribute)retVal).getValue (origAttrName); if (res instanceof Attr) return ((Attr)res).get (params); else return res; } return retVal; }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
final public void delete(FileLock lock) throws IOException { if (isFolder ()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(getClass(), "EXC_CannotDelete", //NOI18N // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName()); ExternalUtil.annotate(iex, message);//NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete (lock); }
final public void delete(FileLock lock) throws IOException { if (isFolder ()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(getClass(), "EXC_CannotDelete", //NOI18N // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName()); ExternalUtil.annotate(iex, message);//NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete (lock); }
o = m.getAttribute (attrName); } catch (Exception e) { ExternalUtil.annotate (e, "fileName = "+fileName); //NOI18N ExternalUtil.exception (e);
o = m.getAttribute (attrName); } catch (Exception e) { ExternalUtil.annotate (e, "fileName = "+fileName); //NOI18N ExternalUtil.exception (e);