Browse Source

FOP-2762: Serialisation issues with accessibility and conserve-memory

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1862557 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_4
Simon Steiner 4 years ago
parent
commit
e7daec61ad

+ 3
- 1
fop-core/src/main/java/org/apache/fop/pdf/PDFName.java View File

@@ -21,14 +21,16 @@ package org.apache.fop.pdf;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;

import org.apache.commons.io.output.CountingOutputStream;

/**
* Class representing a PDF name object.
*/
public class PDFName extends PDFObject {
public class PDFName extends PDFObject implements Serializable {

private static final long serialVersionUID = -968412396459739925L;
private String name;

/**

+ 6
- 2
fop-core/src/main/java/org/apache/fop/pdf/PDFStructElem.java View File

@@ -22,6 +22,7 @@ package org.apache.fop.pdf;
import java.io.IOException;
import java.io.OutputStream;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -35,8 +36,9 @@ import org.apache.fop.util.LanguageTags;
* Class representing a PDF Structure Element.
*/
public class PDFStructElem extends StructureHierarchyMember
implements StructureTreeElement, CompressedObject {
implements StructureTreeElement, CompressedObject, Serializable {

private static final long serialVersionUID = -3055241807589202532L;
private StructureType structureType;

protected PDFStructElem parentElement;
@@ -246,7 +248,7 @@ public class PDFStructElem extends StructureHierarchyMember
}

public int output(OutputStream stream) throws IOException {
if (getDocument().getProfile().getPDFUAMode().isEnabled()) {
if (getDocument() != null && getDocument().getProfile().getPDFUAMode().isEnabled()) {
if (entries.containsKey("Alt") && "".equals(get("Alt"))) {
put("Alt", "No alternate text specified");
} else if (kids != null) {
@@ -275,6 +277,8 @@ public class PDFStructElem extends StructureHierarchyMember
*/
public static class Placeholder extends PDFStructElem {

private static final long serialVersionUID = -2397980642558372068L;

@Override
public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException {
if (kids != null) {

+ 3
- 1
fop-core/src/main/java/org/apache/fop/pdf/StandardStructureTypes.java View File

@@ -19,6 +19,7 @@

package org.apache.fop.pdf;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@@ -98,8 +99,9 @@ public final class StandardStructureTypes {
public static final StructureType FORM = new StructureTypeImpl("Form");
}

private static class StructureTypeImpl implements StructureType {
private static class StructureTypeImpl implements StructureType, Serializable {

private static final long serialVersionUID = 8577475043360334210L;
private final PDFName name;

protected StructureTypeImpl(String name) {

+ 1
- 0
fop-core/src/main/java/org/apache/fop/render/pdf/PageSequenceStructElem.java View File

@@ -29,6 +29,7 @@ import org.apache.fop.pdf.StructureType;

public class PageSequenceStructElem extends PDFStructElem {

private static final long serialVersionUID = -9146602678931267198L;
private List<PDFStructElem> regionBefores = new ArrayList<PDFStructElem>();

private List<PDFStructElem> regionAfters = new ArrayList<PDFStructElem>();

+ 1
- 0
fop-core/src/main/java/org/apache/fop/render/pdf/TableStructElem.java View File

@@ -25,6 +25,7 @@ import org.apache.fop.pdf.StructureType;

class TableStructElem extends PDFStructElem {

private static final long serialVersionUID = -3550873504343680465L;
private PDFStructElem tableFooter;

public TableStructElem(PDFObject parent, StructureType structureType) {

+ 1
- 0
fop-core/src/test/java/org/apache/fop/render/ConserveMemoryTestCase.java View File

@@ -58,6 +58,7 @@ public class ConserveMemoryTestCase {
FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setConserveMemoryPolicy(true);
userAgent.setAccessibility(true);
Fop fop = fopFactory.newFop("application/pdf", userAgent, new ByteArrayOutputStream());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));

Loading…
Cancel
Save