Skip to content

Commit 586e9cf

Browse files
committed
Changes based on comments
1 parent cfbe494 commit 586e9cf

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

core/src/main/java/edu/wpi/grip/core/FileManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package edu.wpi.grip.core;
22

33
/**
4-
* Defines what methods a FileManager implementation must implement.
4+
* A FileManager saves images to disk.
55
*/
66
public interface FileManager {
77

core/src/main/java/edu/wpi/grip/core/GripFileManager.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@ public class GripFileManager implements FileManager {
2525

2626
@Override
2727
public void saveImage(byte[] image, String fileName) {
28-
checkNotNull(image);
29-
checkNotNull(fileName);
28+
checkNotNull("An image was not provided to the FileManager", image);
29+
checkNotNull("A filename was not provided to the FileManager", fileName);
3030

3131
File file = new File(IMAGE_DIRECTORY, fileName);
32-
Runnable runnable = () -> {
32+
Thread thread = new Thread(() -> {
3333
try {
3434
IMAGE_DIRECTORY.mkdirs(); // If the user deletes the directory
3535
Files.write(image, file);
3636
} catch (IOException ex) {
3737
logger.log(Level.WARNING, ex.getMessage(), ex);
3838
}
39-
};
40-
new Thread(runnable).start();
39+
});
40+
thread.setDaemon(true);
41+
thread.start();
4142
}
4243
}

core/src/main/java/edu/wpi/grip/core/operations/composite/SaveImageOperation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ private enum FileTypes {
7070

7171
@SuppressWarnings("JavadocMethod")
7272
public SaveImageOperation(InputSocket.Factory inputSocketFactory,
73-
OutputSocket.Factory outputSocketFactory, FileManager fileManager) {
73+
OutputSocket.Factory outputSocketFactory,
74+
FileManager fileManager) {
7475
this.fileManager = fileManager;
7576

7677
inputSocket = inputSocketFactory.create(inputHint);

0 commit comments

Comments
 (0)