File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
core/src/main/java/edu/wpi/grip/core Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 11package edu .wpi .grip .core ;
22
33/**
4- * Defines what methods a FileManager implementation must implement .
4+ * A FileManager saves images to disk .
55 */
66public interface FileManager {
77
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments