From: <ga...@us...> - 2009-04-27 14:14:33
|
Revision: 5352 http://jnode.svn.sourceforge.net/jnode/?rev=5352&view=rev Author: galatnm Date: 2009-04-27 14:14:23 +0000 (Mon, 27 Apr 2009) Log Message: ----------- Fix various NullPointerException. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-04-27 14:06:10 UTC (rev 5351) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-04-27 14:14:23 UTC (rev 5352) @@ -87,7 +87,19 @@ } private final FSEntry createFileEntry(final String name) throws IOException { - // TODO + /*if (fs.isReadOnly()) { + throw new ReadOnlyFileSystemException(); + } + Catalog catalog = fs.getCatalog(); + Superblock volumeHeader = ((HfsPlusFileSystem) getFileSystem()).getVolumeHeader(); + LeafRecord fileRecord = catalog.createNode(name, this.folder + .getFolderId(), new CatalogNodeId(volumeHeader.getNextCatalogId()), CatalogFile.RECORD_TYPE_FILE); + + HFSPlusEntry newEntry = new HFSPlusFile(fs, this, name, folderRecord); + newEntry.setDirty(); + volumeHeader.setFileCount(volumeHeader.getFileCount() + 1); + log.debug("New volume header :\n" + volumeHeader.toString());*/ + return null; } @@ -114,8 +126,7 @@ @Override public Iterator<? extends FSEntry> iterator() throws IOException { - // TODO Auto-generated method stub - return null; + return entries.iterator(); } public int rename(String oldName, String newName) { @@ -215,8 +226,10 @@ Superblock volumeHeader = ((HfsPlusFileSystem) getFileSystem()).getVolumeHeader(); LeafRecord folderRecord = catalog.createNode(name, this.folder.getFolderId(), new CatalogNodeId(volumeHeader.getNextCatalogId()), CatalogFolder.RECORD_TYPE_FOLDER_THREAD); + folder.setValence(folder.getValence() + 1); HFSPlusEntry newEntry = new HFSPlusDirectory(fs, this, name, folderRecord); + newEntry.setDirty(); volumeHeader.setFolderCount(volumeHeader.getFolderCount() + 1); log.debug("New volume header :\n" + volumeHeader.toString()); Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java 2009-04-27 14:06:10 UTC (rev 5351) +++ trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java 2009-04-27 14:14:23 UTC (rev 5352) @@ -287,7 +287,9 @@ entryCache.setEntry(entryPath.toString(), child); entryPath.setLength(directoryPathSize); - list.add(name); + if(name != null){ + list.add(name); + } } return list.toArray(new String[list.size()]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |