7474import java .io .BufferedReader ;
7575import java .io .File ;
7676import java .io .IOException ;
77+ import java .nio .charset .Charset ;
7778import java .text .SimpleDateFormat ;
7879import java .util .ArrayList ;
7980import java .util .Arrays ;
@@ -592,20 +593,7 @@ private boolean isJobDone(PipelineJob job) throws Exception
592593 //on failure, append contents of pipeline job file to primary error log
593594 if (job .getLogFile () != null )
594595 {
595- StringBuilder sb = new StringBuilder ();
596- try (BufferedReader reader = Readers .getReader (job .getLogFile ()))
597- {
598- sb .append ("*******************\n " );
599- sb .append ("Error running sequence junit tests. Pipeline log:\n " );
600- String line ;
601- while ((line = reader .readLine ()) != null ) {
602- sb .append (line ).append ('\n' );
603- }
604-
605- sb .append ("*******************\n " );
606- }
607-
608- _log .error (sb .toString ());
596+ writeJobLogToLog (job );
609597 }
610598 else
611599 {
@@ -618,9 +606,27 @@ private boolean isJobDone(PipelineJob job) throws Exception
618606 return false ; //job != null && job.getActiveTaskId() != null;
619607 }
620608
609+ protected void writeJobLogToLog (PipelineJob job ) throws IOException
610+ {
611+ StringBuilder sb = new StringBuilder ();
612+ try (BufferedReader reader = Readers .getReader (job .getLogFile ()))
613+ {
614+ sb .append ("*******************\n " );
615+ sb .append ("Error running sequence junit tests. Pipeline log:\n " );
616+ String line ;
617+ while ((line = reader .readLine ()) != null ) {
618+ sb .append (line ).append ('\n' );
619+ }
620+
621+ sb .append ("*******************\n " );
622+ }
623+
624+ _log .error (sb .toString ());
625+ }
626+
621627 protected JSONObject substituteParams (File xml , String jobName ) throws IOException
622628 {
623- String content = FileUtils .readFileToString (xml );
629+ String content = FileUtils .readFileToString (xml , Charset . defaultCharset () );
624630 content = content .replaceAll ("@@BASEURL@@" , AppProps .getInstance ().getBaseServerUrl () + AppProps .getInstance ().getContextPath ());
625631 content = content .replaceAll ("@@CONTAINERID@@" , _project .getPath ());
626632 content = content .replaceAll ("@@CONTAINERPATH@@" , _project .getPath ());
0 commit comments