From 0e59a64b983d7d6872794887d1d8dec51b4c8cd6 Mon Sep 17 00:00:00 2001 From: Bianca Schnalzer Date: Wed, 23 Aug 2017 14:33:46 +0200 Subject: Internet Connection Tracking --- .../pdfover/gui/utils/CertificateDownloadSource.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java index 955097fc..f6c1eb29 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java @@ -60,14 +60,7 @@ public class CertificateDownloadSource { URL url = new URL(Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); - - int b = is.read(); - if (b==-1) - { - log.info("Cannot read file"); - } - else - { + BufferedInputStream bis = new BufferedInputStream(is); FileOutputStream fis2 = new FileOutputStream(new File(Constants.RES_CERT_LIST_ADDED)); @@ -80,7 +73,7 @@ public class CertificateDownloadSource { fis2.close(); bis.close(); downloadCertificatesFromServer(); - } + } catch (IOException e) { log.debug("File not found");} @@ -110,9 +103,7 @@ public class CertificateDownloadSource { Node certificates_added = doc_added.getFirstChild(); NodeList certificates_added_list = certificates_added.getChildNodes(); - - if (doc_added.hasChildNodes()) - { + //identify the certificate that has to be downloaded for (int i = 0; i < certificates_added_list.getLength(); i++) { try { @@ -152,7 +143,9 @@ public class CertificateDownloadSource { } } - }} + } + + } catch (IOException e) { e.printStackTrace(); -- cgit v1.2.3