Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Jul 23, 2019
1 parent f524bd7 commit 788b3e7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractIT {
private static final int BUFFER_SIZE = 1024;

protected static OwnCloudClient client;
protected static Context context;
private static Context context;

@BeforeClass
public static void beforeAll() {
Expand All @@ -55,7 +55,10 @@ public String createFile(String name) throws IOException {
File tempDir = context.getFilesDir();

File file = new File(tempDir + File.separator + name);
file.createNewFile();

if (!file.createNewFile()) {
throw new IOException("Cannot create file: " + file.getAbsolutePath());
}

assertTrue(file.exists());

Expand All @@ -72,10 +75,8 @@ public String createFile(String name) throws IOException {
public static File extractAsset(String fileName, Context context) throws IOException {
File extractedFile = new File(context.getCacheDir() + File.separator + fileName);
if (!extractedFile.exists()) {
InputStream in = null;
FileOutputStream out = null;
in = context.getAssets().open(fileName);
out = new FileOutputStream(extractedFile);
InputStream in = context.getAssets().open(fileName);
FileOutputStream out = new FileOutputStream(extractedFile);
byte[] buffer = new byte[BUFFER_SIZE];
int readCount;
while ((readCount = in.read(buffer)) != -1) {
Expand Down

0 comments on commit 788b3e7

Please sign in to comment.