From kcardineaud@users.nuiton.org Tue May 17 16:34:48 2011 From: kcardineaud@users.nuiton.org To: jrst-commits@list.nuiton.org Subject: [Jrst-commits] r582 - trunk/jrst/src/test/java/org/nuiton/jrst Date: Tue, 17 May 2011 16:34:48 +0200 Message-ID: <20110517143448.6B03D16E0B@nuiton.codelutin.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0389058683337379636==" --===============0389058683337379636== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: kcardineaud Date: 2011-05-17 16:34:48 +0200 (Tue, 17 May 2011) New Revision: 582 Url: http://nuiton.org/repositories/revision/jrst/582 Log: Modification de ThreadRedirection.java pour l'utiliser avec des sorties de ty= pe HTML Modified: trunk/jrst/src/test/java/org/nuiton/jrst/ThreadRedirection.java Modified: trunk/jrst/src/test/java/org/nuiton/jrst/ThreadRedirection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jrst/src/test/java/org/nuiton/jrst/ThreadRedirection.java 2011-05-1= 7 14:17:34 UTC (rev 581) +++ trunk/jrst/src/test/java/org/nuiton/jrst/ThreadRedirection.java 2011-05-1= 7 14:34:48 UTC (rev 582) @@ -29,10 +29,15 @@ import java.io.IOException; import java.io.InputStreamReader; =20 +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * Class qui redirige la sortie standard pour la laisser en interne */ public class ThreadRedirection extends Thread { + private static Log log =3D LogFactory.getLog(ThreadRedirection.class); public static final String LINE_SEPARATOR =3D "\n"; protected StringBuffer str; protected Process process; @@ -44,24 +49,38 @@ =20 @Override public void run() { + BufferedReader reader =3Dnull; try { - BufferedReader reader =3D new BufferedReader(new InputStreamRead= er( - process.getInputStream())); - try { + =09 + reader =3D new BufferedReader(new InputStreamReader( + process.getInputStream()),8193); + =20 String line; while ((line =3D reader.readLine()) !=3D null) { - str.append(line + LINE_SEPARATOR); + =09 + /*Le doctype est modifie pour eviter que sax telecharge la = DTD du HTML sur le net, car le traitement prend un certain temps. + On doit en revanche sp=C3=A9cifier la signification de = nbsp. + */ + =09 + if(!line.equals("")) + { + str.append(line + LINE_SEPARATOR); + } + else { + str.append("]> " + LINE_SEPARATOR); + } } =20 - } finally { - reader.close(); + =20 } - } catch (IOException ioe) { + catch (IOException ioe) { ioe.printStackTrace(); - } + }=20 + finally { + IOUtils.closeQuietly(reader);} } =20 public String getOutput() { - return str.toString(); + return str.toString(); } } --===============0389058683337379636==--