You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
| 2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
| 2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
| 2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
| 2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ga...@us...> - 2011-12-12 16:09:54
|
Revision: 5876
http://jnode.svn.sourceforge.net/jnode/?rev=5876&view=rev
Author: galatnm
Date: 2011-12-12 16:09:48 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
FS : improve test for IDEDriveDescriptor.
Modified Paths:
--------------
trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
Modified: trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java 2011-12-12 15:10:06 UTC (rev 5875)
+++ trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java 2011-12-12 16:09:48 UTC (rev 5876)
@@ -8,6 +8,7 @@
public class IDEDriveDescriptorTest {
// The ide descriptor.
private IDEDriveDescriptor ideDescriptor;
+ private IDEDriveDescriptor cdromIdeDescriptor;
// IDE Descriptor datas obtain from command 'hdparm --Istdout /dev/sda' on a linux machine.
private int[] ide = new int[] { 0x0c5a, 0x3fff, 0xc837, 0x0010, 0x0000,
0x0000, 0x003f, 0x0000, 0x0000, 0x0000, 0x2020, 0x2020, 0x2020,
@@ -42,10 +43,45 @@
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x8aa5 };
+
+ private int[] cdrom = new int[]{0x8580,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x2020,0x2020,0x2020,0x2020,0x2020,0x2020,
+ 0x2020,0x2020,0x2020,0x2020,0x0000,0x0000,0x0000,0x3130,
+ 0x3543,0x2020,0x2020,0x5f4e,0x4543,0x2044,0x5644,0x2b2f,
+ 0x2d52,0x5720,0x4e44,0x2d33,0x3635,0x3041,0x2020,0x2020,
+ 0x2020,0x2020,0x2020,0x2020,0x2020,0x2020,0x2020,0x0000,
+ 0x0000,0x0b00,0x0000,0x0200,0x0200,0x0006,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0007,
+ 0x0003,0x0078,0x0078,0x0078,0x0078,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0602,0x0000,0x0000,0x0000,
+ 0x0080,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0407,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};
+
@Before
public void setUp(){
ideDescriptor = new IDEDriveDescriptor(ide, true);
+ cdromIdeDescriptor = new IDEDriveDescriptor(cdrom, true);
}
@Test(expected = IllegalArgumentException.class)
@@ -79,6 +115,36 @@
assertEquals(312500000,result);
}
+ @Test
+ public void testSupports48bitAddressing() {
+ boolean result = ideDescriptor.supports48bitAddressing();
+ assertTrue("Must support 48bits addressing",result);
+ }
+ @Test
+ public void testSupportsLBA() {
+ boolean result = ideDescriptor.supportsLBA();
+ assertTrue("Must support LBA",result);
+ }
+
+ @Test
+ public void testDMA() {
+ boolean result = ideDescriptor.supportsDMA();
+ assertTrue("Must support DMA",result);
+ }
+
+ @Test
+ public void testIsATA() {
+ boolean result = ideDescriptor.isAta();
+ assertTrue("Must be ATA drive",result);
+ }
+
+ @Test
+ public void testIsRemovable() {
+ boolean result = ideDescriptor.isRemovable();
+ assertFalse("Must not be a removable device",result);
+ result = cdromIdeDescriptor.isRemovable();
+ assertTrue("Must be a removable device",result);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-12 15:10:17
|
Revision: 5875
http://jnode.svn.sourceforge.net/jnode/?rev=5875&view=rev
Author: galatnm
Date: 2011-12-12 15:10:06 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
FS : Fix typo on the code, use '+' instead of '*'.
Modified Paths:
--------------
trunk/fs/src/driver/org/jnode/driver/bus/ide/IDEDriveDescriptor.java
trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
Modified: trunk/fs/src/driver/org/jnode/driver/bus/ide/IDEDriveDescriptor.java
===================================================================
--- trunk/fs/src/driver/org/jnode/driver/bus/ide/IDEDriveDescriptor.java 2011-12-12 15:01:46 UTC (rev 5874)
+++ trunk/fs/src/driver/org/jnode/driver/bus/ide/IDEDriveDescriptor.java 2011-12-12 15:10:06 UTC (rev 5875)
@@ -57,7 +57,7 @@
char[] str = new char[20];
for (int i = 0; i < 10; i++) {
int v = data[10 + i];
- str[i + 2 + 0] = (char) ((v >> 8) & 0xFF);
+ str[i * 2] = (char) ((v >> 8) & 0xFF);
str[i * 2 + 1] = (char) (v & 0xFF);
}
return String.valueOf(str).trim();
@@ -72,7 +72,7 @@
char[] str = new char[8];
for (int i = 0; i < 4; i++) {
int v = data[23 + i];
- str[i + 2 + 0] = (char) ((v >> 8) & 0xFF);
+ str[i * 2] = (char) ((v >> 8) & 0xFF);
str[i * 2 + 1] = (char) (v & 0xFF);
}
return String.valueOf(str).trim();
@@ -87,7 +87,7 @@
char[] str = new char[40];
for (int i = 0; i < 20; i++) {
int v = data[27 + i];
- str[i * 2 + 0] = (char) ((v >> 8) & 0xFF);
+ str[i * 2] = (char) ((v >> 8) & 0xFF);
str[i * 2 + 1] = (char) (v & 0xFF);
}
return String.valueOf(str).trim();
Modified: trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java 2011-12-12 15:01:46 UTC (rev 5874)
+++ trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java 2011-12-12 15:10:06 UTC (rev 5875)
@@ -54,7 +54,7 @@
IDEDriveDescriptor wrongIdeDescriptor = new IDEDriveDescriptor(data, true);
}
- //@Test TODO return value is incorrect
+ @Test
public void testGetSerialNumber() {
String result = ideDescriptor.getSerialNumber();
assertEquals("5LS9K7CF",result);
@@ -66,7 +66,7 @@
assertEquals("ST3160812AS",result);
}
- //@Test TODO return value is incorrect
+ @Test
public void testGetFirmware() {
String result = ideDescriptor.getFirmware();
assertEquals("3.ADJ",result);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-12 15:01:52
|
Revision: 5874
http://jnode.svn.sourceforge.net/jnode/?rev=5874&view=rev
Author: galatnm
Date: 2011-12-12 15:01:46 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
FS : Add unit test for IDE drive descriptor.
Added Paths:
-----------
trunk/fs/src/test/org/jnode/driver/
trunk/fs/src/test/org/jnode/driver/bus/
trunk/fs/src/test/org/jnode/driver/bus/ide/
trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
Added: trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java (rev 0)
+++ trunk/fs/src/test/org/jnode/driver/bus/ide/IDEDriveDescriptorTest.java 2011-12-12 15:01:46 UTC (rev 5874)
@@ -0,0 +1,84 @@
+package org.jnode.driver.bus.ide;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class IDEDriveDescriptorTest {
+ // The ide descriptor.
+ private IDEDriveDescriptor ideDescriptor;
+ // IDE Descriptor datas obtain from command 'hdparm --Istdout /dev/sda' on a linux machine.
+ private int[] ide = new int[] { 0x0c5a, 0x3fff, 0xc837, 0x0010, 0x0000,
+ 0x0000, 0x003f, 0x0000, 0x0000, 0x0000, 0x2020, 0x2020, 0x2020,
+ 0x2020, 0x2020, 0x2020, 0x354c, 0x5339, 0x4b37, 0x4346, 0x0000,
+ 0x4000, 0x0004, 0x332e, 0x4144, 0x4a20, 0x2020, 0x5354, 0x3331,
+ 0x3630, 0x3831, 0x3241, 0x5320, 0x2020, 0x2020, 0x2020, 0x2020,
+ 0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020,
+ 0x2020, 0x2020, 0x8010, 0x0000, 0x2f00, 0x4000, 0x0200, 0x0200,
+ 0x0007, 0x3fff, 0x0010, 0x003f, 0xfc10, 0x00fb, 0x0108, 0xffff,
+ 0x0fff, 0x0000, 0x0007, 0x0003, 0x0078, 0x0078, 0x00f0, 0x0078,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001f, 0x0506,
+ 0x0000, 0x0040, 0x0040, 0x00fe, 0x0000, 0x346b, 0x7701, 0x4023,
+ 0x3469, 0x3401, 0x4023, 0x407f, 0x0000, 0x0000, 0xfefe, 0xfffe,
+ 0x0000, 0xd000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f20,
+ 0x12a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0009, 0x5f20, 0x12a0, 0x5f20, 0x12a0,
+ 0x2020, 0x0002, 0x02b6, 0x0002, 0x008a, 0x3c06, 0x3c0a, 0x0000,
+ 0x07c6, 0x0100, 0x0800, 0x1314, 0x1200, 0x0002, 0x0080, 0x0000,
+ 0x0000, 0x00a0, 0x0202, 0x0000, 0x0404, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0c00, 0x000b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x8aa5 };
+
+ @Before
+ public void setUp(){
+ ideDescriptor = new IDEDriveDescriptor(ide, true);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testConstructorDataWrongLength() {
+ int[] data = new int[125];
+ IDEDriveDescriptor wrongIdeDescriptor = new IDEDriveDescriptor(data, true);
+ }
+
+ //@Test TODO return value is incorrect
+ public void testGetSerialNumber() {
+ String result = ideDescriptor.getSerialNumber();
+ assertEquals("5LS9K7CF",result);
+ }
+
+ @Test
+ public void testGetModel() {
+ String result = ideDescriptor.getModel();
+ assertEquals("ST3160812AS",result);
+ }
+
+ //@Test TODO return value is incorrect
+ public void testGetFirmware() {
+ String result = ideDescriptor.getFirmware();
+ assertEquals("3.ADJ",result);
+ }
+
+ @Test
+ public void testGetSectorsAddressable() {
+ long result = ideDescriptor.getSectorsAddressable();
+ //Get actually the LBA48 user addressable sectors
+ assertEquals(312500000,result);
+ }
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-09 15:54:15
|
Revision: 5873
http://jnode.svn.sourceforge.net/jnode/?rev=5873&view=rev
Author: galatnm
Date: 2011-12-09 15:54:09 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Fix javadoc.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/jfat/command/MBRFormatter.java
trunk/fs/src/fs/org/jnode/fs/jfat/command/Stage1_5.java
trunk/fs/src/fs/org/jnode/fs/service/def/FSEntryCache.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileHandleImpl.java
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/command/MBRFormatter.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/command/MBRFormatter.java 2011-12-09 15:48:02 UTC (rev 5872)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/command/MBRFormatter.java 2011-12-09 15:54:09 UTC (rev 5873)
@@ -73,10 +73,8 @@
/**
*
- * @param device
- * @param bsize
- * @throws FileSystemException
- * @throws IOException
+ * @param devApi
+ * @throws GrubException
*/
public void format(BlockDeviceAPI devApi) throws GrubException {
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/command/Stage1_5.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/command/Stage1_5.java 2011-12-09 15:48:02 UTC (rev 5872)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/command/Stage1_5.java 2011-12-09 15:54:09 UTC (rev 5873)
@@ -193,7 +193,7 @@
*
* @arch i386
* @param stage1_5
- * @param installPartition2
+ * @param installPartition
*/
private void setLittleEnd_InstallPartition(byte[] stage1_5, int installPartition) {
LittleEndian.setInt32(stage1_5, 512 + 0x08, installPartition);
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FSEntryCache.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FSEntryCache.java 2011-12-09 15:48:02 UTC (rev 5872)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FSEntryCache.java 2011-12-09 15:54:09 UTC (rev 5873)
@@ -44,7 +44,6 @@
/**
* Create a new instance
*
- * @param fsm
*/
public FSEntryCache() {
}
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileHandleImpl.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FileHandleImpl.java 2011-12-09 15:48:02 UTC (rev 5872)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FileHandleImpl.java 2011-12-09 15:54:09 UTC (rev 5873)
@@ -142,8 +142,6 @@
* stored in <code>dest</code> starting at offset <code>ofs</code>.
*
* @param dest
- * @param off
- * @param len
* @throws IOException
*/
public synchronized int read(ByteBuffer dest) throws IOException {
@@ -171,8 +169,6 @@
* to this file starting at offset <code>fileOffset</code>.
*
* @param src
- * @param off
- * @param len
* @throws IOException
*/
// public synchronized void write(byte[] src, int off, int len) throws
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-09 15:48:08
|
Revision: 5872
http://jnode.svn.sourceforge.net/jnode/?rev=5872&view=rev
Author: galatnm
Date: 2011-12-09 15:48:02 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Fix doc and method name.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/ntfs/CompressedDataRun.java
Modified: trunk/fs/src/fs/org/jnode/fs/ntfs/CompressedDataRun.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ntfs/CompressedDataRun.java 2011-12-09 15:38:49 UTC (rev 5871)
+++ trunk/fs/src/fs/org/jnode/fs/ntfs/CompressedDataRun.java 2011-12-09 15:48:02 UTC (rev 5872)
@@ -127,7 +127,7 @@
final byte[] tempUncompressed = new byte[compressionUnitSize * clusterSize];
// XXX: We could potentially reduce the overhead by modifying the compression
// routine such that it's capable of skipping chunks that aren't needed.
- uncompressUnit(tempCompressed, tempUncompressed);
+ unCompressUnit(tempCompressed, tempUncompressed);
System.arraycopy(tempUncompressed, vcnOffsetWithinUnit * clusterSize,
dst, dstOffset + (int) (actFirstVcn - vcn) * clusterSize,
@@ -141,10 +141,9 @@
*
* @param compressed the compressed data (in.)
* @param uncompressed the uncompressed data (out.)
- * @param requiredBytes the number of bytes needed before the read can stop.
* @throws IOException if the decompression fails.
*/
- private static void uncompressUnit(final byte[] compressed,
+ private static void unCompressUnit(final byte[] compressed,
final byte[] uncompressed) throws IOException {
// This is just a convenient way to simulate the original code's pointer arithmetic.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-09 15:38:55
|
Revision: 5871
http://jnode.svn.sourceforge.net/jnode/?rev=5871&view=rev
Author: galatnm
Date: 2011-12-09 15:38:49 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Remove unecessary semicolon.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java
Modified: trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java 2011-12-01 15:57:12 UTC (rev 5870)
+++ trunk/fs/src/fs/org/jnode/fs/jifs/command/CreateJIFSCommand.java 2011-12-09 15:38:49 UTC (rev 5871)
@@ -40,7 +40,7 @@
public class CreateJIFSCommand extends AbstractCommand {
private static enum Action {
- start, stop, restart;
+ start, stop, restart
}
private static class ActionArgument extends EnumArgument<Action> {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-12-01 15:57:19
|
Revision: 5870
http://jnode.svn.sourceforge.net/jnode/?rev=5870&view=rev
Author: galatnm
Date: 2011-12-01 15:57:12 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
Fix and unit test for catalog key bugs.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java
trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java
Added Paths:
-----------
trunk/fs/src/test/org/jnode/fs/hfsplus/HfsUnicodeStringTest.java
trunk/fs/src/test/org/jnode/fs/hfsplus/catalog/
trunk/fs/src/test/org/jnode/fs/hfsplus/catalog/CatalogKeyTest.java
Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java 2011-11-30 20:48:58 UTC (rev 5869)
+++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsUnicodeString.java 2011-12-01 15:57:12 UTC (rev 5870)
@@ -31,6 +31,7 @@
/**
* Create HFSUnicodeString from existing data.
*
+ *
* @param src byte array contains data.
* @param offset start of data in the array.
*/
Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-11-30 20:48:58 UTC (rev 5869)
+++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-12-01 15:57:12 UTC (rev 5870)
@@ -49,7 +49,7 @@
int currentOffset = offset;
byte[] ck = new byte[2];
System.arraycopy(src, currentOffset, ck, 0, 2);
- keyLength = BigEndian.getInt16(ck, 0) + 2; // Key length doesn't seem to include itself in the size
+ keyLength = BigEndian.getInt16(ck, 0);
currentOffset += 2;
ck = new byte[4];
System.arraycopy(src, currentOffset, ck, 0, 4);
@@ -71,7 +71,7 @@
public CatalogKey(final CatalogNodeId parentID, final HfsUnicodeString name) {
this.parentId = parentID;
this.nodeName = name;
- this.keyLength = MINIMUM_KEY_LENGTH + name.getLength();
+ this.keyLength = MINIMUM_KEY_LENGTH + (name.getLength() * 2) + 2;
}
public final CatalogNodeId getParentId() {
@@ -109,10 +109,11 @@
* @see org.jnode.fs.hfsplus.tree.AbstractKey#getBytes()
*/
public byte[] getBytes() {
- byte[] data = new byte[this.getKeyLength()];
- BigEndian.setInt16(data, 0, this.getKeyLength());
+ int length = this.getKeyLength();
+ byte[] data = new byte[length];
+ BigEndian.setInt16(data, 0, length);
System.arraycopy(parentId.getBytes(), 0, data, 2, 4);
- System.arraycopy(nodeName.getBytes(), 0, data, 6, nodeName.getLength());
+ System.arraycopy(nodeName.getBytes(), 0, data, 6, (nodeName.getLength() *2) + 2);
return data;
}
Added: trunk/fs/src/test/org/jnode/fs/hfsplus/HfsUnicodeStringTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/fs/hfsplus/HfsUnicodeStringTest.java (rev 0)
+++ trunk/fs/src/test/org/jnode/fs/hfsplus/HfsUnicodeStringTest.java 2011-12-01 15:57:12 UTC (rev 5870)
@@ -0,0 +1,30 @@
+package org.jnode.fs.hfsplus;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class HfsUnicodeStringTest {
+ private byte[] STRING_AS_BYTES_ARRAY = new byte[]{0, 8, 0, 116, 0, 101, 0, 115, 0, 116, 0, 46, 0, 116, 0, 120, 0, 116};
+ private String STRING_AS_TEXT = "test.txt";
+
+ @Test
+ public void testConstructAsBytesArray() {
+ HfsUnicodeString string = new HfsUnicodeString(STRING_AS_BYTES_ARRAY,0);
+ assertEquals(8,string.getLength());
+ assertEquals(STRING_AS_TEXT,string.getUnicodeString());
+ }
+
+ @Test
+ public void testConstructAsString() {
+ HfsUnicodeString string = new HfsUnicodeString(STRING_AS_TEXT);
+ assertEquals(8,string.getLength());
+ byte[] array = string.getBytes();
+ int index = 0;
+ for (byte b : array) {
+ assertEquals(STRING_AS_BYTES_ARRAY[index],b);
+ index++;
+ }
+ }
+
+}
Added: trunk/fs/src/test/org/jnode/fs/hfsplus/catalog/CatalogKeyTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/fs/hfsplus/catalog/CatalogKeyTest.java (rev 0)
+++ trunk/fs/src/test/org/jnode/fs/hfsplus/catalog/CatalogKeyTest.java 2011-12-01 15:57:12 UTC (rev 5870)
@@ -0,0 +1,42 @@
+package org.jnode.fs.hfsplus.catalog;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jnode.fs.hfsplus.HfsUnicodeString;
+import org.junit.Test;
+
+public class CatalogKeyTest {
+ byte[] KEY_AS_BYTES_ARRAY = new byte[]{0,24,0,0,0,7,0, 8, 0, 116, 0, 101, 0, 115, 0, 116, 0, 46, 0, 116, 0, 120, 0, 116};
+ String NODE_NAME_AS_STRING = "test.txt";
+
+ @Test
+ public void testKeyFromBytesArray(){
+ CatalogKey key = new CatalogKey(KEY_AS_BYTES_ARRAY,0);
+ assertEquals(NODE_NAME_AS_STRING,key.getNodeName().getUnicodeString());
+ assertEquals(24,key.getKeyLength());
+ assertEquals(7,key.getParentId().getId());
+ }
+
+ @Test
+ public void testConstructFromCNIDAndString() {
+ CatalogNodeId id = CatalogNodeId.HFSPLUS_START_CNID;
+ HfsUnicodeString string = new HfsUnicodeString(NODE_NAME_AS_STRING);
+ CatalogKey key = new CatalogKey(id,string);
+ assertEquals(NODE_NAME_AS_STRING,key.getNodeName().getUnicodeString());
+ assertEquals(24,key.getKeyLength());
+ assertEquals(7,key.getParentId().getId());
+
+ }
+
+ @Test
+ public void testConstructFromCNIDAndEmptyString() {
+ CatalogNodeId id = CatalogNodeId.HFSPLUS_START_CNID;
+ HfsUnicodeString string = new HfsUnicodeString("");
+ CatalogKey key = new CatalogKey(id,string);
+ assertEquals("",key.getNodeName().getUnicodeString());
+ assertEquals(8,key.getKeyLength());
+ assertEquals(7,key.getParentId().getId());
+
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-11-30 20:49:04
|
Revision: 5869
http://jnode.svn.sourceforge.net/jnode/?rev=5869&view=rev
Author: galatnm
Date: 2011-11-30 20:48:58 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Fix HFS+ catalog key from luke.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java
Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-11-30 20:48:12 UTC (rev 5868)
+++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-11-30 20:48:58 UTC (rev 5869)
@@ -44,11 +44,12 @@
* @param src
* @param offset
*/
+
public CatalogKey(final byte[] src, final int offset) {
int currentOffset = offset;
byte[] ck = new byte[2];
System.arraycopy(src, currentOffset, ck, 0, 2);
- keyLength = BigEndian.getInt16(ck, 0);
+ keyLength = BigEndian.getInt16(ck, 0) + 2; // Key length doesn't seem to include itself in the size
currentOffset += 2;
ck = new byte[4];
System.arraycopy(src, currentOffset, ck, 0, 4);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-11-30 20:48:18
|
Revision: 5868
http://jnode.svn.sourceforge.net/jnode/?rev=5868&view=rev
Author: galatnm
Date: 2011-11-30 20:48:12 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Clean up HFS+
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/Catalog.java
trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogLeafNode.java
Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/Catalog.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/Catalog.java 2011-10-25 14:21:29 UTC (rev 5867)
+++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/Catalog.java 2011-11-30 20:48:12 UTC (rev 5868)
@@ -249,9 +249,10 @@
int nodeSize = getBTHeaderRecord().getNodeSize();
ByteBuffer nodeData = ByteBuffer.allocate(nodeSize);
fs.getApi().read(catalogHeaderNodeOffset + (currentNodeNumber * nodeSize), nodeData);
- NodeDescriptor nd = new NodeDescriptor(nodeData.array(), 0);
+ byte[] datas = nodeData.array();
+ NodeDescriptor nd = new NodeDescriptor(datas, 0);
if (nd.isIndexNode()) {
- CatalogIndexNode node = new CatalogIndexNode(nodeData.array(), nodeSize);
+ CatalogIndexNode node = new CatalogIndexNode(datas, nodeSize);
IndexRecord[] records = (IndexRecord[]) node.findAll(parentID);
List<LeafRecord> lfList = new LinkedList<LeafRecord>();
for (IndexRecord rec : records) {
@@ -291,7 +292,7 @@
CatalogKey cKey = new CatalogKey(parentID, nodeName);
while (nd.isIndexNode()) {
CatalogIndexNode node = new CatalogIndexNode(nodeData.array(), nodeSize);
- IndexRecord record = (IndexRecord) node.find(cKey);
+ IndexRecord record = node.find(cKey);
currentNodeNumber = record.getIndex();
currentOffset = catalogHeaderNodeOffset + record.getIndex() * nodeSize;
nodeData = ByteBuffer.allocate(nodeSize);
@@ -301,7 +302,7 @@
LeafRecord lr = null;
if (nd.isLeafNode()) {
CatalogLeafNode node = new CatalogLeafNode(nodeData.array(), nodeSize);
- lr = (LeafRecord) node.find(parentID);
+ lr = node.find(parentID);
}
return lr;
}
Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogLeafNode.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogLeafNode.java 2011-10-25 14:21:29 UTC (rev 5867)
+++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogLeafNode.java 2011-11-30 20:48:12 UTC (rev 5868)
@@ -3,77 +3,78 @@
import java.util.LinkedList;
import java.util.List;
+import org.apache.log4j.Logger;
import org.jnode.fs.hfsplus.tree.AbstractNode;
-import org.jnode.fs.hfsplus.tree.Key;
import org.jnode.fs.hfsplus.tree.LeafRecord;
import org.jnode.fs.hfsplus.tree.NodeDescriptor;
-import org.jnode.fs.hfsplus.tree.NodeRecord;
public class CatalogLeafNode extends AbstractNode<LeafRecord> {
- /**
- * Create a new node.
- *
- * @param descriptor
- * @param nodeSize
- */
- public CatalogLeafNode(NodeDescriptor descriptor, final int nodeSize) {
- super(descriptor, nodeSize);
- }
- /**
- * Create node from existing data.
- *
- * @param nodeData
- * @param nodeSize
- */
- public CatalogLeafNode(final byte[] nodeData, final int nodeSize) {
- super(nodeData, nodeSize);
+ private final Logger log = Logger.getLogger(getClass());
- }
+ /**
+ * Create a new node.
+ *
+ * @param descriptor
+ * @param nodeSize
+ */
+ public CatalogLeafNode(NodeDescriptor descriptor, final int nodeSize) {
+ super(descriptor, nodeSize);
+ }
- @Override
- protected void loadRecords(byte[] nodeData) {
- CatalogKey key;
- int offset;
- for (int i = 0; i < this.descriptor.getNumRecords(); i++) {
- offset = offsets.get(i);
- key = new CatalogKey(nodeData, offset);
- int recordSize = offsets.get(i + 1) - offset;
- records.add(new LeafRecord(key, nodeData, offset, recordSize));
- }
- }
+ /**
+ * Create node from existing data.
+ *
+ * @param nodeData
+ * @param nodeSize
+ */
+ public CatalogLeafNode(final byte[] nodeData, final int nodeSize) {
+ super(nodeData, nodeSize);
- /**
- * @param parentId
- * @return a NodeRecord or {@code null}
- */
- public final LeafRecord find(final CatalogNodeId parentId) {
- for (LeafRecord record : records) {
- Key key = record.getKey();
- if (key instanceof CatalogKey) {
- if (((CatalogKey) key).getParentId().getId() == parentId.getId()) {
- return record;
- }
- }
- }
- return null;
- }
+ }
- /**
- * @param parentId
- * @return an array of NodeRecords
- */
- public final LeafRecord[] findAll(final CatalogNodeId parentId) {
- List<NodeRecord> list = new LinkedList<NodeRecord>();
- for (int index = 0; index < this.getNodeDescriptor().getNumRecords(); index++) {
- NodeRecord record = this.getNodeRecord(index);
- Key key = record.getKey();
- if (key instanceof CatalogKey &&
- ((CatalogKey) key).getParentId().getId() == parentId.getId()) {
- list.add(record);
- }
- }
- return list.toArray(new LeafRecord[list.size()]);
- }
+ @Override
+ protected void loadRecords(byte[] nodeData) {
+ CatalogKey key;
+ int offset;
+ for (int i = 0; i < this.descriptor.getNumRecords(); i++) {
+ offset = offsets.get(i);
+ key = new CatalogKey(nodeData, offset);
+ int recordSize = offsets.get(i + 1) - offset;
+ records.add(new LeafRecord(key, nodeData, offset, recordSize));
+ }
+ }
+ /**
+ * @param parentId
+ * @return a NodeRecord or {@code null}
+ */
+ public final LeafRecord find(final CatalogNodeId parentId) {
+ for (LeafRecord record : records) {
+ log.debug("Record : " + record.toString() + " Parent ID : " + parentId.getId());
+ CatalogKey key = (CatalogKey) record.getKey();
+ if (key.getParentId().getId() == parentId.getId()) {
+ return record;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param parentId
+ * @return an array of NodeRecords
+ */
+ public final LeafRecord[] findAll(final CatalogNodeId parentId) {
+ List<LeafRecord> list = new LinkedList<LeafRecord>();
+ for (int index = 0; index < this.getNodeDescriptor().getNumRecords(); index++) {
+ LeafRecord record = this.getNodeRecord(index);
+ log.debug("Record : " + record.toString() + " Parent ID : " + parentId.getId());
+ CatalogKey key = (CatalogKey) record.getKey();
+ if (key.getParentId().getId() == parentId.getId()) {
+ list.add(record);
+ }
+ }
+ return list.toArray(new LeafRecord[list.size()]);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-10-25 14:21:38
|
Revision: 5867
http://jnode.svn.sourceforge.net/jnode/?rev=5867&view=rev
Author: galatnm
Date: 2011-10-25 14:21:29 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
Add some tests on partition table entry implementation.
Added Paths:
-----------
trunk/fs/src/test/org/jnode/partitions/
trunk/fs/src/test/org/jnode/partitions/ibm/
trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java
Added: trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java
===================================================================
--- trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java (rev 0)
+++ trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java 2011-10-25 14:21:29 UTC (rev 5867)
@@ -0,0 +1,55 @@
+package org.jnode.partitions.ibm;
+
+import static org.junit.Assert.*;
+
+import org.jnode.util.LittleEndian;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IBMPartitionTableEntryTest {
+
+ @Test
+ public void testhasChildPartitionTable(){
+ byte[] bootSector = getBootSector();
+ LittleEndian.setInt8(bootSector, 450, 0x85);
+ IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0);
+ assertTrue(pte.hasChildPartitionTable());
+ }
+
+ @Test
+ public void testhasNoChildPartitionTable(){
+ byte[] bootSector = getBootSector();
+ LittleEndian.setInt8(bootSector, 450, 0x84);
+ IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0);
+ assertFalse(pte.hasChildPartitionTable());
+ }
+
+ @Test
+ public void testIsValid() {
+ byte[] bootSector = getBootSector();
+ LittleEndian.setInt8(bootSector, 450, 0x85);
+ IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0);
+ assertTrue(pte.isValid());
+ }
+
+ @Test
+ public void testIsNotValidEmptyBootSector() {
+ IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,getBootSector(),0);
+ assertFalse(pte.isValid());
+ }
+
+ @Test
+ public void testIsEmpty() {
+ IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,getBootSector(),0);
+ assertTrue(pte.isEmpty());
+ }
+
+ private byte[] getBootSector(){
+ byte[] bs = new byte[500];
+ for (int i = 0; i < bs.length; i++) {
+ bs[i] = 0;
+ }
+ return bs;
+ }
+
+}
Property changes on: trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-10-25 09:23:09
|
Revision: 5866
http://jnode.svn.sourceforge.net/jnode/?rev=5866&view=rev
Author: galatnm
Date: 2011-10-25 09:23:03 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
Add mockito (mocking library)
Added Paths:
-----------
trunk/core/lib/mockito-all-1.8.5.jar
Added: trunk/core/lib/mockito-all-1.8.5.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/lib/mockito-all-1.8.5.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-10-20 06:47:53
|
Revision: 5865
http://jnode.svn.sourceforge.net/jnode/?rev=5865&view=rev
Author: galatnm
Date: 2011-10-20 06:47:47 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/DeviceUtils.java
Modified: trunk/core/src/driver/org/jnode/driver/DeviceUtils.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/DeviceUtils.java 2011-10-19 12:28:40 UTC (rev 5864)
+++ trunk/core/src/driver/org/jnode/driver/DeviceUtils.java 2011-10-20 06:47:47 UTC (rev 5865)
@@ -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;
import java.util.Collection;
@@ -27,39 +27,37 @@
/**
* Class with utility methods for the device framework.
- *
+ *
* @author Ewout Prangsma (ep...@us...)
*/
public class DeviceUtils {
/**
- * Cached devicemanager reference
+ * Cached device manager reference
*/
- private static DeviceManager dm;
+ private static DeviceManager deviceManager;
/**
* Gets the device manager
- *
+ *
* @return The device manager
* @throws NameNotFoundException
*/
- public static DeviceManager getDeviceManager()
- throws NameNotFoundException {
- if (dm == null) {
- dm = InitialNaming.lookup(DeviceManager.NAME);
+ public static DeviceManager getDeviceManager() throws NameNotFoundException {
+ if (deviceManager == null) {
+ deviceManager = InitialNaming.lookup(DeviceManager.NAME);
}
- return dm;
+ return deviceManager;
}
/**
* Gets a device by name
- *
+ *
* @param deviceID
* @return The device
* @throws DeviceNotFoundException
*/
- public static Device getDevice(String deviceID)
- throws DeviceNotFoundException {
+ public static Device getDevice(final String deviceID) throws DeviceNotFoundException {
try {
return getDeviceManager().getDevice(deviceID);
} catch (NameNotFoundException ex) {
@@ -69,14 +67,14 @@
/**
* Gets a specific API from a device.
- *
+ *
* @param deviceID the ame of the requested device
- * @param api the API class to use
+ * @param api the API class to use
* @return The api implementation
* @throws DeviceNotFoundException
* @throws ApiNotFoundException
*/
- public static <T extends DeviceAPI> T getAPI(String deviceID, Class<T> api)
+ public static <T extends DeviceAPI> T getAPI(final String deviceID, final Class<T> api)
throws DeviceNotFoundException, ApiNotFoundException {
try {
return getDeviceManager().getDevice(deviceID).getAPI(api);
@@ -85,20 +83,21 @@
}
}
-
/**
* Returns a collection of all known devices that implement the given api..
- * The collection is not modifiable, but the underlying collection
- * can change, so be aware of exceptions in iterators.
- *
+ * The collection is not modifiable, but the underlying collection can
+ * change, so be aware of exceptions in iterators.
+ *
* @param apiClass
* @return All known devices the implement the given api.
*/
- public static Collection<Device> getDevicesByAPI(Class<? extends DeviceAPI> apiClass) {
+ public static Collection<Device> getDevicesByAPI(final Class<? extends DeviceAPI> apiClass) {
+ Collection<Device> deviceList;
try {
- return getDeviceManager().getDevicesByAPI(apiClass);
+ deviceList = getDeviceManager().getDevicesByAPI(apiClass);
} catch (NameNotFoundException ex) {
- return Collections.emptyList();
+ deviceList = Collections.emptyList();
}
+ return deviceList;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ga...@us...> - 2011-10-19 12:28:51
|
Revision: 5864
http://jnode.svn.sourceforge.net/jnode/?rev=5864&view=rev
Author: galatnm
Date: 2011-10-19 12:28:40 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
FS : Convert Context class to an interface
Modified Paths:
--------------
trunk/fs/src/test/org/jnode/test/fs/driver/BlockDeviceAPIContext.java
trunk/fs/src/test/org/jnode/test/fs/filesystem/FSContext.java
trunk/fs/src/test/org/jnode/test/support/Context.java
Modified: trunk/fs/src/test/org/jnode/test/fs/driver/BlockDeviceAPIContext.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/fs/driver/BlockDeviceAPIContext.java 2011-08-24 18:28:32 UTC (rev 5863)
+++ trunk/fs/src/test/org/jnode/test/fs/driver/BlockDeviceAPIContext.java 2011-10-19 12:28:40 UTC (rev 5864)
@@ -37,7 +37,8 @@
import org.jnode.test.support.Context;
import org.jnode.test.support.TestConfig;
-public abstract class BlockDeviceAPIContext extends Context {
+public class BlockDeviceAPIContext implements Context {
+
protected static final Logger log = Logger
.getLogger(BlockDeviceAPIContext.class);
Modified: trunk/fs/src/test/org/jnode/test/fs/filesystem/FSContext.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/fs/filesystem/FSContext.java 2011-08-24 18:28:32 UTC (rev 5863)
+++ trunk/fs/src/test/org/jnode/test/fs/filesystem/FSContext.java 2011-10-19 12:28:40 UTC (rev 5864)
@@ -27,8 +27,10 @@
import org.jnode.test.support.Context;
import org.jnode.test.support.TestConfig;
-public class FSContext extends Context {
+public class FSContext implements Context {
+
private Device workDevice;
+
private DeviceParam deviceParam;
public void init(TestConfig config, MockObjectTestCase testCase) throws Exception {
Modified: trunk/fs/src/test/org/jnode/test/support/Context.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/support/Context.java 2011-08-24 18:28:32 UTC (rev 5863)
+++ trunk/fs/src/test/org/jnode/test/support/Context.java 2011-10-19 12:28:40 UTC (rev 5864)
@@ -22,7 +22,8 @@
import org.jmock.MockObjectTestCase;
-public abstract class Context {
+public abstract interface Context {
+
public abstract void init(TestConfig config, MockObjectTestCase testCase) throws Exception;
public abstract void destroy() throws Exception;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:28:38
|
Revision: 5863
http://jnode.svn.sourceforge.net/jnode/?rev=5863&view=rev
Author: fduminy
Date: 2011-08-24 18:28:32 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
added summary for the object list
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:28:04 UTC (rev 5862)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:28:32 UTC (rev 5863)
@@ -43,6 +43,9 @@
private static final char NEWLINE = '\n';
private static final String USAGE = " memory usage=";
private static final String NO_MATCHING_OBJECT = "No object is matching criteria";
+ private static final String SUMMARY = "Summary : ";
+ private static final String CLASSES = " classe(s) ";
+ private static final String INSTANCES = " instances(s) ";
public boolean contains(String classname) {
// If we don't accept this class, we pretend to have it already to (maybe) avoid unnecessary work
@@ -101,6 +104,10 @@
if (countData.isEmpty()) {
a.append(NO_MATCHING_OBJECT);
} else {
+ int nbClasses = 0;
+ int nbInstances = 0;
+ int totalSize = 0;
+
for (HeapCounter c : countData.values()) {
if ((c.getInstanceCount() >= minInstanceCount) && (c.getTotalSize() >= minTotalSize)) {
if (first) {
@@ -109,12 +116,36 @@
a.append(NEWLINE);
}
c.append(a);
+
+ nbClasses++;
+ nbInstances += c.getInstanceCount();
+ totalSize += c.getTotalSize();
}
}
+
+ if (nbClasses == 0) {
+ a.append(NO_MATCHING_OBJECT);
+ } else {
+ a.append(NEWLINE);
+ a.append(SUMMARY).append(Integer.toString(nbClasses)).append(CLASSES);
+ a.append(Integer.toString(nbInstances)).append(INSTANCES);
+ appendUsage(a, totalSize);
+ }
}
a.append(NEWLINE);
}
+ private static void appendUsage(Appendable a, long size) throws IOException {
+ a.append(USAGE);
+ if (size >= 1024) {
+ a.append(NumberUtils.toBinaryByte(size)).append(" (");
+ a.append(Long.toString(size)).append("b)");
+ } else {
+ a.append(Long.toString(size)).append('b');
+ }
+
+ }
+
/**
* {@inheritDoc}
*/
@@ -163,14 +194,7 @@
a.append(Integer.toString(instanceCount));
if (objectSize != 0) {
- a.append(USAGE);
- long size = getTotalSize();
- if (size >= 1024) {
- a.append(NumberUtils.toBinaryByte(size)).append(" (");
- a.append(Long.toString(size)).append("b)");
- } else {
- a.append(Long.toString(size)).append('b');
- }
+ appendUsage(a, getTotalSize());
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:28:11
|
Revision: 5862
http://jnode.svn.sourceforge.net/jnode/?rev=5862&view=rev
Author: fduminy
Date: 2011-08-24 18:28:04 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
applied coding rules
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
Modified: trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:27:24 UTC (rev 5861)
+++ trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:28:04 UTC (rev 5862)
@@ -38,20 +38,20 @@
*/
public class OnHeapCommand extends AbstractCommand {
- private static final String help_inst = "the minimum instance count to show";
- private static final String help_size = "the minimum total size to show";
+ private static final String HELP_INST = "the minimum instance count to show";
+ private static final String HELP_SIZE = "the minimum total size to show";
private static final String HELP_CLASSNAME = "the classname filter";
- private static final String help_super = "Show the number of instances on the heap with memory usage";
- private static final String str_on_heap = "On Heap:";
+ private static final String HELP_SUPER = "Show the number of instances on the heap with memory usage";
+ private static final String STR_ON_HEAP = "On Heap:";
private final IntegerArgument argMinInstanceCount;
private final LongArgument argMinTotalSize;
private final StringArgument className;
public OnHeapCommand() {
- super(help_super);
- argMinInstanceCount = new IntegerArgument("minCount", Argument.OPTIONAL, 1, Integer.MAX_VALUE, help_inst);
- argMinTotalSize = new LongArgument("minTotalSize", Argument.OPTIONAL, 1L, Long.MAX_VALUE, help_size);
+ super(HELP_SUPER);
+ argMinInstanceCount = new IntegerArgument("minCount", Argument.OPTIONAL, 1, Integer.MAX_VALUE, HELP_INST);
+ argMinTotalSize = new LongArgument("minTotalSize", Argument.OPTIONAL, 1L, Long.MAX_VALUE, HELP_SIZE);
className = new StringArgument("className", Argument.OPTIONAL | Argument.MULTIPLE, HELP_CLASSNAME);
registerArguments(argMinInstanceCount, argMinTotalSize, className);
}
@@ -66,7 +66,7 @@
@Override
public void execute() throws Exception {
PrintWriter out = getOutput().getPrintWriter();
- out.println(str_on_heap);
+ out.println(STR_ON_HEAP);
ObjectFilter filter = null;
if (className.isSet()) {
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:27:24 UTC (rev 5861)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:28:04 UTC (rev 5862)
@@ -40,8 +40,10 @@
private ObjectFilter objectFilter = NoObjectFilter.INSTANCE;
private final TreeMap<String, HeapCounter> countData = new TreeMap<String, HeapCounter>();
- private static final char newline = '\n';
-
+ private static final char NEWLINE = '\n';
+ private static final String USAGE = " memory usage=";
+ private static final String NO_MATCHING_OBJECT = "No object is matching criteria";
+
public boolean contains(String classname) {
// If we don't accept this class, we pretend to have it already to (maybe) avoid unnecessary work
// and memory allocation (we also hope to avoid a call to add(String, int)).
@@ -97,20 +99,20 @@
boolean first = true;
if (countData.isEmpty()) {
- a.append("No object is matching criteria");
+ a.append(NO_MATCHING_OBJECT);
} else {
for (HeapCounter c : countData.values()) {
if ((c.getInstanceCount() >= minInstanceCount) && (c.getTotalSize() >= minTotalSize)) {
if (first) {
first = false;
} else {
- a.append(newline);
+ a.append(NEWLINE);
}
c.append(a);
}
}
}
- a.append(newline);
+ a.append(NEWLINE);
}
/**
@@ -133,8 +135,6 @@
private int instanceCount;
private int objectSize = 0;
- private static final String usage = " memory usage=";
-
public HeapCounter(String objectName, int objectSize) {
this.name = objectName;
this.objectSize = objectSize;
@@ -163,7 +163,7 @@
a.append(Integer.toString(instanceCount));
if (objectSize != 0) {
- a.append(usage);
+ a.append(USAGE);
long size = getTotalSize();
if (size >= 1024) {
a.append(NumberUtils.toBinaryByte(size)).append(" (");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:27:31
|
Revision: 5861
http://jnode.svn.sourceforge.net/jnode/?rev=5861&view=rev
Author: fduminy
Date: 2011-08-24 18:27:24 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
added class name filter to OnHeapCommand
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/cli/descriptors/org.jnode.command.system.xml
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
trunk/core/src/core/org/jnode/vm/facade/HeapStatistics.java
trunk/core/src/core/org/jnode/vm/facade/VmHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/facade/NoObjectFilter.java
trunk/core/src/core/org/jnode/vm/facade/ObjectFilter.java
trunk/core/src/core/org/jnode/vm/facade/SimpleObjectFilter.java
Modified: trunk/cli/descriptors/org.jnode.command.system.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.system.xml 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/cli/descriptors/org.jnode.command.system.xml 2011-08-24 18:27:24 UTC (rev 5861)
@@ -220,6 +220,7 @@
<optionSet>
<option argLabel="minCount" longName="minCount"/>
<option argLabel="minTotalSize" longName="minTotalSize"/>
+ <option argLabel="className" longName="className"/>
</optionSet>
</syntax>
<syntax alias="page">
Modified: trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -27,7 +27,10 @@
import org.jnode.shell.syntax.Argument;
import org.jnode.shell.syntax.IntegerArgument;
import org.jnode.shell.syntax.LongArgument;
+import org.jnode.shell.syntax.StringArgument;
import org.jnode.vm.facade.HeapStatistics;
+import org.jnode.vm.facade.ObjectFilter;
+import org.jnode.vm.facade.SimpleObjectFilter;
import org.jnode.vm.facade.VmUtils;
/**
@@ -37,17 +40,20 @@
private static final String help_inst = "the minimum instance count to show";
private static final String help_size = "the minimum total size to show";
+ private static final String HELP_CLASSNAME = "the classname filter";
private static final String help_super = "Show the number of instances on the heap with memory usage";
private static final String str_on_heap = "On Heap:";
private final IntegerArgument argMinInstanceCount;
private final LongArgument argMinTotalSize;
+ private final StringArgument className;
public OnHeapCommand() {
super(help_super);
argMinInstanceCount = new IntegerArgument("minCount", Argument.OPTIONAL, 1, Integer.MAX_VALUE, help_inst);
argMinTotalSize = new LongArgument("minTotalSize", Argument.OPTIONAL, 1L, Long.MAX_VALUE, help_size);
- registerArguments(argMinInstanceCount, argMinTotalSize);
+ className = new StringArgument("className", Argument.OPTIONAL | Argument.MULTIPLE, HELP_CLASSNAME);
+ registerArguments(argMinInstanceCount, argMinTotalSize, className);
}
public static void main(String[] args) throws Exception {
@@ -61,8 +67,16 @@
public void execute() throws Exception {
PrintWriter out = getOutput().getPrintWriter();
out.println(str_on_heap);
- final HeapStatistics stats = VmUtils.getVm().getHeapManager().getHeapStatistics();
+ ObjectFilter filter = null;
+ if (className.isSet()) {
+ SimpleObjectFilter f = new SimpleObjectFilter();
+ f.setClassName(className.getValues());
+ filter = f;
+ }
+
+ final HeapStatistics stats = VmUtils.getVm().getHeapManager().getHeapStatistics(filter);
+
if (argMinInstanceCount.isSet()) {
stats.setMinimumInstanceCount(argMinInstanceCount.getValue());
}
Modified: trunk/core/src/core/org/jnode/vm/facade/HeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/facade/HeapStatistics.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/core/org/jnode/vm/facade/HeapStatistics.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -46,6 +46,14 @@
void setMinimumTotalSize(long bytes);
/**
+ * Sets the object filter. If the filter accept the object,
+ * then it will be added to statistics.
+ * @param objectFilter
+ *
+ */
+ void setObjectFilter(ObjectFilter objectFilter);
+
+ /**
* Write the statistical data to an {@link Appendable}.
*
* @param a
Added: trunk/core/src/core/org/jnode/vm/facade/NoObjectFilter.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/facade/NoObjectFilter.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/facade/NoObjectFilter.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -0,0 +1,24 @@
+package org.jnode.vm.facade;
+
+/**
+ * An {@link ObjectFilter} that accepts all objects.
+ * Call {@link NoObjectFilter#INSTANCE} to get the singleton.
+ *
+ * @author Fabien DUMINY (fd...@jn...)
+ *
+ */
+public class NoObjectFilter implements ObjectFilter {
+ public static final NoObjectFilter INSTANCE = new NoObjectFilter();
+
+ private NoObjectFilter() {
+ }
+
+ /**
+ * {@inheritDoc}
+ * <br>This implementation always returns true.
+ */
+ @Override
+ public final boolean accept(String className) {
+ return true;
+ }
+}
Added: trunk/core/src/core/org/jnode/vm/facade/ObjectFilter.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/facade/ObjectFilter.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/facade/ObjectFilter.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -0,0 +1,16 @@
+package org.jnode.vm.facade;
+
+/**
+ * This interface is used to filter objects founds on heap.
+ *
+ * @author Fabien DUMINY (fd...@jn...)
+ *
+ */
+public interface ObjectFilter {
+ /**
+ * Does this filter accept the provided class ?
+ * @param className The class of the object.
+ * @return true if the filter accept the provided class.
+ */
+ boolean accept(String className);
+}
Added: trunk/core/src/core/org/jnode/vm/facade/SimpleObjectFilter.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/facade/SimpleObjectFilter.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/facade/SimpleObjectFilter.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -0,0 +1,42 @@
+package org.jnode.vm.facade;
+
+
+/**
+ * An {@link ObjectFilter} that accepts objects whose class name contains
+ * the string given by {@link #className}.
+ *
+ * @author Fabien DUMINY (fd...@jn...)
+ *
+ */
+public class SimpleObjectFilter implements ObjectFilter {
+ private String[] className = null;
+
+ /**
+ * Sets the className filter. Any class whose full name contains a value
+ * from <code>classNameFilter</code> array will be accepted. Other classes
+ * will be ignored and no statistics will be computed and displayed for
+ * them.
+ * @param className
+ */
+ public void setClassName(String[] className) {
+ this.className = ((className != null) && (className.length > 0)) ? className : null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean accept(String className) {
+ if (className == null) {
+ return true;
+ }
+
+ for (String f : this.className) {
+ if (className.contains(f)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/facade/VmHeapManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/facade/VmHeapManager.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/core/org/jnode/vm/facade/VmHeapManager.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -91,10 +91,10 @@
/**
* Get this heap's statistics.
- *
+ * @param objectFilter The optional filter to apply to objects found on heap.
* @return the heap statistics
*/
- HeapStatistics getHeapStatistics();
+ HeapStatistics getHeapStatistics(ObjectFilter objectFilter);
/**
* Get this heap GC's statistics.
Modified: trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/core/org/jnode/vm/memmgr/VmHeapManager.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -35,6 +35,7 @@
import org.jnode.vm.classmgr.VmType;
import org.jnode.vm.facade.GCStatistics;
import org.jnode.vm.facade.HeapStatistics;
+import org.jnode.vm.facade.ObjectFilter;
import org.jnode.vm.facade.VmProcessor;
import org.jnode.vm.facade.VmWriteBarrier;
import org.jnode.vm.objects.VmSystemObject;
@@ -321,7 +322,7 @@
/**
* {@inheritDoc}
*/
- public abstract HeapStatistics getHeapStatistics();
+ public abstract HeapStatistics getHeapStatistics(ObjectFilter objectFilter);
/**
* {@inheritDoc}
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -25,6 +25,8 @@
import org.jnode.util.NumberUtils;
import org.jnode.vm.facade.HeapStatistics;
+import org.jnode.vm.facade.NoObjectFilter;
+import org.jnode.vm.facade.ObjectFilter;
import org.jnode.vm.objects.VmSystemObject;
/**
@@ -35,25 +37,28 @@
private int minInstanceCount = 0;
private long minTotalSize = 0;
+ private ObjectFilter objectFilter = NoObjectFilter.INSTANCE;
private final TreeMap<String, HeapCounter> countData = new TreeMap<String, HeapCounter>();
private static final char newline = '\n';
public boolean contains(String classname) {
- return countData.containsKey(classname);
+ // If we don't accept this class, we pretend to have it already to (maybe) avoid unnecessary work
+ // and memory allocation (we also hope to avoid a call to add(String, int)).
+ return !objectFilter.accept(classname) || countData.containsKey(classname);
}
public void add(String className, int size) {
- HeapCounter count = (HeapCounter) countData.get(className);
-
- if (count == null) {
- count = new HeapCounter(className, size);
- countData.put(className, count);
- }
-
- count.inc();
-
- count = null;
+ if (objectFilter.accept(className)) {
+ HeapCounter count = (HeapCounter) countData.get(className);
+
+ if (count == null) {
+ count = new HeapCounter(className, size);
+ countData.put(className, count);
+ }
+
+ count.inc();
+ }
}
/**
@@ -75,22 +80,34 @@
public void setMinimumTotalSize(long bytes) {
this.minTotalSize = bytes;
}
-
+
/**
* {@inheritDoc}
+ */
+ @Override
+ public void setObjectFilter(ObjectFilter objectFilter) {
+ this.objectFilter = (objectFilter == null) ? NoObjectFilter.INSTANCE : objectFilter;
+ }
+
+ /**
+ * {@inheritDoc}
* @throws IOException
*/
public void writeTo(Appendable a) throws IOException {
boolean first = true;
- for (HeapCounter c : countData.values()) {
- if ((c.getInstanceCount() >= minInstanceCount) && (c.getTotalSize() >= minTotalSize)) {
- if (first) {
- first = false;
- } else {
- a.append(newline);
+ if (countData.isEmpty()) {
+ a.append("No object is matching criteria");
+ } else {
+ for (HeapCounter c : countData.values()) {
+ if ((c.getInstanceCount() >= minInstanceCount) && (c.getTotalSize() >= minTotalSize)) {
+ if (first) {
+ first = false;
+ } else {
+ a.append(newline);
+ }
+ c.append(a);
}
- c.append(a);
}
}
a.append(newline);
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefaultHeapManager.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -35,6 +35,7 @@
import org.jnode.vm.classmgr.VmType;
import org.jnode.vm.facade.GCStatistics;
import org.jnode.vm.facade.HeapStatistics;
+import org.jnode.vm.facade.ObjectFilter;
import org.jnode.vm.facade.ObjectVisitor;
import org.jnode.vm.facade.VmProcessor;
import org.jnode.vm.memmgr.HeapHelper;
@@ -447,8 +448,12 @@
return gcManager.getStatistics();
}
- public HeapStatistics getHeapStatistics() {
+ /**
+ * {@inheritDoc}
+ */
+ public HeapStatistics getHeapStatistics(ObjectFilter objectFilter) {
final DefHeapStatistics heapStatistics = new DefHeapStatistics();
+ heapStatistics.setObjectFilter(objectFilter);
final HeapStatisticsVisitor heapStatisticsVisitor = new HeapStatisticsVisitor(
heapStatistics);
Modified: trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java
===================================================================
--- trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2011-08-24 18:26:16 UTC (rev 5860)
+++ trunk/core/src/mmtk-vm/org/jnode/vm/memmgr/mmtk/BaseMmtkHeapManager.java 2011-08-24 18:27:24 UTC (rev 5861)
@@ -40,6 +40,7 @@
import org.jnode.vm.classmgr.VmNormalClass;
import org.jnode.vm.classmgr.VmType;
import org.jnode.vm.facade.HeapStatistics;
+import org.jnode.vm.facade.ObjectFilter;
import org.jnode.vm.facade.VmArchitecture;
import org.jnode.vm.facade.VmProcessor;
import org.jnode.vm.facade.VmUtils;
@@ -179,7 +180,10 @@
return BasePlan.freeMemory().toLong();
}
- public HeapStatistics getHeapStatistics() {
+ /**
+ * {@inheritDoc}
+ */
+ public HeapStatistics getHeapStatistics(ObjectFilter objectFilter) {
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:26:22
|
Revision: 5860
http://jnode.svn.sourceforge.net/jnode/?rev=5860&view=rev
Author: fduminy
Date: 2011-08-24 18:26:16 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
fixed missing newline after last line
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:25:50 UTC (rev 5859)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:26:16 UTC (rev 5860)
@@ -93,6 +93,7 @@
c.append(a);
}
}
+ a.append(newline);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:25:56
|
Revision: 5859
http://jnode.svn.sourceforge.net/jnode/?rev=5859&view=rev
Author: fduminy
Date: 2011-08-24 18:25:50 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
fixed missing lines at end of listing
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
Modified: trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:25:25 UTC (rev 5858)
+++ trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:25:50 UTC (rev 5859)
@@ -70,7 +70,12 @@
stats.setMinimumTotalSize(argMinTotalSize.getValue());
}
- stats.writeTo(new BufferedWriter(getOutput().getWriter(), 2048));
+ BufferedWriter writer = new BufferedWriter(getOutput().getWriter(), 2048);
+ try {
+ stats.writeTo(writer);
+ } finally {
+ writer.flush();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2011-08-24 18:25:31
|
Revision: 5858
http://jnode.svn.sourceforge.net/jnode/?rev=5858&view=rev
Author: fduminy
Date: 2011-08-24 18:25:25 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
fixed eclipse project
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/sound/.classpath
Modified: trunk/sound/.classpath
===================================================================
--- trunk/sound/.classpath 2011-08-21 20:03:08 UTC (rev 5857)
+++ trunk/sound/.classpath 2011-08-24 18:25:25 UTC (rev 5858)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 20:03:14
|
Revision: 5857
http://jnode.svn.sourceforge.net/jnode/?rev=5857&view=rev
Author: lsantha
Date: 2011-08-21 20:03:08 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
A RAMFile is stored in a list of Buffer object to support arbitrary large files.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFile.java
Modified: trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFile.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFile.java 2011-08-21 20:00:18 UTC (rev 5856)
+++ trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFile.java 2011-08-21 20:03:08 UTC (rev 5857)
@@ -21,8 +21,11 @@
package org.jnode.fs.ramfs;
import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
import org.jnode.fs.FSAccessRights;
import org.jnode.fs.FSDirectory;
import org.jnode.fs.FSEntry;
@@ -34,6 +37,7 @@
* A File implementation in the system RAM
*
* @author peda
+ * @author Levente S\u00e1ntha
*/
public class RAMFile implements FSEntry, FSFile {
@@ -41,7 +45,7 @@
private RAMDirectory parent;
private String filename;
- private ByteBuffer buffer;
+ private BufferList bufferList;
private long created;
private long lastModified;
@@ -63,42 +67,36 @@
// TODO accessRights
- buffer = ByteBuffer.allocate(128);
- buffer.limit(0);
+ bufferList = new BufferList();
fileSystem = (RAMFileSystem) parent.getFileSystem();
- fileSystem.addSummmedBufferSize(128);
+ fileSystem.addSummmedBufferSize(bufferList.capacity());
}
private void enlargeBuffer() throws FileSystemFullException {
- int oldCapacity = buffer.capacity();
+ int oldCapacity = bufferList.capacity();
if (oldCapacity > fileSystem.getFreeSpace())
throw new FileSystemFullException("RAMFileSystem reached maxSize");
- ByteBuffer temp = ByteBuffer.allocate(oldCapacity * 2);
- buffer.position(0);
- temp.put(buffer);
- buffer = temp;
- buffer.position(0);
+ bufferList.enlarge();
+ int newCapacity = bufferList.capacity();
// update fileSystem values
- fileSystem.addSummmedBufferSize(oldCapacity);
+ fileSystem.addSummmedBufferSize(newCapacity - oldCapacity);
}
private void shrinkBuffer() {
- int toShrink = buffer.capacity() / 2;
+ int oldCapacity = bufferList.capacity();
- ByteBuffer temp = ByteBuffer.allocate(toShrink);
- temp.put(buffer.array(), 0, toShrink);
- buffer = temp;
- buffer.position(0);
+ bufferList.shrink();
+ int newCapacity = bufferList.capacity();
// update fileSystem counter
- fileSystem.addSummmedBufferSize(-toShrink);
+ fileSystem.addSummmedBufferSize(newCapacity - oldCapacity);
}
/**
@@ -232,7 +230,7 @@
* @see org.jnode.fs.FSFile#getLength()
*/
public long getLength() {
- return buffer.limit();
+ return bufferList.limit();
}
/**
@@ -245,15 +243,15 @@
if (length > Integer.MAX_VALUE)
throw new IOException("Filesize too large");
- while (buffer.capacity() < length)
+ while (bufferList.capacity() < length)
enlargeBuffer();
- long toEnlarge = length - buffer.limit();
+ long toEnlarge = length - bufferList.limit();
- while (length < buffer.capacity() / 2)
+ while (length < bufferList.capacity() / 2)
shrinkBuffer();
- buffer.limit((int) length);
+ bufferList.limit((int) length);
// update fileSystem counters
fileSystem.addSummedFileSize(toEnlarge);
@@ -267,14 +265,14 @@
*/
public void read(long fileOffset, ByteBuffer dest) throws IOException {
- long currentSize = buffer.limit();
+ long currentSize = bufferList.limit();
long toRead = dest.limit();
if (fileOffset + toRead > currentSize)
throw new IOException("FileOffest outside file");
- buffer.position((int) fileOffset);
- buffer.get(dest.array(), 0, dest.limit());
+ bufferList.position((int) fileOffset);
+ bufferList.get(dest.array(), 0, dest.limit());
}
/**
@@ -284,14 +282,14 @@
*/
public void write(long fileOffset, ByteBuffer src) throws IOException {
- long currentSize = buffer.limit();
+ long currentSize = bufferList.limit();
long toWrite = src.limit();
if (fileOffset + toWrite >= currentSize)
setLength(fileOffset + toWrite);
- buffer.position((int) fileOffset);
- buffer.put(src);
+ bufferList.position((int) fileOffset);
+ bufferList.put(src);
setLastModified(System.currentTimeMillis());
}
@@ -305,13 +303,184 @@
void remove() throws IOException {
- long capacity = buffer.capacity();
+ long capacity = bufferList.capacity();
long filesize = getLength();
this.parent = null;
- this.buffer = null;
+ this.bufferList = null;
fileSystem.addSummedFileSize(-filesize);
fileSystem.addSummmedBufferSize(-capacity);
}
+
+ /**
+ * A resizing Buffer-like structure combining a set of NIO Buffers into one entity.
+ *
+ * @author Levente S\u00e1ntha
+ */
+ private static class BufferList {
+ private static final int MAX_BUFFER_SIZE = 12 * 1024 * 1024;
+ private final ArrayList<ByteBuffer> bufferList;
+
+ BufferList() {
+ bufferList = new ArrayList<ByteBuffer>();
+ ByteBuffer buffer = ByteBuffer.allocate(128);
+ buffer.limit(0);
+ bufferList.add(buffer);
+ }
+
+ private void enlarge() {
+ int oldCapacity = capacity();
+ if (bufferList.size() == 1) {
+ final ByteBuffer oldBuffer = bufferList.get(0);
+ final int newCapacity = oldCapacity * 2;
+ bufferList.clear();
+ if (newCapacity > MAX_BUFFER_SIZE) {
+ final ByteBuffer newBuffer = ByteBuffer.allocate(MAX_BUFFER_SIZE);
+ oldBuffer.position(0);
+ newBuffer.put(oldBuffer);
+ newBuffer.position(0);
+
+ bufferList.add(newBuffer);
+ bufferList.add(ByteBuffer.allocate(newCapacity - MAX_BUFFER_SIZE));
+ } else {
+ ByteBuffer buffer2 = ByteBuffer.allocate(newCapacity);
+ oldBuffer.position(0);
+ buffer2.put(oldBuffer);
+ buffer2.position(0);
+
+ bufferList.add(buffer2);
+ }
+ } else {
+ bufferList.add(ByteBuffer.allocate(MAX_BUFFER_SIZE));
+ }
+ }
+
+ private void shrink() {
+ final int oldCapacity = capacity();
+ if (bufferList.size() == 1) {
+ final ByteBuffer oldBuffer = bufferList.get(0);
+ final int newCapacity = oldCapacity / 2;
+ bufferList.clear();
+
+ final ByteBuffer newBuffer = ByteBuffer.allocate(newCapacity);
+ oldBuffer.position(0);
+ oldBuffer.limit(newCapacity);
+ newBuffer.put(oldBuffer);
+ newBuffer.position(0);
+
+ bufferList.add(newBuffer);
+ } else {
+ bufferList.remove(bufferList.size() - 1);
+ }
+ }
+
+ private int capacity() {
+ int capacity = 0;
+ for (ByteBuffer buffer : bufferList) {
+ capacity += buffer.capacity();
+ }
+ return capacity;
+ }
+
+ private int limit() {
+ int limit = 0;
+ for (ByteBuffer buffer : bufferList) {
+ limit += buffer.limit();
+ }
+ return limit;
+ }
+
+ private void limit(int limit) {
+ for (ByteBuffer buffer : bufferList) {
+ if (limit < 0) {
+ buffer.limit(0);
+ } else {
+ int capacity = buffer.capacity();
+ if (limit <= capacity) {
+ buffer.limit(limit);
+ } else {
+ buffer.limit(capacity);
+ }
+ limit -= capacity;
+ }
+ }
+ }
+
+ private int position() {
+ int position = 0;
+ for (ByteBuffer buffer : bufferList) {
+ position += buffer.position();
+ }
+ return position;
+ }
+
+ public void position(int position) {
+ for (ByteBuffer buffer : bufferList) {
+ if (position < 0) {
+ buffer.position(0);
+ } else {
+ int limit = buffer.limit();
+ if (position <= limit) {
+ buffer.position(position);
+ } else {
+ buffer.position(limit);
+ }
+ position -= limit;
+ }
+ }
+ }
+
+ public int remaining() {
+ int remaining = 0;
+ for (ByteBuffer buffer : bufferList) {
+ remaining += buffer.remaining();
+ }
+ return remaining;
+ }
+
+ public void get(byte[] array, int offset, int length) {
+
+ if ((offset | length | (offset + length) | (array.length - (offset + length))) < 0)
+ throw new IndexOutOfBoundsException();
+
+ if (length > remaining())
+ throw new BufferUnderflowException();
+
+ for (ByteBuffer buffer : bufferList) {
+ int remaining = buffer.remaining();
+ if (remaining > 0) {
+ if (length > remaining) {
+ buffer.get(array, offset, remaining);
+ offset += remaining;
+ length -= remaining;
+ } else {
+ buffer.get(array, offset, length);
+ return;
+ }
+ }
+ }
+ }
+
+ public void put(ByteBuffer src) {
+ int length = src.remaining();
+ if (length > remaining())
+ throw new BufferOverflowException();
+
+ for (ByteBuffer buffer : bufferList) {
+ int remaining = buffer.remaining();
+ if (remaining > 0) {
+ if (length > remaining) {
+ src.limit(src.position() + remaining);
+ buffer.put(src);
+ length -= remaining;
+ } else {
+ src.limit(src.position() + length);
+ buffer.put(src);
+ return;
+ }
+ }
+ }
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 20:00:25
|
Revision: 5856
http://jnode.svn.sourceforge.net/jnode/?rev=5856&view=rev
Author: lsantha
Date: 2011-08-21 20:00:18 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Fixes command syntax for ls and dir.
Modified Paths:
--------------
trunk/cli/descriptors/org.jnode.command.file.xml
Modified: trunk/cli/descriptors/org.jnode.command.file.xml
===================================================================
--- trunk/cli/descriptors/org.jnode.command.file.xml 2011-08-21 19:59:00 UTC (rev 5855)
+++ trunk/cli/descriptors/org.jnode.command.file.xml 2011-08-21 20:00:18 UTC (rev 5856)
@@ -154,8 +154,16 @@
</sequence>
</syntax>
<syntax alias="dir">
- <empty description="list the current directory"/>
- <argument argLabel="path" description="list a file or directory"/>
+ <sequence description="list files or directories">
+ <optional>
+ <option argLabel="humanReadable" shortName="l"/>
+ </optional>
+ <optional>
+ <repeat>
+ <argument argLabel="path" description="list a file or directory"/>
+ </repeat>
+ </optional>
+ </sequence>
</syntax>
<syntax alias="du">
<sequence description="Disk Usage - report the amount of disk space used by the specified directory and for each subdirectory.">
@@ -284,11 +292,16 @@
<option argLabel="url" shortName="u" longName="url" description="print a hex dump of a URL"/>
</syntax>
<syntax alias="ls">
- <empty description="with -l, print sizes in human readable format (e.g., 1K 234M 2G)"/>
- <option argLabel="humanReadable" shortName="h" longName="human-readable"/>
- <repeat>
- <argument argLabel="path" description="list files or directories"/>
- </repeat>
+ <sequence description="list files or directories">
+ <optional>
+ <option argLabel="humanReadable" shortName="l"/>
+ </optional>
+ <optional>
+ <repeat>
+ <argument argLabel="path" description="list a file or directory"/>
+ </repeat>
+ </optional>
+ </sequence>
</syntax>
<syntax alias="md5sum">
<empty description="Calculates the MD5 digest for standard input"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 19:59:06
|
Revision: 5855
http://jnode.svn.sourceforge.net/jnode/?rev=5855&view=rev
Author: lsantha
Date: 2011-08-21 19:59:00 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Fixed playing beep with the play command.
Modified Paths:
--------------
trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java
Modified: trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java 2011-08-21 15:30:55 UTC (rev 5854)
+++ trunk/gui/src/driver/org/jnode/driver/sound/speaker/SpeakerUtils.java 2011-08-21 19:59:00 UTC (rev 5855)
@@ -38,8 +38,6 @@
/** My logger */
private static final Logger log = Logger.getLogger(SpeakerUtils.class);
- /** What to play as the standard beep (null = a simple beep) * */
- public static Note[] stdBeep = null;
/** The length of a standard interval * */
public static final int INTERVAL = 500;
@@ -58,30 +56,23 @@
/** Sounds a beep on the system speaker * */
public static void beep() {
- if (stdBeep == null) {
- try {
- DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
- Device dev = dm.getDevice("speaker0");
- SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
- s.beep();
- } catch (ApiNotFoundException anfex) {
- log.error("Unable to beep: ", anfex);
- } catch (DeviceNotFoundException dnfex) {
- log.error("Unable to beep: ", dnfex);
- } catch (NameNotFoundException nnfex) {
- log.debug("Unable to beep: ", nnfex);
- }
- } else
- play(stdBeep);
+ play(stdBeep);
}
- /** Plays a series of notes through the default speaker * */
+ /**
+ * Plays a series of notes through the default speaker.
+ * Null argument or zero length array plays the standard beep.
+ */
public static void play(Note[] n) {
try {
DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
Device dev = dm.getDevice("speaker0");
SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
- s.playNote(n);
+ if (n == null || n.length == 0) {
+ s.beep();
+ } else {
+ s.playNote(n);
+ }
} catch (ApiNotFoundException anfex) {
log.error("Unable to beep: ", anfex);
} catch (DeviceNotFoundException dnfex) {
@@ -92,6 +83,9 @@
}
+ /** What to play as the standard beep (null = a simple beep) * */
+ public static Note[] stdBeep = new Note[0];
+
/** Defines a scale * */
public static final Note[] SCALE =
new Note[] {new Note(Note.NOTE_C4, HALF), new Note(Note.NOTE_D4, HALF),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 15:31:01
|
Revision: 5854
http://jnode.svn.sourceforge.net/jnode/?rev=5854&view=rev
Author: lsantha
Date: 2011-08-21 15:30:55 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Turn off all sounds when stopping the PC speaker device.
Modified Paths:
--------------
trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java
Modified: trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java 2011-08-21 15:25:19 UTC (rev 5853)
+++ trunk/gui/src/driver/org/jnode/driver/sound/speaker/pc/PCSpeakerDriver.java 2011-08-21 15:30:55 UTC (rev 5854)
@@ -86,6 +86,7 @@
/** A routine that releases all the resources back to the operating system. * */
public void stopDevice() throws DriverException {
+ noSound();
getDevice().unregisterAPI(SpeakerAPI.class);
pitIO.release();
speakIO.release();
@@ -142,6 +143,11 @@
speakIO.outPortByte(SPEAKER_PORT, oldPort);
}
+ public void noSound() {
+ int val = speakIO.inPortByte(SPEAKER_PORT);
+ speakIO.outPortByte(SPEAKER_PORT, val & 0xFC);
+ }
+
private IOResource claimPorts(final ResourceManager rm, final ResourceOwner owner,
final int low, final int length) throws ResourceNotFreeException, DriverException {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 15:25:26
|
Revision: 5853
http://jnode.svn.sourceforge.net/jnode/?rev=5853&view=rev
Author: lsantha
Date: 2011-08-21 15:25:19 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Fixes to file size display in 'dir' command.
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/file/DirCommand.java
Modified: trunk/cli/src/commands/org/jnode/command/file/DirCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/file/DirCommand.java 2011-08-21 15:23:35 UTC (rev 5852)
+++ trunk/cli/src/commands/org/jnode/command/file/DirCommand.java 2011-08-21 15:25:19 UTC (rev 5853)
@@ -42,14 +42,17 @@
* @author cr...@jn...
*/
public class DirCommand extends AbstractCommand {
+ private static final String SEPARATOR = " ";
+ private static final int SEPARATOR_SIZE = SEPARATOR.length();
private static final int LEFT_MARGIN = 14;
- private static final SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm");
-
private static final String help_path = "the file or directory to list";
- private static final String help_humanReadable = "with -l, print sizes in human readable format (e.g., 1K 234M 2G)";
+ private static final String help_humanReadable = "print sizes in human readable format (e.g. 1K, 234M, 2G)";
private static final String help_super = "List files or directories";
private static final String fmt_no_path = "No such path: %s%n";
+ private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
+ private final DecimalFormat decimalFormat = new DecimalFormat("###0.00");
+
private final FileArgument argPath;
private final FlagArgument humanReadableArg;
@@ -101,8 +104,7 @@
});
StringBuilder sb = new StringBuilder();
Date lastModified = new Date();
- for (int i = 0; i < list.length; i++) {
- File f = list[i];
+ for (File f : list) {
if (f.exists()) {
sb.setLength(0);
lastModified.setTime(f.lastModified());
@@ -111,15 +113,15 @@
int cnt = LEFT_MARGIN - ln.length();
for (int j = 0; j < cnt; j++) sb.append(' ');
sb.append(ln);
- sb.append(" ");
- sb.append(df.format(lastModified));
- sb.append(" ");
+ sb.append(SEPARATOR);
+ sb.append(dateFormat.format(lastModified));
+ sb.append(SEPARATOR);
sb.append(f.getName());
} else {
- for (int j = 0; j < LEFT_MARGIN + 3; j++, sb.append(' '))
- ;
- sb.append(df.format(lastModified));
- sb.append(" [");
+ for (int j = 0; j < LEFT_MARGIN + SEPARATOR_SIZE; j++) sb.append(' ');
+ sb.append(dateFormat.format(lastModified));
+ sb.append(SEPARATOR);
+ sb.append("[");
sb.append(f.getName());
sb.append(']');
}
@@ -132,13 +134,19 @@
private static final String[] units = {"B", "K", "M", "G", "T", "P", "E", "Z", "Y"};
- protected String formatSize(double bytes) {
+
+ protected String formatSize(long bytes) {
if (humanReadableArg.isSet()) {
- int index;
- for (index = 0; bytes >= 1024; index++) bytes = bytes / 1024;
- DecimalFormat df = new DecimalFormat("###0.0");
- return df.format(bytes) + units[index];
- } else
+ if (bytes >= 1024) {
+ double dbytes = (double) bytes;
+ int index;
+ for (index = 0; dbytes >= 1024; index++) dbytes = dbytes / 1024;
+ return decimalFormat.format(dbytes) + units[index];
+ } else {
+ return bytes + "B";
+ }
+ } else {
return bytes + "B";
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2011-08-21 15:23:42
|
Revision: 5852
http://jnode.svn.sourceforge.net/jnode/?rev=5852&view=rev
Author: lsantha
Date: 2011-08-21 15:23:35 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Fix to showing aliases in help command.
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/common/HelpCommand.java
Modified: trunk/cli/src/commands/org/jnode/command/common/HelpCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/common/HelpCommand.java 2011-08-17 19:41:28 UTC (rev 5851)
+++ trunk/cli/src/commands/org/jnode/command/common/HelpCommand.java 2011-08-21 15:23:35 UTC (rev 5852)
@@ -50,7 +50,7 @@
private static final String err_no_help = "No help information is available for '%s'%n";
private static final String err_help_ex = "Error getting help for '%s': %s%n";
private static final String err_sec_ex = "Security exception while loading the class for '%s'%nReason: %s%n";
- private static final String fmt_other_alias = "Other aliases %s";
+ private static final String fmt_other_alias = "Other aliases: %s%n";
private final AliasArgument argAlias;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|