Skip to content

Commit

Permalink
Merge branch 'hotfix/v2.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Dec 22, 2017
2 parents fd14dc2 + 6f778f1 commit eab0745
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

MiXCR 2.1.8 (22 Dec 2017)
========================

-- Fixes possible `IOException` during report output on Lustre file system


MiXCR 2.1.7 ( 6 Dec 2017)
========================

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<groupId>com.milaboratory</groupId>
<artifactId>mixcr</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
<packaging>jar</packaging>
<name>MiXCR</name>

Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/milaboratory/mixcr/cli/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ static void appendAtomically(String fileName, byte[] content) {

static void appendAtomically(File file, byte[] content) {
try (FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE);
FileLock lock = channel.lock()) {
FileLock lock = lockIfPossible(channel)) {
channel.position(channel.size());
channel.write(ByteBuffer.wrap(content));
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}

static FileLock lockIfPossible(FileChannel channel) {
try {
return channel.lock();
} catch (Exception e) {
return null;
}
}

public static void writeReport(String reportFileName, Report report) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ReportHelper helper = new ReportHelper(bos, false);
Expand Down

0 comments on commit eab0745

Please sign in to comment.