X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Freports%2FNotify.java;h=547b657f1789be4d776975512ee788e821b2c6d1;hb=12414fe43077e12d7ef711951b1633ad31d73573;hp=cb57497e80ec341f1920b1e12a68fcfcc14b49f2;hpb=781ab3c11ca25212e76cb3c5f9671e867eaaac0a;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java index cb57497e..547b657f 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java @@ -19,16 +19,16 @@ * */package org.onap.aaf.auth.batch.reports; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.FileReader; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import org.onap.aaf.auth.batch.Batch; @@ -67,29 +67,35 @@ public class Notify extends Batch { throw new APIException("Unable to construct " + mailerCls,e); } - FileInputStream fis = new FileInputStream(header_html); + String line; + StringBuilder sb = new StringBuilder(); + BufferedReader br = new BufferedReader(new FileReader(header_html)); try { - byte[] content = new byte[(int)fis.getChannel().size()]; - fis.read(content); - header = new String(content); + while((line=br.readLine())!=null) { + sb.append(line); + sb.append('\n'); + } + header = sb.toString(); } finally { - fis.close(); + br.close(); } - fis = new FileInputStream(footer_html); + br = new BufferedReader(new FileReader(footer_html)); try { - byte[] content = new byte[(int)fis.getChannel().size()]; - fis.read(content); - footer = new String(content); + while((line=br.readLine())!=null) { + sb.append(line); + sb.append('\n'); + } + footer = sb.toString(); } finally { - fis.close(); + br.close(); } // Class Load possible data NotifyBody.load(env.access()); // Create Intermediate Output - File logDir = new File(logDir()); + File logDir = logDir(); notifyFile = new ArrayList<>(); if(args().length>0) { for(int i=0;i