marschall / memoryfilesystem

An in memory implementation of a JSR-203 file system
284 stars 36 forks source link

java 8 BlockChannel.read problem #33

Closed ghost closed 10 years ago

ghost commented 10 years ago

environment: osx 10.9 java 8 (1.8.0), memoryfilesystem 0.5.3

    FileSystem fs = MemoryFileSystemBuilder.newEmpty().build("53");
    Path path = fs.getPath("one").toAbsolutePath();
    Files.write( path, "hallo world".getBytes("UTF-8"));
    Files.readAllBytes(path);

produces

Exception in thread "main" java.nio.channels.NonReadableChannelException
at     com.github.marschall.memoryfilesystem.BlockChannel.readCheck(BlockChannel.java:65)
at com.github.marschall.memoryfilesystem.BlockChannel.readLock(BlockChannel.java:75)
at com.github.marschall.memoryfilesystem.BlockChannel.read(BlockChannel.java:82)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at java.nio.file.Files.read(Files.java:3102)
at java.nio.file.Files.readAllBytes(Files.java:3155)
at org.opencage.lindwurm.niotest.Marschal53Test.main(Marschal53Test.java:21)

this works fine in the latest java 7.