此代码在Windows 8.1上以Java 1.8.0_72 25.72-b15 64位运行
protected FileLock getFileLockForWriting(FileChannel fileChannel, String filePath) throws IOException
{
logger.finest("locking fileChannel for " + filePath);
FileLock fileLock;
try
{
fileLock = fileChannel.tryLock();
}
//Assumes locking is not supported on this platform so just returns null
catch (IOException exception)
{
return null;
}
//Couldnt getFields lock because file is already locked by another application
if (fileLock == null)
{
throw new IOException(ErrorMessage.GENERAL_WRITE_FAILED_FILE_LOCKED.getMsg(filePath));
}
return fileLock;
}
正在为特定用户报告此错误
java.lang.Error: java.io.IOException: The specified server cannot perform the requested operation
at sun.nio.ch.FileKey.create(Unknown Source)
at sun.nio.ch.SharedFileLockTable.<init>(Unknown Source)
at sun.nio.ch.FileLockTable.newSharedFileLockTable(Unknown Source)
at sun.nio.ch.FileChannelImpl.fileLockTable(Unknown Source)
at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source)
at java.nio.channels.FileChannel.tryLock(Unknown Source)
at org.jaudiotagger.tag.id3.AbstractID3v2Tag.getFileLockForWriting(AbstractID3v2Tag.java:1080)
at org.jaudiotagger.tag.id3.AbstractID3v2Tag.writeBufferToFile(AbstractID3v2Tag.java:1462)
at org.jaudiotagger.tag.id3.ID3v23Tag.write(ID3v23Tag.java:751)
at org.jaudiotagger.audio.mp3.MP3File.save(MP3File.java:1011)
at org.jaudiotagger.audio.mp3.MP3File.save(MP3File.java:920)
at org.jaudiotagger.audio.mp3.MP3File.commit(MP3File.java:932)
at com.jthink.songkong.analyse.analyser.SongSaver.realSave(SongSaver.java:798)
at com.jthink.songkong.analyse.analyser.SongSaver.saveSongToFile(SongSaver.java:623)
at com.jthink.songkong.analyse.analyser.SongSaver.saveChanges(SongSaver.java:185)
at com.jthink.songkong.analyse.analyser.SongSaver.call(SongSaver.java:160)
at com.jthink.songkong.analyse.analyser.SongSaver.call(SongSaver.java:54)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: The specified server cannot perform the requested operation
at sun.nio.ch.FileKey.init(Native Method)
... 21 more
似乎它返回一个错误,因为不支持文件锁定,但它应该返回一个IOException,(我的代码需要一个IOException),为什么这个
更新 我的情况相关它是西部数据MyBook Live 3TBNAS,固件版本是02.43.10-048,运行Debian 5.0.4