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



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


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


/** /**
* Class representing a PDF name object. * 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; private String name;


/** /**

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

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


import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
* Class representing a PDF Structure Element. * Class representing a PDF Structure Element.
*/ */
public class PDFStructElem extends StructureHierarchyMember public class PDFStructElem extends StructureHierarchyMember
implements StructureTreeElement, CompressedObject {
implements StructureTreeElement, CompressedObject, Serializable {


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


protected PDFStructElem parentElement; protected PDFStructElem parentElement;
} }


public int output(OutputStream stream) throws IOException { 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"))) { if (entries.containsKey("Alt") && "".equals(get("Alt"))) {
put("Alt", "No alternate text specified"); put("Alt", "No alternate text specified");
} else if (kids != null) { } else if (kids != null) {
*/ */
public static class Placeholder extends PDFStructElem { public static class Placeholder extends PDFStructElem {


private static final long serialVersionUID = -2397980642558372068L;

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

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



package org.apache.fop.pdf; package org.apache.fop.pdf;


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


public static final StructureType FORM = new StructureTypeImpl("Form"); 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; private final PDFName name;


protected StructureTypeImpl(String name) { protected StructureTypeImpl(String name) {

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



public class PageSequenceStructElem extends PDFStructElem { public class PageSequenceStructElem extends PDFStructElem {


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


private List<PDFStructElem> regionAfters = 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



class TableStructElem extends PDFStructElem { class TableStructElem extends PDFStructElem {


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


public TableStructElem(PDFObject parent, StructureType structureType) { public TableStructElem(PDFObject parent, StructureType structureType) {

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

FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
FOUserAgent userAgent = fopFactory.newFOUserAgent(); FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setConserveMemoryPolicy(true); userAgent.setConserveMemoryPolicy(true);
userAgent.setAccessibility(true);
Fop fop = fopFactory.newFop("application/pdf", userAgent, new ByteArrayOutputStream()); Fop fop = fopFactory.newFop("application/pdf", userAgent, new ByteArrayOutputStream());
Transformer transformer = TransformerFactory.newInstance().newTransformer(); Transformer transformer = TransformerFactory.newInstance().newTransformer();
Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes())); Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));

Loading…
Cancel
Save