Skip to content

Commit 980c8bc

Browse files
committed
use jpl instead of jul
1 parent f133573 commit 980c8bc

18 files changed

+163
-98
lines changed

fs/src/main/java/org/jnode/driver/block/VirtualDiskDevice.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88

99
import java.io.FileNotFoundException;
1010
import java.io.IOException;
11+
import java.lang.System.Logger;
12+
import java.lang.System.Logger.Level;
1113
import java.nio.ByteBuffer;
12-
import java.util.logging.Level;
1314

1415
import org.jnode.driver.Device;
1516
import org.jnode.partitions.PartitionTableEntry;
1617

17-
import vavi.util.Debug;
18-
1918

2019
/**
2120
* VirtualDiskDevice.
@@ -25,15 +24,15 @@
2524
*/
2625
public class VirtualDiskDevice extends Device implements FSBlockDeviceAPI {
2726

28-
// private static final Logger logger = System.getLogger(VirtualDiskDevice.class.getName());
27+
private static final Logger logger = System.getLogger(VirtualDiskDevice.class.getName());
2928

3029
/** for partition entry */
3130
private long offset = 0;
3231

3332
/** for partition entry */
3433
public void addOffset(long offset) {
3534
this.offset += offset;
36-
Debug.printf(Level.FINE, "offset: %08x + %08x -> %08x", (this.offset - offset), offset, this.offset);
35+
logger.log(Level.DEBUG, String.format("offset: %08x + %08x -> %08x", (this.offset - offset), offset, this.offset));
3736
}
3837

3938
/** virtual offset */

fs/src/main/java/org/jnode/fs/BlockDeviceFileSystemType.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,25 @@
2020

2121
package org.jnode.fs;
2222

23+
import java.lang.System.Logger;
24+
import java.lang.System.Logger.Level;
2325
import java.util.ServiceLoader;
24-
import java.util.logging.Level;
2526

2627
import org.jnode.driver.block.FSBlockDeviceAPI;
2728
import org.jnode.partitions.PartitionTableEntry;
2829

29-
import vavi.util.Debug;
30+
import static java.lang.System.getLogger;
31+
3032

3133
/**
3234
* Specific kind of FileSystemType for block devices
3335
*
3436
* @author epr
3537
*/
3638
public interface BlockDeviceFileSystemType<T extends FileSystem<?>> extends FileSystemType<T> {
39+
40+
Logger logger = getLogger(BlockDeviceFileSystemType.class.getName());
41+
3742
/**
3843
* Can this file system type be used on the given first sector of a
3944
* blockdevice?
@@ -50,7 +55,7 @@ static <T extends FileSystemType> T lookup(PartitionTableEntry pte, byte[] first
5055
ServiceLoader<FileSystemType> sl = ServiceLoader.load(FileSystemType.class);
5156
for (FileSystemType fst : sl) {
5257
if (fst instanceof BlockDeviceFileSystemType bdfst) {
53-
Debug.println(Level.FINE, "filesystem type: " + fst);
58+
logger.log(Level.DEBUG, "filesystem type: " + fst);
5459
if (bdfst.supports(pte, firstSector, devApi)) {
5560
return (T) fst;
5661
}

fs/src/main/java/org/jnode/fs/hfsplus/catalog/CatalogFolder.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@
2020

2121
package org.jnode.fs.hfsplus.catalog;
2222

23+
import java.lang.System.Logger;
24+
import java.lang.System.Logger.Level;
25+
2326
import org.jnode.fs.hfsplus.HfsPlusBSDInfo;
2427
import org.jnode.fs.hfsplus.HfsUtils;
2528
import org.jnode.util.BigEndian;
2629

30+
import static java.lang.System.getLogger;
31+
32+
2733
public class CatalogFolder {
2834

29-
/* Types */
35+
private static final Logger logger = getLogger(CatalogFolder.class.getName());
36+
37+
// Types
3038
public static final int RECORD_TYPE_FOLDER = 0x0001;
3139
public static final int RECORD_TYPE_FOLDER_THREAD = 0x0003;
3240

@@ -58,7 +66,7 @@ public class CatalogFolder {
5866
*/
5967
public CatalogFolder(final byte[] src) {
6068
byte[] data = new byte[88];
61-
//Debug.println("src: " + src.length);
69+
logger.log(Level.TRACE, "src: " + src.length);
6270
System.arraycopy(src, 0, data, 0, Math.min(CATALOG_FOLDER_SIZE, src.length)); // TODO check
6371
recordType = BigEndian.getInt16(data, 0);
6472
flags = BigEndian.getUInt16(data, 2);

fs/src/main/java/org/jnode/fs/jfat/Fat.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@
2121
package org.jnode.fs.jfat;
2222

2323
import java.io.IOException;
24+
import java.lang.System.Logger;
25+
import java.lang.System.Logger.Level;
2426
import java.nio.ByteBuffer;
2527
import java.util.Arrays;
26-
import java.util.logging.Level;
2728

2829
import org.jnode.driver.block.BlockDeviceAPI;
2930
import org.jnode.fs.FileSystemException;
3031

31-
import vavi.util.Debug;
32+
import static java.lang.System.getLogger;
33+
3234

3335
/**
3436
* @author gvt
3537
*/
3638
public abstract class Fat {
3739

40+
private static final Logger logger = getLogger(Fat.class.getName());
41+
3842
private final BlockDeviceAPI api;
3943
private final BootSector bs;
4044

@@ -136,7 +140,7 @@ public void readCluster(int cluster, int offset, ByteBuffer dst) throws IOExcept
136140
if (offset < 0) {
137141
throw new IllegalArgumentException("offset<0");
138142
}
139-
Debug.println(Level.FINER, "cluster: " + cluster);
143+
logger.log(Logger.Level.TRACE, "cluster: " + cluster);
140144
if ((offset + dst.remaining()) > getClusterSize()) {
141145
throw new IllegalArgumentException("length[" + (offset + dst.remaining()) + "] " +
142146
"exceed clusterSize[" + getClusterSize() + "]");
@@ -191,7 +195,7 @@ public final long getClusterSector(int index) {
191195
throw new IllegalArgumentException("illegal cluster # : " + index);
192196
}
193197

194-
Debug.println(Level.FINER, "sector: " + (long) (index - firstCluster()) * (long) bs.getSectorsPerCluster() +
198+
logger.log(Level.TRACE, "sector: " + (long) (index - firstCluster()) * (long) bs.getSectorsPerCluster() +
195199
getBootSector().getFirstDataSector());
196200
return (long) (index - firstCluster()) * (long) bs.getSectorsPerCluster() +
197201
getBootSector().getFirstDataSector();

fs/src/main/java/org/jnode/fs/jfat/Fat16.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,23 @@
2121
package org.jnode.fs.jfat;
2222

2323
import java.io.IOException;
24-
import java.util.logging.Level;
24+
import java.lang.System.Logger;
25+
import java.lang.System.Logger.Level;
2526

2627
import org.jnode.driver.block.BlockDeviceAPI;
2728

28-
import vavi.util.Debug;
29+
import static java.lang.System.getLogger;
30+
2931

3032
/**
3133
* A FAT implementation for FAT-16.
3234
*
3335
* @author Luke Quinane
3436
*/
3537
public class Fat16 extends Fat {
38+
39+
private static final Logger logger = getLogger(Fat16.class.getName());
40+
3641
protected Fat16(BootSector bs, BlockDeviceAPI api) {
3742
super(bs, api);
3843
}
@@ -51,17 +56,17 @@ public int get(int index) throws IOException {
5156
public int set(int index, int element) throws IOException {
5257
long old = getUInt16(index);
5358

54-
setInt16(index, element & 0xFFFF);
59+
setInt16(index, element & 0xffff);
5560

56-
return (int) (old & 0x0000FFFF);
61+
return (int) (old & 0x0000_ffff);
5762
}
5863

5964
@Override
6065
public long getClusterPosition(int index) {
6166
BootSector bootSector = getBootSector();
6267

6368
long rootDirectoryOffset = bootSector.getFirstDataSector() * bootSector.getBytesPerSector();
64-
Debug.printf(Level.FINER, "fat[" + index + "]: offset: %08x%n", rootDirectoryOffset);
69+
logger.log(Level.TRACE, () -> String.format("fat[" + index + "]: offset: %08x", rootDirectoryOffset));
6570
if (index == 0) {
6671
return rootDirectoryOffset;
6772
}
@@ -78,7 +83,7 @@ public boolean hasNext(int entry) {
7883

7984
@Override
8085
public boolean isEofChain(int entry) {
81-
return (entry >= 0xFFF8);
86+
return (entry >= 0xfff8);
8287
}
8388

8489
@Override

fs/src/main/java/org/jnode/fs/jfat/FatFileSystemType.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020

2121
package org.jnode.fs.jfat;
2222

23+
import java.lang.System.Logger;
24+
import java.lang.System.Logger.Level;
2325
import java.nio.charset.Charset;
24-
import java.util.logging.Level;
2526

2627
import org.jnode.driver.Device;
2728
import org.jnode.driver.block.FSBlockDeviceAPI;
2829
import org.jnode.fs.BlockDeviceFileSystemType;
2930
import org.jnode.fs.FileSystemException;
3031
import org.jnode.partitions.PartitionTableEntry;
3132

32-
import vavi.util.Debug;
33+
import static java.lang.System.getLogger;
34+
3335

3436
/**
3537
* <p>
@@ -40,6 +42,8 @@
4042
*/
4143
public class FatFileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
4244

45+
private static final Logger logger = getLogger(FatFileSystemType.class.getName());
46+
4347
@Override
4448
public String getName() {
4549
return "JFAT";
@@ -72,13 +76,13 @@ public boolean supports(PartitionTableEntry pte, byte[] firstSectors, FSBlockDev
7276

7377
if (firstSectors.length < 512) {
7478
// Not enough data for detection
75-
Debug.printf(Level.FINE, "Not enough data for detection: %04x/%04x%n", firstSectors.length, 512);
79+
logger.log(Level.DEBUG, String.format("Not enough data for detection: %04x/%04x%n", firstSectors.length, 512));
7680
return false;
7781
}
7882

7983
if (firstSectors[510] != (byte) 0x55 || firstSectors[511] != (byte) 0xaa) {
8084
// Missing magic number
81-
Debug.printf(Level.FINE, "Missing magic number 0x55aa: %02x%02x%n", firstSectors[510], firstSectors[511]);
85+
logger.log(Level.DEBUG, String.format("Missing magic number 0x55aa: %02x%02x%n", firstSectors[510], firstSectors[511]));
8286
return false;
8387
}
8488

fs/src/main/java/org/jnode/fs/pc98/PC98BootSector.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88

99
import java.io.ByteArrayInputStream;
1010
import java.io.IOException;
11+
import java.lang.System.Logger;
12+
import java.lang.System.Logger.Level;
1113
import java.nio.ByteBuffer;
12-
import java.util.logging.Level;
1314

1415
import org.jnode.driver.block.BlockDeviceAPI;
1516
import org.jnode.fs.jfat.BootSector;
16-
17-
import vavi.util.Debug;
1817
import vavi.util.serdes.Serdes;
19-
2018
import vavix.io.fat.PC98BiosParameterBlock;
2119

20+
import static java.lang.System.getLogger;
21+
2222

2323
/**
2424
* PC98BootSector.
@@ -28,6 +28,8 @@
2828
*/
2929
public class PC98BootSector implements BootSector {
3030

31+
private static final Logger logger = getLogger(PC98BootSector.class.getName());
32+
3133
private PC98BiosParameterBlock bpb;
3234

3335
private boolean dirty;
@@ -49,9 +51,9 @@ public void read(BlockDeviceAPI device) throws IOException {
4951

5052
this.bpb = new PC98BiosParameterBlock();
5153
Serdes.Util.deserialize(bais, bpb);
52-
Debug.println(Level.FINE, "■ bootRecord ----\n" + bpb);
54+
logger.log(Level.DEBUG, "■ bootRecord ----\n" + bpb);
5355
bpb.compute();
54-
Debug.println(Level.FINE, "■ bootRecord ----\n" + bpb);
56+
logger.log(Level.DEBUG, "■ bootRecord ----\n" + bpb);
5557

5658
dirty = false;
5759
}

fs/src/main/java/org/jnode/fs/pc98/PC98FileSystemType.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
package org.jnode.fs.pc98;
88

9+
import java.lang.System.Logger;
10+
import java.lang.System.Logger.Level;
911
import java.nio.charset.Charset;
10-
import java.util.logging.Level;
1112

1213
import org.jnode.driver.Device;
1314
import org.jnode.driver.block.FSBlockDeviceAPI;
@@ -16,9 +17,10 @@
1617
import org.jnode.fs.jfat.BootSector;
1718
import org.jnode.fs.jfat.FatFileSystem;
1819
import org.jnode.partitions.PartitionTableEntry;
19-
import vavi.util.Debug;
2020
import vavi.util.StringUtil;
2121

22+
import static java.lang.System.getLogger;
23+
2224

2325
/**
2426
* PC98FileSystemType.
@@ -35,6 +37,8 @@
3537
*/
3638
public class PC98FileSystemType implements BlockDeviceFileSystemType<FatFileSystem> {
3739

40+
private static final Logger logger = getLogger(PC98FileSystemType.class.getName());
41+
3842
@Override
3943
public String getName() {
4044
return "PC98";
@@ -48,19 +52,19 @@ public String getScheme() {
4852
// TODO
4953
@Override
5054
public boolean supports(PartitionTableEntry pte, byte[] firstSectors, FSBlockDeviceAPI devApi) {
51-
Debug.println(Level.FINER, "\n" + StringUtil.getDump(firstSectors));
55+
logger.log(Level.TRACE, "\n" + StringUtil.getDump(firstSectors));
5256

5357
if (firstSectors[0x3] != 'N' ||
5458
firstSectors[0x4] != 'E' ||
5559
firstSectors[0x5] != 'C') {
5660
// Missing magic number
57-
Debug.printf(Level.FINE, "Missing magic number 'NEC': %c%c%c%n", firstSectors[0x3] & 0xff, firstSectors[0x4] & 0xff, firstSectors[0x5] & 0xff);
61+
logger.log(Level.DEBUG, String.format("Missing magic number 'NEC': %c%c%c%n", firstSectors[0x3] & 0xff, firstSectors[0x4] & 0xff, firstSectors[0x5] & 0xff));
5862
return false;
5963
}
6064

6165
// TODO fat12 doesn't work
6266
// if (!new String(firstSectors, 0x36, 3, StandardCharsets.US_ASCII).equals("FAT")) {
63-
//Debug.println("strings FAT is not found");
67+
//logger.log(Level.DEBUG, "strings FAT is not found");
6468
// return false;
6569
// }
6670

0 commit comments

Comments
 (0)