Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Commit

Permalink
fix issue with unsupported file types and suppressed console printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpmart08 committed Jun 8, 2016
1 parent 8c7eefc commit 49594ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/app/musicplayer/MusicPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -81,6 +83,14 @@ public void start(Stage stage) throws Exception {

// Suppresses warning caused by converting music library data into xml file.
LogManager.getLogManager().reset();
PrintStream dummyStream = new PrintStream(new OutputStream() {
public void write(int b) {
//do nothing
}
});
System.setOut(dummyStream);
System.setErr(dummyStream);

timer = new Timer();
timerCounter = 0;
secondsPlayed = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/app/musicplayer/util/XMLEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,13 @@ private static void musicDirFileFinder(File musicDirectoryFile) {
}

private static void addSongToXML() {

// Initializes the array list with song objects to add to the xml file.
ArrayList<Song> songsToAdd = createNewSongObject();

if (songsToAdd.size() == 0) {
return;
}

try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Expand Down

0 comments on commit 49594ee

Please sign in to comment.