Skip to content

Commit c40b616

Browse files
authored
Merge pull request #13 from fugerit-org/bug/issue_12
Fix file content in JMountDaogenDB #12
2 parents 3d14c84 + 3bccd08 commit c40b616

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

fj-core-jvfs/src/main/java/org/fugerit/java/core/jvfs/db/JMountDaogenDB.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ public JFile[] listFiles( DaogenJFileDB file ) throws IOException {
141141

142142
public InputStream streamIn( ModelDbJvfsFile file ) throws IOException {
143143
InputStream is = null;
144-
if ( file != null ) {
145-
is = new ByteArrayInputStream( file.getFileContent().getData() );
144+
if ( file != null && file.getFileContent() != null ) {
145+
byte[] data = file.getFileContent().getData();
146+
if ( data != null ) {
147+
is = new ByteArrayInputStream( file.getFileContent().getData() );
148+
}
146149
}
147150
return is;
148151
}

fj-core-jvfs/src/main/java/org/fugerit/java/core/jvfs/util/JFileUtilCP.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.fugerit.java.core.jvfs.util;
22

33
import java.io.IOException;
4+
import java.io.InputStream;
45

56
import org.fugerit.java.core.io.StreamIO;
67
import org.fugerit.java.core.jvfs.JFile;
@@ -55,7 +56,14 @@ public static int copyFile( JFile from, JFile to, boolean recurse, boolean force
5556
throw new IOException( "Directories can only be copied recursively, from:("+from+") to:("+to+")" );
5657
}
5758
} else {
58-
StreamIO.pipeStream( from.getInputStream() , to.getOutputStream(), StreamIO.MODE_CLOSE_BOTH );
59+
InputStream fromIS = from.getInputStream();
60+
if ( fromIS != null ) {
61+
StreamIO.pipeStream( fromIS , to.getOutputStream(), StreamIO.MODE_CLOSE_BOTH );
62+
} else {
63+
if ( verbose ) {
64+
logger.info( "Input file empty (getInputStream() == null) : {}", from.describe() );
65+
}
66+
}
5967
}
6068
}
6169
return res;

0 commit comments

Comments
 (0)