public boolean isValid() { return fileObj.isValid(); }
/** finds whether there already is this name */ private boolean isValidEntry(String n, Boolean expectedResult) { boolean retval = (n.length() == 0) ? true : false; if ((n.length() > 0) && (n.charAt(0) == '/')) { n = n.substring(1); } Entry x = entries.get(n); FileObject fo = null; if (x != null) { Reference ref = findReference(n); if (ref != null) { fo = (FileObject)ref.get(); retval = (fo != null) ? fo.isValid() : true; } } if (ERR.isLoggable(Level.FINE) && expectedResult != null && retval != expectedResult.booleanValue()) { logMessage("entry: " + x + " isValidReference.fo: " + ((fo == null) ? "null" : //NOI18N (fo.isValid() ? "valid" : "invalid")));//NOI18N } return (retval); }
/** #26521, 114976 - ignore not readable and windows' locked files. */ private static void handleIOException(FileObject fo, IOException ioe) throws IOException { if (fo.canRead()) { if (!Utilities.isWindows() || !(ioe instanceof FileNotFoundException) || !fo.isValid() || !fo.getName().toLowerCase().contains("ntuser")) {//NOI18N throw ioe; } } }
/** * Go ahead and retrieve a print or null */ protected Smell sniff(FileObject fo) { if (fo == null) return null; if (fo.equals(lastFileObject)) return print; if (fo.isValid() == false) return null; if (fo.getSize() == 0) return null; print = new Smell(); errors = 0; parse(fo); if (this.state == ERROR) { return null; } lastFileObject = fo; return print; }
/** * Return the revived file from the MFS * @return the revived file, if the operation succeeds. * @throws IOException from the deletion of the masking file. */ @Override public FileObject call() throws IOException { if (maskFile.isValid()) { maskFile.delete(); } return MultiFileObject.this.getFileObject(maskFile.getNameExt()); }
if (retval == null || !retval.isValid()) { folderFo.getFileSystem().refresh(false); retval = FileUtil.createData(folderFo,relativePath);
if (retval == null || !retval.isValid()) { folderFo.getFileSystem().refresh(false); retval = FileUtil.createFolder(folderFo,relativePath);
if (fo.isValid() && fo.canRead()) { Exceptions.attachMessage(io, "While parsing: " + fo); // NOI18N Logger.getLogger(DefaultParser.class.getName()).log(Level.INFO, null, io);
if (!fo.isValid() || fo.isFolder()) { return null;
Parameters.notNull("fileObject", fo); //NOI18N if (!fo.isValid()) { return isArchiveFile(fo.getPath());
protected void delete(String name) throws IOException { File file = getFile(name); if (deleteFile(file) != SUCCESS) { if (file.exists()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } else { /** When file externaly deleted and fo.delete () is called before periodical refresh */ FileObject thisFo = findResource(name); if (thisFo != null) { if (thisFo.getParent() != null) { thisFo.getParent().refresh(); } thisFo.refresh(); if (thisFo.isValid()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } } } } }
if (fo.isValid()) { Number weight = fo.isRoot() &&
/** [PENDING] expected rename of some refresh method */ /*protected void internalRefresh ( String add, String remove, boolean fire, boolean expected, String[] list **/ protected void refresh(String add, String remove, boolean fire, boolean expected) { try { getFileSystem().beginAtomicAction(); synchronized (this) { update(); /** [PENDING] expected rename of some refresh method */ //super.internalRefresh (add, remove, fire, expected, list); super.refresh(add, remove, fire, expected); } validFlag &= leader.isValid(); } finally { getFileSystem().finishAtomicAction(); } }
private List<FileObject> getValidFolders(List<FileObject> dirs) { List<FileObject> validDirs = new ArrayList<>(dirs.size()); for (FileObject dir : dirs) { assert dir.isFolder() : dir; if (dir.isValid()) { validDirs.add(dir); } } return validDirs; }
/** Is the item valid? */ public boolean isValid () { if (getPOOL().map.get (primaryFile) == this) { return primaryFile.isValid(); } else { return false; } }
private synchronized FileObject getDir(String propname) { FileObject fo = this.dirCache.get(propname); if (fo == null || !fo.isValid()) { String prop = evaluator.getProperty(propname); if (prop != null) { fo = helper.resolveFileObject(prop); this.dirCache.put(propname, fo); } } return fo; }
public static File toFile(FileObject fileObject) { // TODO: do we still need this? File file = FileUtil.toFile(fileObject); if (file == null && fileObject != null && !fileObject.isValid()) { file = new File(fileObject.getPath()); } return file; }
private static Flags get(FileObject fo) { if (fo != null && fo.isValid()) { if (fo.isFolder()) { return DIRECTORY; } else { assert fo.isData() : "not a file " + fo; return FILE; } } else { return NOT_FOUND; } }
protected final String getEncoding() { FileObject fo = getFileObject(); Charset cs = null; if (fo != null && fo.isValid()) { cs = FileEncodingQuery.getEncoding(fo); } if (cs == null) { cs = FileEncodingQuery.getDefaultEncoding(); } return cs.name(); }
private boolean isUnderneathSourcesOnlyAndVisible(FileObject fo) { return fo != null && fo.isValid() && CommandUtils.isUnderSources(project, fo) && !CommandUtils.isUnderTests(project, fo, false) && !CommandUtils.isUnderSelenium(project, fo, false) && phpVisibilityQuery.isVisible(fo); }