Use standard Java 8 Temurin setup; fix test issues (#13)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e07577b..95c9458 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -21,14 +21,14 @@
 
     steps:
     - uses: actions/checkout@v3
-    - run: |
-        wget -O $RUNNER_TEMP/java_package.tar.gz -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
-    - uses: actions/setup-java@v3
+    - name: Set up JDK 8
+      uses: actions/setup-java@v3
       with:
-        distribution: 'jdkfile'
-        jdkFile: ${{ runner.temp }}/java_package.tar.gz
-        java-version: '8.0.0'
-        architecture: x64
+        java-version: '8'
+        distribution: 'temurin'
+        cache: maven
+    - name: Show Maven Version
+      run: mvn --version
     - name: Build with Maven
       run: mvn -B package checkstyle:check findbugs:check --file pom.xml
 
diff --git a/.gitignore b/.gitignore
index b4ec6dd..c895464 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,10 @@
 # miscellaneous
 *~
 *.bak
+
+# intellij artifacts
+.idea/
+*.iml
+
+# temporary ignores
+.sdkmanrc
diff --git a/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java b/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java
index 2f61da5..4732935 100644
--- a/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java
@@ -79,21 +79,24 @@
 
     private String pdfToPS(PDDocument doc, String pdf, String font, LazyFont lazyFont)
             throws IOException, ImageException {
-        ImageConverterPDF2G2D i = new ImageConverterPDF2G2D();
-        ImageInfo imgi = new ImageInfo(pdf, "b");
-        org.apache.xmlgraphics.image.loader.Image img = new ImagePDF(imgi, doc);
-        ImageGraphics2D ig = (ImageGraphics2D)i.convert(img, null);
-        GeneralGraphics2DImagePainter g = (GeneralGraphics2DImagePainter) ig.getGraphics2DImagePainter();
-        g.addFallbackFont(font, lazyFont);
-        ByteArrayOutputStream stream = new ByteArrayOutputStream();
-        PSPDFGraphics2D g2d = (PSPDFGraphics2D)
-                g.getGraphics(true, new PDFBoxAdapterTestCase.FOPPSGeneratorImpl(stream));
-        Rectangle2D rect = new Rectangle2D.Float(0, 0, 100, 100);
-        GraphicContext gc = new GraphicContext();
-        g2d.setGraphicContext(gc);
-        g.paint(g2d, rect);
-        doc.close();
-        return stream.toString("UTF-8");
+        try {
+            ImageConverterPDF2G2D i = new ImageConverterPDF2G2D();
+            ImageInfo imgi = new ImageInfo(pdf, "b");
+            org.apache.xmlgraphics.image.loader.Image img = new ImagePDF(imgi, doc);
+            ImageGraphics2D ig = (ImageGraphics2D) i.convert(img, null);
+            GeneralGraphics2DImagePainter g = (GeneralGraphics2DImagePainter) ig.getGraphics2DImagePainter();
+            g.addFallbackFont(font, lazyFont);
+            ByteArrayOutputStream stream = new ByteArrayOutputStream();
+            PSPDFGraphics2D g2d = (PSPDFGraphics2D)
+                    g.getGraphics(true, new PDFBoxAdapterTestCase.FOPPSGeneratorImpl(stream));
+            Rectangle2D rect = new Rectangle2D.Float(0, 0, 100, 100);
+            GraphicContext gc = new GraphicContext();
+            g2d.setGraphicContext(gc);
+            g.paint(g2d, rect);
+            return stream.toString("UTF-8");
+        } finally {
+            doc.close();
+        }
     }
 
     static class MyLazyFont extends LazyFont {
diff --git a/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java b/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
index 03dbc05..dba67bc 100644
--- a/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/PDFWriterTestCase.java
@@ -44,17 +44,19 @@
     @Test
     public void testFloatCache() throws IOException {
         String text = "[1.1 1.1] a";
-        PDStream pdStream = new PDStream(new PDDocument(), new ByteArrayInputStream(text.getBytes("UTF-8")));
+        PDDocument doc = new PDDocument();
+        PDStream pdStream = new PDStream(doc, new ByteArrayInputStream(text.getBytes("UTF-8")));
         MyPDFWriter pdfWriter = new MyPDFWriter();
         pdfWriter.writeText(pdStream);
-        Assert.assertEquals(pdfWriter.i, 1);
+        doc.close();
+        Assert.assertEquals(1, pdfWriter.i);
     }
 
     private static class MyPDFWriter extends PDFWriter {
         int i;
 
         public MyPDFWriter() {
-            super(null, 0);
+            super(new UniqueName("", null, true), 0);
         }
 
         protected void addCache(float f) {
@@ -67,7 +69,7 @@
     public void testBoolean() throws IOException {
         String text = "[true true ] a\n";
         PDStream pdStream = new PDStream(new PDDocument(), new ByteArrayInputStream(text.getBytes("UTF-8")));
-        PDFWriter pdfWriter = new MyPDFWriter();
+        PDFWriter pdfWriter = new PDFWriter(new UniqueName("", null, true), 0);
         String out = pdfWriter.writeText(pdStream);
         Assert.assertEquals(out, text);
     }
@@ -76,7 +78,7 @@
     public void testNull() throws IOException {
         String text = "[null ] a\n";
         PDStream pdStream = new PDStream(new PDDocument(), new ByteArrayInputStream(text.getBytes("UTF-8")));
-        PDFWriter pdfWriter = new MyPDFWriter();
+        PDFWriter pdfWriter = new PDFWriter(new UniqueName("", null, true), 0);
         String out = pdfWriter.writeText(pdStream);
         Assert.assertEquals(out, text);
     }