knguyen     2005/04/08 14:48:40 CEST

  Modified files:
    core/src/java/org/jahia/services/fileextraction 
                                                    PDFExtractor.java 
  Log:
  - fix pdf and charset parsing
  
  Revision  Changes    Path
  1.4       +7 -10     
jahia/core/src/java/org/jahia/services/fileextraction/PDFExtractor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/fileextraction/PDFExtractor.java.diff?r1=1.3&r2=1.4&f=h
  
  
  
  Index: PDFExtractor.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/fileextraction/PDFExtractor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFExtractor.java 25 Feb 2005 12:50:45 -0000      1.3
  +++ PDFExtractor.java 8 Apr 2005 12:48:40 -0000       1.4
  @@ -73,20 +73,17 @@
   
               //create a tmp output stream with the size of the content.
               ByteArrayOutputStream out = new ByteArrayOutputStream();
  -            OutputStreamWriter writer = new OutputStreamWriter(out);
  +            OutputStreamWriter writer = null;
  +            if ( charSet != null ) {
  +                writer = new OutputStreamWriter(out,charSet);
  +            } else {
  +                writer = new OutputStreamWriter(out);
  +            }
               PDFTextStripper stripper = new PDFTextStripper();
               stripper.writeText(pdfDocument, writer);
               writer.close();
   
  -            byte[] contents = out.toByteArray();
  -            Reader reader = null;
  -
  -            if ( charSet != null ){
  -                reader = new InputStreamReader(new 
ByteArrayInputStream(contents),charSet);
  -            } else {
  -                reader = new InputStreamReader(new 
ByteArrayInputStream(contents));
  -            }
  -            String content = FileUtils.readerToString(reader);
  +            String content = out.toString(charSet);
               if ( content == null ){
                   content = "";
               }
  

Reply via email to