You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/08/30 21:16:16 UTC

svn commit: r1881334 - /pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java

Author: lehmi
Date: Sun Aug 30 21:16:16 2020
New Revision: 1881334

URL: http://svn.apache.org/viewvc?rev=1881334&view=rev
Log:
PDFBOX-4945: support path names including special characters as proposed by Tilman Hausherr

Modified:
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java?rev=1881334&r1=1881333&r2=1881334&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/io/RandomAccessReadBufferedFileTest.java Sun Aug 30 21:16:16 2020
@@ -21,7 +21,9 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
 import java.io.IOException;
+import java.net.URISyntaxException;
 
 import org.junit.Test;
 
@@ -31,10 +33,10 @@ import org.junit.Test;
 public class RandomAccessReadBufferedFileTest
 {
     @Test
-    public void testPositionSkip() throws IOException
+    public void testPositionSkip() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         assertEquals(0, randomAccessSource.getPosition());
         randomAccessSource.skip(5);
@@ -45,10 +47,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testPositionRead() throws IOException
+    public void testPositionRead() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         assertEquals(0, randomAccessSource.getPosition());
         assertEquals('0', randomAccessSource.read());
@@ -62,10 +64,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testSeekEOF() throws IOException
+    public void testSeekEOF() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         randomAccessSource.seek(3);
         assertEquals(3, randomAccessSource.getPosition());
@@ -99,10 +101,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testPositionReadBytes() throws IOException
+    public void testPositionReadBytes() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         assertEquals(0, randomAccessSource.getPosition());
         byte[] buffer = new byte[4];
@@ -122,10 +124,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testPositionPeek() throws IOException
+    public void testPositionPeek() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         assertEquals(0, randomAccessSource.getPosition());
         randomAccessSource.skip(6);
@@ -138,10 +140,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testPositionUnreadBytes() throws IOException
+    public void testPositionUnreadBytes() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedFile1.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedFile1.txt").toURI()));
 
         assertEquals(0, randomAccessSource.getPosition());
         randomAccessSource.read();
@@ -162,10 +164,10 @@ public class RandomAccessReadBufferedFil
     }
 
     @Test
-    public void testEmptyBuffer() throws IOException
+    public void testEmptyBuffer() throws IOException, URISyntaxException
     {
         RandomAccessRead randomAccessSource = new RandomAccessReadBufferedFile(
-                this.getClass().getResource("RandomAccessReadBufferedEmptyFile.txt").getFile());
+                new File(getClass().getResource("RandomAccessReadBufferedEmptyFile.txt").toURI()));
 
         assertEquals(-1, randomAccessSource.read());
         assertEquals(-1, randomAccessSource.peek());