Revision: 5760 http://jnode.svn.sourceforge.net/jnode/?rev=5760&view=rev Author: lsantha Date: 2010-12-27 18:44:14 +0000 (Mon, 27 Dec 2010)
Log Message: ----------- Checkstyle fixes. Modified Paths: -------------- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java trunk/cli/src/commands/org/jnode/command/system/GcCommand.java trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java trunk/fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java trunk/fs/src/test/org/jnode/test/support/MockObjectFactory.java trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java trunk/gui/src/driver/org/jnode/driver/video/vga/VGABitmapGraphics.java trunk/gui/src/driver/org/jnode/driver/video/vga/VGADriver.java Modified: trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.build; import java.io.BufferedReader; @@ -611,7 +611,7 @@ emitStaticInitializerCalls(os, bootClasses, clInitCaller); // This is the end of the image - X86BinaryAssembler.ObjectInfo dummyObjectAtEnd = + X86BinaryAssembler.ObjectInfo dummyObjectAtEnd = os.startObject(loadClass(VmMethodCode.class)); pageAlign(os); dummyObjectAtEnd.markEnd(); @@ -756,7 +756,7 @@ } if (!ref.isResolved()) { throw new RuntimeException("Unresolved reference to object " + ((obj == null) ? - "null" : obj.getClass() .getName())); + "null" : obj.getClass().getName())); } } } @@ -803,85 +803,85 @@ throws ClassNotFoundException; public final void execute() throws BuildException { - try { - InitialNaming.setNameSpace(new BasicNameSpace()); - BootLogInstance.set(new BootLog() { - @Override - public void warn(String msg) { - System.out.println(msg); - } - - @Override - public void warn(String msg, Throwable ex) { - System.out.println(msg); - ex.printStackTrace(System.out); - } - - @Override - public void setDebugOut(PrintStream out) { - // ignore - } - - @Override - public void info(String msg, Throwable ex) { - System.out.println(msg); - ex.printStackTrace(System.out); - } - - @Override - public void info(String msg) { - System.out.println(msg); - } - - @Override - public void fatal(String msg, Throwable ex) { - System.out.println(msg); - ex.printStackTrace(System.out); - } - - @Override - public void fatal(String msg) { - System.out.println(msg); - } - - @Override - public void error(String msg, Throwable ex) { - System.out.println(msg); - ex.printStackTrace(System.out); - } - - @Override - public void error(String msg) { - System.out.println(msg); - } - - @Override - public void debug(String msg, Throwable ex) { - System.out.println(msg); - ex.printStackTrace(System.out); - } - - @Override - public void debug(String msg) { - System.out.println(msg); - } - }); - - // Create the image - doExecute(); - // Remove all garbage objects - cleanup(); - System.gc(); - // Make sure that all finalizers are called, in order to remove tmp - // files. - Runtime.getRuntime().runFinalization(); - } catch (BuildException be) { - be.printStackTrace(); - throw be; - } catch (Throwable t) { - t.printStackTrace(); - throw new BuildException(t); - } + try { + InitialNaming.setNameSpace(new BasicNameSpace()); + BootLogInstance.set(new BootLog() { + @Override + public void warn(String msg) { + System.out.println(msg); + } + + @Override + public void warn(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void setDebugOut(PrintStream out) { + // ignore + } + + @Override + public void info(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void info(String msg) { + System.out.println(msg); + } + + @Override + public void fatal(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void fatal(String msg) { + System.out.println(msg); + } + + @Override + public void error(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void error(String msg) { + System.out.println(msg); + } + + @Override + public void debug(String msg, Throwable ex) { + System.out.println(msg); + ex.printStackTrace(System.out); + } + + @Override + public void debug(String msg) { + System.out.println(msg); + } + }); + + // Create the image + doExecute(); + // Remove all garbage objects + cleanup(); + System.gc(); + // Make sure that all finalizers are called, in order to remove tmp + // files. + Runtime.getRuntime().runFinalization(); + } catch (BuildException be) { + be.printStackTrace(); + throw be; + } catch (Throwable t) { + t.printStackTrace(); + throw new BuildException(t); + } } /** @@ -997,7 +997,7 @@ protected boolean isCompileHighOptLevel(VmType<?> vmClass) { return vmClass.isArray() || isCompileHighOptLevel(vmClass.getName()); } - + private boolean isCompileHighOptLevel(String name) { if (compileHighOptLevelPackages.contains(name)) { return true; @@ -1020,9 +1020,8 @@ return false; } - - + /** * Link all undefined symbols from the kernel native code. * @@ -1112,8 +1111,8 @@ eName.length() - ".class".length()).replace('/', '.'); final int lastDotIdx = cName.lastIndexOf('.'); final String pkg = (lastDotIdx > 0) ? cName.substring(0, lastDotIdx) : ""; - if (isCompileHighOptLevel(cName) || - preloadPackages.contains(cName) || preloadPackages.contains(pkg)) { + if (isCompileHighOptLevel(cName) || + preloadPackages.contains(cName) || preloadPackages.contains(pkg)) { loadClass(cName, true); } } @@ -1351,7 +1350,7 @@ public void setListFile(File listFile) { this.listFile = listFile; } - + /** * Sets the core class list file. * @@ -1362,52 +1361,51 @@ } protected void setupCompileHighOptLevelPackages() { - addCompileHighOptLevel(loadClassList(coreClassListFile)); + addCompileHighOptLevel(loadClassList(coreClassListFile)); for (NativeCodeCompiler compiler : getArchitecture().getCompilers()) { for (String packageName : compiler.getCompilerPackages()) { addCompileHighOptLevel(packageName); } } } - + protected void addCompileHighOptLevel(List<String> classNames) { - for (String className : classNames) { - addCompileHighOptLevel(className); - } + for (String className : classNames) { + addCompileHighOptLevel(className); + } } - protected List<String> loadClassList(File file) { - ArrayList<String> classNames = new ArrayList<String>(); - FileReader fr; - try { - fr = new FileReader(file); - } catch (IOException ex) { - throw new BuildException("Cannot open '" + file + "'", ex); - } - try { - BufferedReader br = new BufferedReader(fr); - String line; - while ((line = br.readLine()) != null) { - line = line.trim(); - if (line.isEmpty() || line.startsWith("#") || line.startsWith("/")) { - continue; - } - classNames.add(line); - } - } catch (IOException ex) { - throw new BuildException("Error reading '" + file + "'", ex); - } finally { - try { - fr.close(); - } catch (IOException ex) { - // ignore - } - } - return classNames; - } - - + protected List<String> loadClassList(File file) { + ArrayList<String> classNames = new ArrayList<String>(); + FileReader fr; + try { + fr = new FileReader(file); + } catch (IOException ex) { + throw new BuildException("Cannot open '" + file + "'", ex); + } + try { + BufferedReader br = new BufferedReader(fr); + String line; + while ((line = br.readLine()) != null) { + line = line.trim(); + if (line.isEmpty() || line.startsWith("#") || line.startsWith("/")) { + continue; + } + classNames.add(line); + } + } catch (IOException ex) { + throw new BuildException("Error reading '" + file + "'", ex); + } finally { + try { + fr.close(); + } catch (IOException ex) { + // ignore + } + } + return classNames; + } + /** * Create a set of the names of those classes that can be safely * instantiated during the boot process (and written as instance to the boot Modified: trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/builder/src/builder/org/jnode/build/ObjectEmitter.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.build; import java.io.PrintWriter; @@ -334,7 +334,7 @@ /** * Allocate and write and object of a given type. - * + * * @param cls * @param obj * @param vmType @@ -461,7 +461,7 @@ + jdkField.getName() + " of class " + cls.getName(), ex); } catch (JNodeClassNotFoundException ex) { - BootLogInstance.get() + BootLogInstance.get() .warn("JNode class not found " + ex.getMessage()); value = null; Modified: trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java =================================================================== --- trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/builder/src/builder/org/jnode/build/x86/BootImageBuilder.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.build.x86; import java.io.File; @@ -84,7 +84,7 @@ public static final int INITIAL_OBJREFS_CAPACITY = 750000; public static final int INITIAL_SIZE = 64 * 1024 * 1024; - + private File archClassListFile; private VmX86Processor processor; @@ -351,9 +351,9 @@ refJava = os .getObjectRef(vmSystemClass .getMethod( - "findThrowableHandler", - "(Ljava/lang/Throwable;Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;)" + - "Lorg/vmmagic/unboxed/Address;")); + "findThrowableHandler", + "(Ljava/lang/Throwable;Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;)" + + "Lorg/vmmagic/unboxed/Address;")); os.getObjectRef(vmFindThrowableHandler).link(refJava); // Link Luser_esp @@ -694,7 +694,7 @@ /** * Include x86 class files. - * + * * @see org.jnode.build.AbstractBootImageBuilder#setupCompileHighOptLevelPackages() */ protected void setupCompileHighOptLevelPackages() { @@ -773,16 +773,16 @@ * * @return The archClassListFile to set */ - public File getArchClassListFile() { - return archClassListFile; - } + public File getArchClassListFile() { + return archClassListFile; + } - /** + /** * Sets the architecture specific class list file. * * @param archClassListFile The archClassListFile to set */ - public void setArchClassListFile(File archClassListFile) { - this.archClassListFile = archClassListFile; - } + public void setArchClassListFile(File archClassListFile) { + this.archClassListFile = archClassListFile; + } } Modified: trunk/cli/src/commands/org/jnode/command/system/GcCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/system/GcCommand.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/cli/src/commands/org/jnode/command/system/GcCommand.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.command.system; import java.io.PrintWriter; @@ -27,7 +27,6 @@ import org.jnode.shell.syntax.EnumArgument; import org.jnode.shell.syntax.FlagArgument; import org.jnode.util.NumberUtils; -import org.jnode.vm.VmImpl; import org.jnode.vm.facade.GCStatistics; import org.jnode.vm.facade.VmUtils; import org.jnode.vm.memmgr.VmHeapManager; @@ -37,7 +36,7 @@ * @author craw...@jnode.org */ public class GcCommand extends AbstractCommand { - + private static final String help_debug_flags = "the heap debug flags"; private static final String help_set = "set these debug flags"; private static final String help_clear = "clear these debug flags"; @@ -51,11 +50,11 @@ private static final String str_start = "Starting gc"; private static final String str_no_flags = "No heap debug flags set"; private static final String fmt_flags = "Heap debug flags: %s"; - + private enum HeapFlag { - TRACE_BASIC(VmHeapManager.TRACE_BASIC), - TRACE_ALLOC(VmHeapManager.TRACE_ALLOC), - TRACE_TRIGGER(VmHeapManager.TRACE_TRIGGER), + TRACE_BASIC(VmHeapManager.TRACE_BASIC), + TRACE_ALLOC(VmHeapManager.TRACE_ALLOC), + TRACE_TRIGGER(VmHeapManager.TRACE_TRIGGER), TRACE_OOM(VmHeapManager.TRACE_OOM), TRACE_AD_HOC(VmHeapManager.TRACE_AD_HOC), all(-1); // All flags @@ -71,12 +70,13 @@ public HeapDebugFlagArgument() { super("debugFlag", Argument.OPTIONAL | Argument.MULTIPLE, HeapFlag.class, help_debug_flags); } + @Override protected String argumentKind() { return "debug flag"; } } - + private final HeapDebugFlagArgument argDebugFlags; private final FlagArgument argSet; private final FlagArgument argClear; @@ -85,9 +85,9 @@ public GcCommand() { super(help_super); argDebugFlags = new HeapDebugFlagArgument(); - argSet = new FlagArgument("set", Argument.OPTIONAL, help_set); - argClear = new FlagArgument("clear", Argument.OPTIONAL, help_clear); - argShow = new FlagArgument("show", Argument.OPTIONAL, help_show); + argSet = new FlagArgument("set", Argument.OPTIONAL, help_set); + argClear = new FlagArgument("clear", Argument.OPTIONAL, help_clear); + argShow = new FlagArgument("show", Argument.OPTIONAL, help_show); registerArguments(argDebugFlags, argClear, argSet, argShow); } @@ -101,7 +101,7 @@ public void execute() throws Exception { final PrintWriter out = getOutput().getPrintWriter(); if (argSet.isSet()) { - VmUtils.getVm().getHeapManager().setHeapFlags(getFlags()); + VmUtils.getVm().getHeapManager().setHeapFlags(getFlags()); } else if (argClear.isSet()) { int flags = VmUtils.getVm().getHeapManager().getHeapFlags() ^ getFlags(); VmUtils.getVm().getHeapManager().setHeapFlags(flags); @@ -118,14 +118,14 @@ GCStatistics stats = VmUtils.getVm().getHeapManager().getStatistics(); Thread.yield(); long end = System.currentTimeMillis(); - + out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory())); out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory())); out.format(fmt_out, str_time, (end - start) + "ms"); out.format(fmt_out, str_stats, stats.toString()); } } - + private void showFlags(int flags, PrintWriter out) { StringBuilder sb = new StringBuilder(); for (int flagBitMask = 1; flagBitMask != 0; flagBitMask = flagBitMask << 1) { Modified: trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -27,7 +27,6 @@ import org.jnode.shell.syntax.Argument; import org.jnode.shell.syntax.IntegerArgument; import org.jnode.shell.syntax.LongArgument; -import org.jnode.vm.VmImpl; import org.jnode.vm.facade.HeapStatistics; import org.jnode.vm.facade.VmUtils; Modified: trunk/fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java =================================================================== --- trunk/fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.driver.block.ide.disk; import java.io.IOException; @@ -68,18 +68,18 @@ * My logger */ private static final Logger log = Logger.getLogger(IDEDiskDriver.class); - + /** * Number of addressable sectors */ private long maxSector; - + /** Has LBA support? */ //private boolean lba; - + /** Has DMA support? */ //private boolean dma; - + /** * Support 48-bit addressing? */ @@ -124,7 +124,7 @@ int i = 0; for (IBMPartitionTableEntry pte : pt) { if (pte == null) { - BootLogInstance.get().warn("PartitionTableEntry #" + i + " is null"); + BootLogInstance.get().warn("PartitionTableEntry #" + i + " is null"); } else if (pte.isValid()) { if (pte.isExtended()) { // Create partition devices for the extended partition @@ -299,9 +299,10 @@ * @param partIndex the first partition index to use * @return the next partition index * @throws DeviceAlreadyRegisteredException + * * @throws DriverException */ - private int registerExtendedPartition(DeviceManager devMan, IDEDevice dev, int partIndex) + private int registerExtendedPartition(DeviceManager devMan, IDEDevice dev, int partIndex) throws DeviceAlreadyRegisteredException, DriverException { //now we should have an filled vector in the pt final List<IBMPartitionTableEntry> extendedPartitions = pt.getExtendedPartitions(); Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -43,7 +43,7 @@ * @see org.jnode.fs.FileSystem#getDevice() */ public ISO9660FileSystem(Device device, boolean readOnly, ISO9660FileSystemType type) - throws FileSystemException { + throws FileSystemException { super(device, readOnly, type); try { @@ -84,7 +84,7 @@ } /** - * + * */ protected FSFile createFile(FSEntry entry) throws IOException { // TODO Auto-generated method stub @@ -92,7 +92,7 @@ } /** - * + * */ protected FSDirectory createDirectory(FSEntry entry) throws IOException { // TODO Auto-generated method stub @@ -100,7 +100,7 @@ } /** - * + * */ protected ISO9660Entry createRootEntry() throws IOException { // TODO Auto-generated method stub Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660Volume.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -43,7 +43,7 @@ /** * Initialize this instance. - * + * * @param api * @throws IOException */ @@ -65,26 +65,26 @@ done = true; break; case VolumeDescriptorType.BOOTRECORD: - BootLogInstance.get().debug("Found boot record"); + BootLogInstance.get().debug("Found boot record"); break; case VolumeDescriptorType.PRIMARY_DESCRIPTOR: - BootLogInstance.get().debug("Found primary descriptor"); + BootLogInstance.get().debug("Found primary descriptor"); pVD = new PrimaryVolumeDescriptor(this, buffer); // pVD.dump(System.out); break; case VolumeDescriptorType.SUPPLEMENTARY_DESCRIPTOR: - BootLogInstance.get().debug("Found supplementatory descriptor"); + BootLogInstance.get().debug("Found supplementatory descriptor"); final SupplementaryVolumeDescriptor d = - new SupplementaryVolumeDescriptor(this, buffer); + new SupplementaryVolumeDescriptor(this, buffer); if (d.isEncodingKnown()) { sVD = d; } break; case VolumeDescriptorType.PARTITION_DESCRIPTOR: - BootLogInstance.get().debug("Found partition descriptor"); + BootLogInstance.get().debug("Found partition descriptor"); break; default: - BootLogInstance.get().debug("Found unknown descriptor with type " + type); + BootLogInstance.get().debug("Found unknown descriptor with type " + type); } } if (pVD == null) { @@ -96,7 +96,7 @@ /** * Read a block of data from this volume. - * + * * @param startLBN * @param offset * @param buffer Modified: trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/fs/org/jnode/fs/iso9660/SupplementaryVolumeDescriptor.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -45,7 +45,7 @@ * @param buffer */ public SupplementaryVolumeDescriptor(ISO9660Volume volume, byte[] buffer) - throws UnsupportedEncodingException { + throws UnsupportedEncodingException { super(volume, buffer); this.flags = getUInt8(buffer, 8); this.escapeSequences = getDChars(buffer, 89, 121 - 89); @@ -115,7 +115,7 @@ /** * Gets a derived encoding name from the given escape sequences. - * + * * @param escapeSequences * @return the encoding name */ @@ -137,7 +137,7 @@ /** * Is the used encoding known to this system. - * + * * @return {...@code true} if the encoding known, otherwise {...@code false}. */ public final boolean isEncodingKnown() { Modified: trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/fs/org/jnode/partitions/command/FdiskCommand.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -51,165 +51,165 @@ * @author craw...@jnode.org */ public class FdiskCommand extends AbstractCommand { - // FIXME ... this is a dangerous command and it needs some extra checking to help - // avoid catastrophic errors. At the very least, it needs a mode that shows the - // user what would happen but does nothing. + // FIXME ... this is a dangerous command and it needs some extra checking to help + // avoid catastrophic errors. At the very least, it needs a mode that shows the + // user what would happen but does nothing. private final FlagArgument FLAG_INIT_MBR = - new FlagArgument("initMBR", Argument.OPTIONAL, - "if set, init the device's Master Boot Record"); + new FlagArgument("initMBR", Argument.OPTIONAL, + "if set, init the device's Master Boot Record"); private final FlagArgument FLAG_DELETE = - new FlagArgument("delete", Argument.OPTIONAL, "if set, delete a partition"); + new FlagArgument("delete", Argument.OPTIONAL, "if set, delete a partition"); private final FlagArgument FLAG_BOOTABLE = - new FlagArgument("bootable", Argument.OPTIONAL, - "if set, toggle the partition's bootable flag"); + new FlagArgument("bootable", Argument.OPTIONAL, + "if set, toggle the partition's bootable flag"); private final FlagArgument FLAG_MODIFY = - new FlagArgument("modify", Argument.OPTIONAL, "if set, modify or create a partition"); + new FlagArgument("modify", Argument.OPTIONAL, "if set, modify or create a partition"); private final IntegerArgument ARG_PARTITION = - new IntegerArgument("partition", Argument.OPTIONAL, "Target partition number (0..3)"); + new IntegerArgument("partition", Argument.OPTIONAL, "Target partition number (0..3)"); private final LongArgument ARG_START = - new LongArgument("start", Argument.OPTIONAL, "Partition start sector"); + new LongArgument("start", Argument.OPTIONAL, "Partition start sector"); private final LongArgument ARG_SECTORS = - new LongArgument("sectors", Argument.OPTIONAL, "Partition size in sectors"); + new LongArgument("sectors", Argument.OPTIONAL, "Partition size in sectors"); private final SizeArgument ARG_BYTES = - new SizeArgument("bytes", Argument.OPTIONAL, "Partition size in bytes (300K, 45M, etc)"); + new SizeArgument("bytes", Argument.OPTIONAL, "Partition size in bytes (300K, 45M, etc)"); private final IBMPartitionTypeArgument ARG_TYPE = - new IBMPartitionTypeArgument("type", Argument.OPTIONAL, "IBM partition type code"); + new IBMPartitionTypeArgument("type", Argument.OPTIONAL, "IBM partition type code"); private final DeviceArgument ARG_DEVICE = - new DeviceArgument("deviceId", Argument.OPTIONAL, "Target device", BlockDeviceAPI.class); + new DeviceArgument("deviceId", Argument.OPTIONAL, "Target device", BlockDeviceAPI.class); - public FdiskCommand() { - super("perform disk partition management tasks"); + public FdiskCommand() { + super("perform disk partition management tasks"); registerArguments(FLAG_BOOTABLE, FLAG_DELETE, FLAG_INIT_MBR, FLAG_MODIFY, ARG_DEVICE, - ARG_PARTITION, ARG_START, ARG_SECTORS, ARG_BYTES, ARG_TYPE); - } + ARG_PARTITION, ARG_START, ARG_SECTORS, ARG_BYTES, ARG_TYPE); + } - public static void main(String[] args) throws Exception { - new FdiskCommand().execute(args); - } + public static void main(String[] args) throws Exception { + new FdiskCommand().execute(args); + } - public void execute() throws Exception { - final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); - PrintWriter out = getOutput().getPrintWriter(); - PrintWriter err = getError().getPrintWriter(); - if (!ARG_DEVICE.isSet()) { - // Show all devices. - listAvailableDevices(dm, out); - return; - } + public void execute() throws Exception { + final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME); + PrintWriter out = getOutput().getPrintWriter(); + PrintWriter err = getError().getPrintWriter(); + if (!ARG_DEVICE.isSet()) { + // Show all devices. + listAvailableDevices(dm, out); + return; + } - Device dev = ARG_DEVICE.getValue(); - // FIXME PartitionHelper assumes that the device is an IDE device !?! - if (!(dev instanceof IDEDevice)) { - err.println(dev.getId() + " is not an IDE device"); - exit(1); - } - final PartitionHelper helper = new PartitionHelper(dev.getId(), out); - try{ - helper.checkMBR(); - } catch (IOException ioex){ - out.println(ioex.getMessage()); - out.println("Create a new MBR with a valid partition table."); - helper.initMbr(); - helper.write(); - } + Device dev = ARG_DEVICE.getValue(); + // FIXME PartitionHelper assumes that the device is an IDE device !?! + if (!(dev instanceof IDEDevice)) { + err.println(dev.getId() + " is not an IDE device"); + exit(1); + } + final PartitionHelper helper = new PartitionHelper(dev.getId(), out); + try { + helper.checkMBR(); + } catch (IOException ioex) { + out.println(ioex.getMessage()); + out.println("Create a new MBR with a valid partition table."); + helper.initMbr(); + helper.write(); + } - if (FLAG_BOOTABLE.isSet()) { - helper.toggleBootable(getPartitionNumber(helper)); - helper.write(); - } else if (FLAG_DELETE.isSet()) { - helper.deletePartition(getPartitionNumber(helper)); - helper.write(); - } else if (FLAG_MODIFY.isSet()) { - modifyPartition(helper, getPartitionNumber(helper), out); - helper.write(); - } else if (FLAG_INIT_MBR.isSet()) { - helper.initMbr(); - helper.write(); - } else { - printPartitionTable(helper, out); - } - } + if (FLAG_BOOTABLE.isSet()) { + helper.toggleBootable(getPartitionNumber(helper)); + helper.write(); + } else if (FLAG_DELETE.isSet()) { + helper.deletePartition(getPartitionNumber(helper)); + helper.write(); + } else if (FLAG_MODIFY.isSet()) { + modifyPartition(helper, getPartitionNumber(helper), out); + helper.write(); + } else if (FLAG_INIT_MBR.isSet()) { + helper.initMbr(); + helper.write(); + } else { + printPartitionTable(helper, out); + } + } - private int getPartitionNumber(PartitionHelper helper) { - int partNumber = ARG_PARTITION.getValue(); - if (partNumber >= helper.getNbPartitions() || partNumber < 0) { - throw new IllegalArgumentException("Partition number is invalid"); - } - return partNumber; - } + private int getPartitionNumber(PartitionHelper helper) { + int partNumber = ARG_PARTITION.getValue(); + if (partNumber >= helper.getNbPartitions() || partNumber < 0) { + throw new IllegalArgumentException("Partition number is invalid"); + } + return partNumber; + } private void modifyPartition(PartitionHelper helper, int id, PrintWriter out) throws IOException { - long start = ARG_START.getValue(); - long size = ARG_SECTORS.isSet() ? ARG_SECTORS.getValue() : ARG_BYTES.getValue(); - IBMPartitionTypes type = ARG_TYPE.getValue(); + long start = ARG_START.getValue(); + long size = ARG_SECTORS.isSet() ? ARG_SECTORS.getValue() : ARG_BYTES.getValue(); + IBMPartitionTypes type = ARG_TYPE.getValue(); out.println("Init " + id + " with start = " + start + ", size = " + size + ", fs = " + - Integer.toHexString(type.getCode())); + Integer.toHexString(type.getCode())); boolean sizeUnit = ARG_BYTES.isSet() ? PartitionHelper.BYTES : PartitionHelper.SECTORS; - helper.modifyPartition(id, false, start, size, sizeUnit, type); - } + helper.modifyPartition(id, false, start, size, sizeUnit, type); + } - private void printPartitionTable(PartitionHelper helper, PrintWriter out) - throws DeviceNotFoundException, ApiNotFoundException, IOException { - IDEDevice ideDev = helper.getDevice(); - IDEDriveDescriptor descriptor = ideDev.getDescriptor(); - int sectorSize = IDEConstants.SECTOR_SIZE; - if (ideDev != null) { - out.println("IDE Disk : " + ideDev.getId() + ": " + - descriptor.getSectorsIn28bitAddressing() * 512 + " bytes"); - } - out.println("Device Boot Start End Blocks System"); - IBMPartitionTable partitionTable = helper.getPartitionTable(); - int i = 0; - for(IBMPartitionTableEntry entry : partitionTable){ - IBMPartitionTypes si = entry.getSystemIndicator(); - if (!entry.isEmpty()) { - long sectors = entry.getNrSectors(); + private void printPartitionTable(PartitionHelper helper, PrintWriter out) + throws DeviceNotFoundException, ApiNotFoundException, IOException { + IDEDevice ideDev = helper.getDevice(); + IDEDriveDescriptor descriptor = ideDev.getDescriptor(); + int sectorSize = IDEConstants.SECTOR_SIZE; + if (ideDev != null) { + out.println("IDE Disk : " + ideDev.getId() + ": " + + descriptor.getSectorsIn28bitAddressing() * 512 + " bytes"); + } + out.println("Device Boot Start End Blocks System"); + IBMPartitionTable partitionTable = helper.getPartitionTable(); + int i = 0; + for (IBMPartitionTableEntry entry : partitionTable) { + IBMPartitionTypes si = entry.getSystemIndicator(); + if (!entry.isEmpty()) { + long sectors = entry.getNrSectors(); out.println("ID " + i + " " + (entry.getBootIndicator() ? "Boot" : "No") + " " + - entry.getStartLba() + " " + (entry.getStartLba() + sectors) + " " + - entry.getNbrBlocks(sectorSize) + (entry.isOdd()?"":"+") + " " + si); - } - if (entry.isExtended()) { + entry.getStartLba() + " " + (entry.getStartLba() + sectors) + " " + + entry.getNbrBlocks(sectorSize) + (entry.isOdd() ? "" : "+") + " " + si); + } + if (entry.isExtended()) { final List<IBMPartitionTableEntry> exPartitions = - partitionTable.getExtendedPartitions(); - int j = 0; - for (IBMPartitionTableEntry exEntry : exPartitions) { - si = exEntry.getSystemIndicator(); - // FIXME ... this needs work + partitionTable.getExtendedPartitions(); + int j = 0; + for (IBMPartitionTableEntry exEntry : exPartitions) { + si = exEntry.getSystemIndicator(); + // FIXME ... this needs work out.println("ID " + i + " " + (exEntry.getBootIndicator() ? "Boot" : "No") + - " " + exEntry.getStartLba() + " " + "-----" + " " + "-----" + - " " + si); - j++; - } - } - i++; - } - } + " " + exEntry.getStartLba() + " " + "-----" + " " + "-----" + + " " + si); + j++; + } + } + i++; + } + } - private void listAvailableDevices(DeviceManager dm, PrintWriter out) { - final Collection<Device> allDevices = dm.getDevicesByAPI(BlockDeviceAPI.class); - for (Device dev : allDevices) { - out.println("Found device : " + dev.getId() + "[" + dev.getClass() + "]"); - if (dev instanceof IDEDevice) { - IDEDevice ideDevice = (IDEDevice) dev; - IDEDriveDescriptor desc = ideDevice.getDescriptor(); - if (desc.isDisk()) { + private void listAvailableDevices(DeviceManager dm, PrintWriter out) { + final Collection<Device> allDevices = dm.getDevicesByAPI(BlockDeviceAPI.class); + for (Device dev : allDevices) { + out.println("Found device : " + dev.getId() + "[" + dev.getClass() + "]"); + if (dev instanceof IDEDevice) { + IDEDevice ideDevice = (IDEDevice) dev; + IDEDriveDescriptor desc = ideDevice.getDescriptor(); + if (desc.isDisk()) { out.println(" IDE Disk : " + ideDevice.getId() + "(" + desc.getModel() + - " " + desc.getSectorsIn28bitAddressing() * IDEConstants.SECTOR_SIZE + - ")"); - } - } - } - } + " " + desc.getSectorsIn28bitAddressing() * IDEConstants.SECTOR_SIZE + + ")"); + } + } + } + } } Modified: trunk/fs/src/test/org/jnode/test/support/MockObjectFactory.java =================================================================== --- trunk/fs/src/test/org/jnode/test/support/MockObjectFactory.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/fs/src/test/org/jnode/test/support/MockObjectFactory.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.test.support; import javax.naming.NameAlreadyBoundException; @@ -68,7 +68,7 @@ final MockObjectTestCase mockTestCase = (MockObjectTestCase) testCase; MockInitializer initializer = new MockInitializer() { public void init(Mock mockDesc) { - BootLogInstance.get().debug("devSize=" + deviceSize); + BootLogInstance.get().debug("devSize=" + deviceSize); Boolean bSupp48bitsAddr = Boolean.valueOf(supp48bitsAddr); mockDesc.expects(mockTestCase.atLeastOnce()). method("supports48bitAddressing"). Modified: trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java =================================================================== --- trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/gui/src/awt/org/jnode/awt/util/BasicSurfaceGraphics.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.awt.util; import java.awt.Color; @@ -433,6 +433,7 @@ } } */ + /** * Draws as much of the specified image as is currently available. * The image is drawn with its top-left corner at @@ -1136,55 +1137,55 @@ } } } else { - // TODO implement special case of a custom ColorModel not based on jdk concrete classes - return raster; + // TODO implement special case of a custom ColorModel not based on jdk concrete classes + return raster; } - } else if (dst_model instanceof IndexColorModel) { - // remark : the VGA driver is using an IndexColorModel - - final Object srcElements = createArray(model); - final Object dstElements = createArray(dst_model); - - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++) { - // get and convert source pixel to rgb - raster.getDataElements(x, y, srcElements); - int rgb = model.getRGB(srcElements); - - // convert rgb to destination model - dst_model.getDataElements(rgb, dstElements); - - // set destination pixel - dst_raster.setDataElements(x, y, dstElements); - } - } + } else if (dst_model instanceof IndexColorModel) { + // remark : the VGA driver is using an IndexColorModel + + final Object srcElements = createArray(model); + final Object dstElements = createArray(dst_model); + + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + // get and convert source pixel to rgb + raster.getDataElements(x, y, srcElements); + int rgb = model.getRGB(srcElements); + + // convert rgb to destination model + dst_model.getDataElements(rgb, dstElements); + + // set destination pixel + dst_raster.setDataElements(x, y, dstElements); + } + } } return dst_raster; } - + private Object createArray(ColorModel model) { - final int transferType = model.getTransferType(); - final int size = model.getNumComponents(); - switch (transferType) { - case DataBuffer.TYPE_BYTE: - return new byte[size]; - - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_SHORT: - return new short[size]; - - case DataBuffer.TYPE_INT: - return new int[size]; - - case DataBuffer.TYPE_FLOAT: - return new float[size]; - - case DataBuffer.TYPE_DOUBLE: - return new double[size]; - - default: - throw new IllegalArgumentException("Unknown transfer type : " + transferType); - } + final int transferType = model.getTransferType(); + final int size = model.getNumComponents(); + switch (transferType) { + case DataBuffer.TYPE_BYTE: + return new byte[size]; + + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_SHORT: + return new short[size]; + + case DataBuffer.TYPE_INT: + return new int[size]; + + case DataBuffer.TYPE_FLOAT: + return new float[size]; + + case DataBuffer.TYPE_DOUBLE: + return new double[size]; + + default: + throw new IllegalArgumentException("Unknown transfer type : " + transferType); + } } } Modified: trunk/gui/src/driver/org/jnode/driver/video/vga/VGABitmapGraphics.java =================================================================== --- trunk/gui/src/driver/org/jnode/driver/video/vga/VGABitmapGraphics.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/gui/src/driver/org/jnode/driver/video/vga/VGABitmapGraphics.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.driver.video.vga; import java.awt.Rectangle; @@ -41,7 +41,7 @@ * @param bytesPerLine */ public VGABitmapGraphics(StandardVGA vga, StandardVGAIO vgaIO, int width, int height, - int offset, int bytesPerLine) { + int offset, int bytesPerLine) { super(vga.getVgaMem(), width, height, offset, bytesPerLine); this.vgaIO = vgaIO; } @@ -51,16 +51,16 @@ } protected void doDrawImage(Raster src, int srcX, int srcY, int dstX, int dstY, int width, - int height) { + int height) { vgaIO.setGRAF(1, 0); vgaIO.setGRAF(8, 0xFF); // round up the result of width/8 int pWidth = width >> 3; // (width >> 3) == (width / 8) if ((width & 7) != 0) { // (width & 7) == (width % 8) - pWidth++; + pWidth++; } - + final byte[] plane0 = new byte[pWidth]; final byte[] plane1 = new byte[pWidth]; final byte[] plane2 = new byte[pWidth]; @@ -71,7 +71,7 @@ src.getDataElements(srcX, srcY + row, width, 1, buf); for (int col = 0; col < width; col++) { final int bit = getBit(dstX + col); - final int pixel = buf[col]; + final int pixel = buf[col]; final int i = (col >> 3); if ((pixel & 0x01) != 0) { plane0[i] |= bit; @@ -117,8 +117,8 @@ } protected void doDrawImage(Raster src, int srcX, int srcY, int dstX, int dstY, int width, - int height, int bgColor) { - //TODO use bgColor parameter + int height, int bgColor) { + //TODO use bgColor parameter doDrawImage(src, srcX, srcY, dstX, dstY, width, height); } @@ -145,14 +145,14 @@ } protected void doDrawPixels(int x, int y, int count, int color, int mode) { - //TODO (do)DrawLine/(do)doDrawPixels appear to be duplicates at higher level => remove one - doDrawLine(x, y, count, color, mode); + //TODO (do)DrawLine/(do)doDrawPixels appear to be duplicates at higher level => remove one + doDrawLine(x, y, count, color, mode); } protected void doDrawAlphaRaster(Raster raster, int srcX, int srcY, int dstX, int dstY, - int width, int height, int color) { - //TODO should we support alpha with only a fixed set of 16 colors ? - doDrawImage(raster, srcX, srcY, dstX, dstY, width, height, color); + int width, int height, int color) { + //TODO should we support alpha with only a fixed set of 16 colors ? + doDrawImage(raster, srcX, srcY, dstX, dstY, width, height, color); } public int doGetPixel(int x, int y) { @@ -161,15 +161,15 @@ } public int[] doGetPixels(Rectangle r) { - final int[] result = new int[r.width * r.height]; - final int xmax = r.x + r.width; - final int ymax = r.y + r.height; - int i = 0; - for (int y = r.y; y < ymax; y++) { - for (int x = r.x; x < xmax; x++) { - result[i++] = doGetPixel(x, y); - } - } + final int[] result = new int[r.width * r.height]; + final int xmax = r.x + r.width; + final int ymax = r.y + r.height; + int i = 0; + for (int y = r.y; y < ymax; y++) { + for (int x = r.x; x < xmax; x++) { + result[i++] = doGetPixel(x, y); + } + } return result; } @@ -180,10 +180,10 @@ @Override protected int getOffset(int x, int y) { - return y * 80 + (x >> 3); + return y * 80 + (x >> 3); } - + private int getBit(int x) { - return 0x80 >> (x & 7); + return 0x80 >> (x & 7); } } Modified: trunk/gui/src/driver/org/jnode/driver/video/vga/VGADriver.java =================================================================== --- trunk/gui/src/driver/org/jnode/driver/video/vga/VGADriver.java 2010-12-27 18:41:44 UTC (rev 5759) +++ trunk/gui/src/driver/org/jnode/driver/video/vga/VGADriver.java 2010-12-27 18:44:14 UTC (rev 5760) @@ -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.driver.video.vga; import java.awt.image.DataBuffer; @@ -40,13 +40,13 @@ * @author epr */ public class VGADriver extends AbstractFrameBufferDriver implements VgaConstants { - private static final int NB_COLORS = 16; - + private static final int NB_COLORS = 16; + static final IndexColorModel COLOR_MODEL = new IndexColorModel(4, NB_COLORS, REDS, GREENS, BLUES) { // Typically overridden public SampleModel createCompatibleSampleModel(int w, int h) { // return new VGASampleModel(w, h); - return new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h, new int[] {0xFF}); + return new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h, new int[]{0xFF}); } /** @@ -70,7 +70,7 @@ * <li>Arrange the components in the output array</li> * <p/> * </ol> - * + * * @param rgb The color to be converted to dataElements. A pixel in sRGB * color space, encoded in default 0xAARRGGBB format, assumed * not alpha premultiplied. @@ -84,11 +84,11 @@ public Object getDataElements(int rgb, Object pixel) { final int r2 = (0x00FF0000 & rgb) >> 16; final int g2 = (0x0000FF00 & rgb) >> 8; - final int b2 = (0x000000FF & rgb); + final int b2 = (0x000000FF & rgb); final byte[] p = (pixel == null) ? new byte[1] : (byte[]) pixel; - + rgb = (0x00FFFFFF & rgb); // remove alpha component - + int min_i = 0; int min_rgb = Integer.MAX_VALUE; for (int i = 0; i < NB_COLORS; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits