Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E090017399 for ; Sat, 7 Nov 2015 12:15:53 +0000 (UTC) Received: (qmail 4018 invoked by uid 500); 7 Nov 2015 12:15:53 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 3992 invoked by uid 500); 7 Nov 2015 12:15:53 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 3983 invoked by uid 99); 7 Nov 2015 12:15:53 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Nov 2015 12:15:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 49907C511F for ; Sat, 7 Nov 2015 12:15:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.99 X-Spam-Level: X-Spam-Status: No, score=0.99 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id yAVwrjwxU7j6 for ; Sat, 7 Nov 2015 12:15:52 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 6AFF92095B for ; Sat, 7 Nov 2015 12:15:51 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8B945E050C for ; Sat, 7 Nov 2015 12:15:50 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 89C5E3A08D2 for ; Sat, 7 Nov 2015 12:15:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1713114 - /pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Date: Sat, 07 Nov 2015 12:15:50 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151107121550.89C5E3A08D2@svn01-us-west.apache.org> Author: tilman Date: Sat Nov 7 12:15:50 2015 New Revision: 1713114 URL: http://svn.apache.org/viewvc?rev=1713114&view=rev Log: PDFBOX-3044: change encoding to utf8, don't fail immediately Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java?rev=1713114&r1=1713113&r2=1713114&view=diff ============================================================================== --- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java (original) +++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Sat Nov 7 12:15:50 2015 @@ -16,6 +16,7 @@ */ package org.apache.pdfbox.util; +import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; @@ -99,7 +100,7 @@ public class TestTextStripper extends Te private boolean bFail = false; private PDFTextStripper stripper = null; - private final String encoding = "UTF-16LE"; + private final String encoding = "UTF-8"; /** * Test class constructor. @@ -242,7 +243,7 @@ public class TestTextStripper extends Te } } - PDDocument document = PDDocument.load(inFile); + PDDocument document = PDDocument.loadNonSeq(inFile, null); try { @@ -262,10 +263,11 @@ public class TestTextStripper extends Te OutputStream os = new FileOutputStream(outFile); try { - os.write( 0xFF ); - os.write( 0xFE ); + os.write (0xEF); + os.write (0xBB); + os.write (0xBF); - Writer writer = new OutputStreamWriter(os, encoding); + Writer writer = new BufferedWriter(new OutputStreamWriter(os, encoding)); try { //Allows for sorted tests stripper.setSortByPosition(bSort); @@ -292,6 +294,8 @@ public class TestTextStripper extends Te " did not exist"); return; } + + boolean localFail = false; LineNumberReader expectedReader = new LineNumberReader(new InputStreamReader(new FileInputStream(expectedFile), encoding)); @@ -313,6 +317,7 @@ public class TestTextStripper extends Te if (!stringsEqual(expectedLine, actualLine)) { this.bFail = true; + localFail = true; log.error("FAILURE: Line mismatch for file " + inFile.getName() + " ( sort = "+bSort+")" + " at expected line: " + expectedReader.getLineNumber() + @@ -329,6 +334,12 @@ public class TestTextStripper extends Te break; } } + expectedReader.close(); + actualReader.close(); + if (!localFail) + { + outFile.delete(); + } } finally {