From 8379b2e4a5dd76fcbd344b7a152dc14629f64ae9 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 22 Sep 2014 16:55:49 +0200 Subject: [client] do commit the changes :) --- dozentenmodul/src/main/java/ftp/DownloadTask.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'dozentenmodul/src/main/java/ftp/DownloadTask.java') diff --git a/dozentenmodul/src/main/java/ftp/DownloadTask.java b/dozentenmodul/src/main/java/ftp/DownloadTask.java index 5592adba..02bfbe4d 100644 --- a/dozentenmodul/src/main/java/ftp/DownloadTask.java +++ b/dozentenmodul/src/main/java/ftp/DownloadTask.java @@ -1,6 +1,7 @@ package ftp; import gui.image.FTPEditDownloader_GUI; +import gui.intro.Login_GUI; import java.io.File; import java.io.FileOutputStream; @@ -9,6 +10,8 @@ import java.io.InputStream; import javax.swing.JOptionPane; import javax.swing.SwingWorker; +import org.apache.log4j.Logger; + /** * Execute file download in a background thread and update the progress. * @@ -17,6 +20,11 @@ import javax.swing.SwingWorker; */ public class DownloadTask extends SwingWorker { + /** + * Logger instance for this class. + */ + private final static Logger LOGGER = Logger.getLogger(DownloadTask.class); + private static final int BUFFER_SIZE = 4096; private String host; @@ -69,7 +77,6 @@ public class DownloadTask extends SwingWorker { && isCancelled() == false) { outputStream.write(buffer, 0, bytesRead); totalBytesRead += bytesRead; - // System.out.println(totalBytesRead); double speed = NANOS_PER_SECOND / BYTES_PER_MIB * totalBytesRead / (System.nanoTime() - start + 1); percentCompleted = (int) (totalBytesRead * 100 / fileSize); @@ -103,12 +110,12 @@ public class DownloadTask extends SwingWorker { @Override protected void done() { if (!isCancelled() && percentCompleted==100) { - System.out.println("Datei erfolgreich heruntergeladen"); + LOGGER.info("Datei erfolgreich heruntergeladen."); JOptionPane.showMessageDialog(null, "Datei erfolgreich heruntergeladen.", "Message", JOptionPane.INFORMATION_MESSAGE); } else if(!isCancelled() && percentCompleted != 100){ - System.out.println("Datein wurde unvollständig heruntergeladen"); + LOGGER.error("Datei wurde unvollständig heruntergeladen."); JOptionPane.showMessageDialog(null, "Datei wurde unvollständig heruntergeladen. Bitte wiederholen.", "Message", JOptionPane.INFORMATION_MESSAGE); -- cgit v1.2.3-55-g7522