From: <ga...@us...> - 2009-08-10 21:17:50
|
Revision: 5636 http://jnode.svn.sourceforge.net/jnode/?rev=5636&view=rev Author: galatnm Date: 2009-08-10 21:17:38 +0000 (Mon, 10 Aug 2009) Log Message: ----------- CheckStyle. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusDirectory.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemFormatter.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemType.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusObject.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUtils.java trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/Node.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -159,7 +159,7 @@ * * @param blockSize Size of a block. * @param nodeSize Size of a node. - * @param sectors Number of sector for the device. + * @param sectors Number of sector for the device. * @param catalog If true, calculate catalog clump size. In the other case, * calculate extent clump size. * Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusDirectory.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusDirectory.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -87,18 +87,19 @@ } private final FSEntry createFileEntry(final String name) throws IOException { - /*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());*/ + /* + * 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; } @@ -224,10 +225,11 @@ } Catalog catalog = fs.getCatalog(); Superblock volumeHeader = ((HfsPlusFileSystem) getFileSystem()).getVolumeHeader(); - LeafRecord folderRecord = catalog.createNode(name, this.folder.getFolderId(), - new CatalogNodeId(volumeHeader.getNextCatalogId()), CatalogFolder.RECORD_TYPE_FOLDER_THREAD); + 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); Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -153,8 +153,8 @@ volumeHeader.create(params); log.debug("Volume header : \n" + volumeHeader.toString()); long volumeBlockUsed = - volumeHeader.getTotalBlocks() - volumeHeader.getFreeBlocks() - ((volumeHeader.getBlockSize() == 512) ? - 2 : 1); + volumeHeader.getTotalBlocks() - volumeHeader.getFreeBlocks() - + ((volumeHeader.getBlockSize() == 512) ? 2 : 1); // --- log.debug("Write allocation bitmap bits to disk."); writeAllocationFile((int) volumeBlockUsed); @@ -166,7 +166,7 @@ flush(); } catch (IOException e) { throw new FileSystemException("Unable to create HFS+ filesystem", e); - } + } } private void writeAllocationFile(int blockUsed) { Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemFormatter.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemFormatter.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemFormatter.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus; import javax.naming.NameNotFoundException; @@ -29,9 +29,9 @@ import org.jnode.naming.InitialNaming; public class HfsPlusFileSystemFormatter extends Formatter<HfsPlusFileSystem> { - + private HFSPlusParams params; - + public HfsPlusFileSystemFormatter(HFSPlusParams params) { super(new HfsPlusFileSystemType()); this.params = params; Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemType.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemType.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemType.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus; import java.io.IOException; @@ -35,7 +35,8 @@ public class HfsPlusFileSystemType implements BlockDeviceFileSystemType<HfsPlusFileSystem> { public static final Class<HfsPlusFileSystemType> ID = HfsPlusFileSystemType.class; - public final HfsPlusFileSystem create(final Device device, final boolean readOnly) throws FileSystemException { + public final HfsPlusFileSystem create(final Device device, final boolean readOnly) + throws FileSystemException { HfsPlusFileSystem fs = new HfsPlusFileSystem(device, readOnly, this); fs.read(); return fs; @@ -45,7 +46,7 @@ return "HFS+"; } - public final boolean supports(final PartitionTableEntry pte, final byte[] firstSector, + public final boolean supports(final PartitionTableEntry pte, final byte[] firstSector, final FSBlockDeviceAPI devApi) { if (pte != null) { if (pte instanceof IBMPartitionTableEntry) { Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusObject.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusObject.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusObject.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus; import org.jnode.fs.FSObject; Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus; import org.jnode.util.BigEndian; Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUtils.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUtils.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUtils.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -36,8 +36,8 @@ * Convert time from/to java time to/from mac time. * * @param time in seconds since reference date. - * @param encode if {code true}, convert from java to mac, otherwise - * convert from mac to java. + * @param encode if {code true}, convert from java to mac, otherwise convert + * from mac to java. * * @return the converted time */ Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -27,6 +27,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.jnode.driver.ApiNotFoundException; import org.jnode.fs.FileSystemException; import org.jnode.fs.hfsplus.catalog.CatalogNodeId; import org.jnode.fs.hfsplus.extent.ExtentDescriptor; @@ -105,8 +106,7 @@ * @throws ApiNotFoundException * @throws FileSystemException */ - public void create(HFSPlusParams params) - throws IOException { + public void create(HFSPlusParams params) throws IOException { log.info("Create new HFS+ volume header (" + params.getVolumeName() + ") with block size of " + params.getBlockSize() + " bytes."); int burnedBlocksBeforeVH = 0; @@ -434,7 +434,7 @@ public byte[] getBytes() { return data; } - + public void update() throws IOException { fs.getApi().write(1024, ByteBuffer.wrap(data)); } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus.tree; import java.util.List; @@ -54,7 +54,7 @@ @Override public boolean addNodeRecord(NodeRecord record) { int freeSpace = getFreeSize(); - if(freeSpace < record.getSize() + 2){ + if (freeSpace < record.getSize() + 2) { return false; } Integer lastOffset = offsets.get(offsets.size() - 1); @@ -63,32 +63,35 @@ records.add(record); return true; } - - public boolean check(int treeHeigth){ + + public boolean check(int treeHeigth) { // Node type is correct. - if(this.getNodeDescriptor().getKind() < NodeDescriptor.BT_LEAF_NODE || this.getNodeDescriptor().getKind() > NodeDescriptor.BT_MAP_NODE){ + if (this.getNodeDescriptor().getKind() < NodeDescriptor.BT_LEAF_NODE || + this.getNodeDescriptor().getKind() > NodeDescriptor.BT_MAP_NODE) { return false; } - - if(this.getNodeDescriptor().getHeight() > treeHeigth){ + + if (this.getNodeDescriptor().getHeight() > treeHeigth) { return false; } return true; } - + /** * Return amount of free space remaining. + * * @return remaining free space. */ - protected int getFreeSize(){ + protected int getFreeSize() { int freeOffset = offsets.get(offsets.size() - 1); int freeSize = size - freeOffset - (descriptor.getNumRecords() << 1) - OFFSET_SIZE; return freeSize; } - + public byte[] getBytes() { byte[] datas = new byte[size]; - System.arraycopy(descriptor.getBytes(), 0, datas, 0, NodeDescriptor.BT_NODE_DESCRIPTOR_LENGTH); + System.arraycopy(descriptor.getBytes(), 0, datas, 0, + NodeDescriptor.BT_NODE_DESCRIPTOR_LENGTH); int offsetIndex = 0; int offset; for (NodeRecord record : records) { @@ -101,13 +104,13 @@ BigEndian.setInt16(datas, size - ((offsetIndex + 1) * 2), offset); return datas; } - + public String toString() { StringBuffer b = new StringBuffer(); b.append((this.isLeafNode()) ? "Leaf node" : "Index node").append("\n"); b.append(this.getNodeDescriptor().toString()).append("\n"); b.append("Offsets : ").append(offsets.toString()); return b.toString(); - + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/Node.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/Node.java 2009-08-09 19:03:40 UTC (rev 5635) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/Node.java 2009-08-10 21:17:38 UTC (rev 5636) @@ -22,7 +22,7 @@ public interface Node { - public final static int OFFSET_SIZE = 2; + public static final int OFFSET_SIZE = 2; public NodeDescriptor getNodeDescriptor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |