You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2009/03/05 12:04:00 UTC
svn commit: r750418 [6/7] - in /xmlgraphics/commons/trunk:
examples/java/image/loader/ examples/java/image/writer/
examples/java/java2d/ps/ examples/java/ps/ examples/java/xmp/
src/java/org/apache/xmlgraphics/image/
src/java/org/apache/xmlgraphics/imag...
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArray.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArray.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArray.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArray.java Thu Mar 5 11:03:54 2009
@@ -27,14 +27,14 @@
/**
* Represents an XMP array as defined by the XMP specification.
- * @todo Property qualifiers are currently not supported, yet.
+ * @todo Property qualifiers are currently not supported, yet.
*/
public class XMPArray extends XMPComplexValue {
private XMPArrayType type;
private List values = new java.util.ArrayList();
private List xmllang = new java.util.ArrayList();
-
+
/**
* Main constructor
* @param type the intended type of array
@@ -42,12 +42,12 @@
public XMPArray(XMPArrayType type) {
this.type = type;
}
-
+
/** @return the type of array */
public XMPArrayType getType() {
return this.type;
}
-
+
/**
* Returns the value at a given position.
* @param idx the index of the requested value
@@ -89,7 +89,7 @@
}
return null;
}
-
+
/**
* Returns a language-dependent values (available for alternative arrays).
* @param lang the language ("x-default" for the default value)
@@ -124,7 +124,7 @@
}
return v;
}
-
+
/**
* Removes a language-dependent value
* @param lang the language ("x-default" for the default value)
@@ -142,7 +142,7 @@
}
}
}
-
+
/**
* Adds a new value to the array
* @param value the value
@@ -166,7 +166,7 @@
public int getSize() {
return this.values.size();
}
-
+
/**
* Converts the array to an object array.
* @return an object array of all values in the array
@@ -182,7 +182,7 @@
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- handler.startElement(XMPConstants.RDF_NAMESPACE,
+ handler.startElement(XMPConstants.RDF_NAMESPACE,
type.getName(), "rdf:" + type.getName(), atts);
for (int i = 0, c = values.size(); i < c; i++) {
String lang = (String)xmllang.get(i);
@@ -190,7 +190,7 @@
if (lang != null) {
atts.addAttribute(XMPConstants.XML_NS, "lang", "xml:lang", "CDATA", lang);
}
- handler.startElement(XMPConstants.RDF_NAMESPACE,
+ handler.startElement(XMPConstants.RDF_NAMESPACE,
"li", "rdf:li", atts);
Object v = values.get(i);
if (v instanceof XMPComplexValue) {
@@ -200,10 +200,10 @@
char[] chars = value.toCharArray();
handler.characters(chars, 0, chars.length);
}
- handler.endElement(XMPConstants.RDF_NAMESPACE,
+ handler.endElement(XMPConstants.RDF_NAMESPACE,
"li", "rdf:li");
}
- handler.endElement(XMPConstants.RDF_NAMESPACE,
+ handler.endElement(XMPConstants.RDF_NAMESPACE,
type.getName(), "rdf:" + type.getName());
}
@@ -212,5 +212,5 @@
return "XMP array: " + type + ", " + getSize();
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArrayType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArrayType.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArrayType.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPArrayType.java Thu Mar 5 11:03:54 2009
@@ -28,7 +28,7 @@
public static final XMPArrayType SEQ = new XMPArrayType("Seq");
/** the alternative array */
public static final XMPArrayType ALT = new XMPArrayType("Alt");
-
+
private String name;
/**
@@ -43,10 +43,10 @@
public String getName() {
return this.name;
}
-
+
/** @see java.lang.Object#toString() */
public String toString() {
return "rdf:" + name;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPComplexValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPComplexValue.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPComplexValue.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPComplexValue.java Thu Mar 5 11:03:54 2009
@@ -32,5 +32,5 @@
* because the value is an array and has multiple entries.
*/
public abstract Object getSimpleValue();
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java Thu Mar 5 11:03:54 2009
@@ -28,22 +28,22 @@
/** Namespace URI for the xml: prefix */
String XML_NS = "http://www.w3.org/XML/1998/namespace";
-
+
/** Namespace URI for the xmlns: prefix */
String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
/** Namespace URI for XMP */
String XMP_NAMESPACE = "adobe:ns:meta/";
-
+
/** Namespace URI for RDF */
String RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
- /** Namespace URI for Dublin Core */
+ /** Namespace URI for Dublin Core */
String DUBLIN_CORE_NAMESPACE = "http://purl.org/dc/elements/1.1/";
-
+
/** Namespace URI for the XMP Basic Schema */
String XMP_BASIC_NAMESPACE = "http://ns.adobe.com/xap/1.0/";
-
+
/** Namespace URI for the Adobe PDF Schema */
String ADOBE_PDF_NAMESPACE = "http://ns.adobe.com/pdf/1.3/";
@@ -53,7 +53,7 @@
* was missing in the original ISO 19005-1:2005 specification)
*/
String PDF_A_IDENTIFICATION = "http://www.aiim.org/pdfa/ns/id/";
-
+
/**
* Namespace URI for the PDF/A Identification Schema
* (from an older draft of ISO 19005-1, used by Adobe Acrobat)
@@ -63,8 +63,8 @@
/** Default language for the xml:lang property */
String DEFAULT_LANGUAGE = "x-default";
-
+
/** QName for rdf:value */
QName RDF_VALUE = new QName(RDF_NAMESPACE, "value");
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java Thu Mar 5 11:03:54 2009
@@ -35,14 +35,14 @@
* it finds and parses it.
* <p>
* Important: Before you use this class to look for an XMP packet in some random file, please read
- * the chapter on "Scanning Files for XMP Packets" in the XMP specification!
+ * the chapter on "Scanning Files for XMP Packets" in the XMP specification!
*/
public class XMPPacketParser {
private static final byte[] PACKET_HEADER;
private static final byte[] PACKET_HEADER_END;
private static final byte[] PACKET_TRAILER;
-
+
static {
try {
PACKET_HEADER = "<?xpacket begin=".getBytes("US-ASCII");
@@ -52,7 +52,7 @@
throw new RuntimeException("Incompatible JVM! US-ASCII encoding not supported.");
}
}
-
+
/**
* Locates an XMP packet in a stream, parses it and returns the XMP metadata. If no
* XMP packet is found until the stream ends, null is returned. Note: This method
@@ -82,16 +82,16 @@
if (!skipAfter(in, PACKET_TRAILER, baout)) {
throw new IOException("XMP packet not properly terminated!");
}
-
+
Metadata metadata = XMPParser.parseXMP(
new StreamSource(new ByteArrayInputStream(baout.toByteArray())));
return metadata;
}
-
+
private static boolean skipAfter(InputStream in, byte[] match) throws IOException {
return skipAfter(in, match, null);
}
-
+
private static boolean skipAfter(InputStream in, byte[] match, OutputStream out)
throws IOException {
int found = 0;
@@ -115,5 +115,5 @@
}
return false;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPParser.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPParser.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPParser.java Thu Mar 5 11:03:54 2009
@@ -42,7 +42,7 @@
public static Metadata parseXMP(URL url) throws TransformerException {
return parseXMP(new StreamSource(url.toExternalForm()));
}
-
+
/**
* Parses an XMP file.
* @param src a JAXP Source object where the XMP file can be loaded from
@@ -65,5 +65,5 @@
public static XMPHandler createXMPHandler() {
return new XMPHandler();
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java Thu Mar 5 11:03:54 2009
@@ -48,17 +48,17 @@
this.name = name;
this.value = value;
}
-
+
/** @return the qualified name of the property (namespace URI + local name) */
public QName getName() {
return this.name;
}
-
+
/** @return the namespace URI of the property */
public String getNamespace() {
return getName().getNamespaceURI();
}
-
+
/**
* Sets the value of the property
* @param value the new value
@@ -66,7 +66,7 @@
public void setValue(Object value) {
this.value = value;
}
-
+
/**
* @return the property value (can be a normal Java object (normally a String) or a descendant
* of XMPComplexValue.
@@ -74,7 +74,7 @@
public Object getValue() {
return this.value;
}
-
+
/**
* Sets the xml:lang value for this property
* @param lang the language ("x-default" for the default language, null to make the value
@@ -83,19 +83,19 @@
public void setXMLLang(String lang) {
this.xmllang = lang;
}
-
+
/**
* @return the language for language-dependent values ("x-default" for the default language)
*/
public String getXMLLang() {
return this.xmllang;
}
-
+
/** @return the XMPArray for an array or null if the value is not an array. */
public XMPArray getArrayValue() {
return (value instanceof XMPArray ? (XMPArray)value : null);
}
-
+
/**
* Converts a simple value to an array of a given type if the value is not already an array.
* @param type the desired type of array
@@ -112,12 +112,12 @@
setXMLLang(null);
}
}
-
+
/** @return the XMPStructure for a structure or null if the value is not a structure. */
public PropertyAccess getStructureValue() {
return (value instanceof XMPStructure ? (XMPStructure)value : null);
}
-
+
private boolean hasPropertyQualifiers() {
return (this.qualifiers == null) || (this.qualifiers.size() == 0);
}
@@ -137,7 +137,7 @@
return hasPropertyQualifiers();
}
}
-
+
public void simplify() {
PropertyAccess props = getStructureValue();
if (props != null) {
@@ -159,8 +159,8 @@
}
}
}
-
-
+
+
private void setPropertyQualifier(QName name, XMPProperty property) {
if (this.qualifiers == null) {
this.qualifiers = new java.util.HashMap();
@@ -176,12 +176,12 @@
}
return prefix + ":" + getName().getLocalName();
}
-
+
/** @see org.apache.xmlgraphics.util.XMLizable#toSAX(org.xml.sax.ContentHandler) */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
String qName = getEffectiveQName();
- handler.startElement(getName().getNamespaceURI(),
+ handler.startElement(getName().getNamespaceURI(),
getName().getLocalName(), qName, atts);
if (value instanceof XMPComplexValue) {
XMPComplexValue cv = ((XMPComplexValue)value);
@@ -190,7 +190,7 @@
char[] chars = value.toString().toCharArray();
handler.characters(chars, 0, chars.length);
}
- handler.endElement(getName().getNamespaceURI(),
+ handler.endElement(getName().getNamespaceURI(),
getName().getLocalName(), qName);
}
@@ -201,5 +201,5 @@
sb.append(getValue());
return sb.toString();
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchema.java Thu Mar 5 11:03:54 2009
@@ -31,7 +31,7 @@
private String namespace;
private String prefix;
-
+
/**
* Constructs a new XMP schema object.
* @param namespace the namespace URI for the schema
@@ -41,17 +41,17 @@
this.namespace = namespace;
this.prefix = preferredPrefix;
}
-
+
/** @return the namespace URI of the schema */
public String getNamespace() {
return this.namespace;
}
-
+
/** @return the preferred prefix of the schema */
public String getPreferredPrefix() {
return this.prefix;
}
-
+
/**
* Returns the QName for a property of this schema.
* @param propName the property name
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java Thu Mar 5 11:03:54 2009
@@ -34,12 +34,12 @@
private static XMPSchemaRegistry instance = null;
- private Map schemas = new java.util.HashMap();
-
+ private Map schemas = new java.util.HashMap();
+
private XMPSchemaRegistry() {
init();
}
-
+
/** @return the singleton instance of the XMP schema registry. */
public static XMPSchemaRegistry getInstance() {
if (instance == null) {
@@ -47,7 +47,7 @@
}
return instance;
}
-
+
private void init() {
addSchema(new DublinCoreSchema());
addSchema(new PDFAXMPSchema());
@@ -55,7 +55,7 @@
addSchema(new XMPBasicSchema());
addSchema(new AdobePDFSchema());
}
-
+
/**
* Adds an XMP schema to the registry.
* @param schema the XMP schema
@@ -63,7 +63,7 @@
public void addSchema(XMPSchema schema) {
schemas.put(schema.getNamespace(), schema);
}
-
+
/**
* Returns the XMP schema object for a given namespace.
* @param namespace the namespace URI
@@ -72,5 +72,5 @@
public XMPSchema getSchema(String namespace) {
return (XMPSchema)schemas.get(namespace);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPStructure.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPStructure.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPStructure.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPStructure.java Thu Mar 5 11:03:54 2009
@@ -34,13 +34,13 @@
public class XMPStructure extends XMPComplexValue implements PropertyAccess {
private Map properties = new java.util.HashMap();
-
+
/**
* Main constructor
*/
public XMPStructure() {
}
-
+
/** {@inheritDoc} */
public Object getSimpleValue() {
return null;
@@ -50,28 +50,28 @@
public void setProperty(XMPProperty prop) {
properties.put(prop.getName(), prop);
}
-
+
/** {@inheritDoc} */
public XMPProperty getProperty(String uri, String localName) {
return getProperty(new QName(uri, localName));
}
-
+
/** {@inheritDoc} */
public XMPProperty getValueProperty() {
return getProperty(XMPConstants.RDF_VALUE);
}
-
+
/** {@inheritDoc} */
public XMPProperty getProperty(QName name) {
XMPProperty prop = (XMPProperty)properties.get(name);
return prop;
}
-
+
/** {@inheritDoc} */
public int getPropertyCount() {
return this.properties.size();
}
-
+
/** {@inheritDoc} */
public Iterator iterator() {
return this.properties.keySet().iterator();
@@ -82,7 +82,7 @@
AttributesImpl atts = new AttributesImpl();
atts.clear();
handler.startElement(XMPConstants.RDF_NAMESPACE, "RDF", "rdf:Description", atts);
-
+
Iterator props = properties.values().iterator();
while (props.hasNext()) {
XMPProperty prop = (XMPProperty)props.next();
@@ -98,5 +98,5 @@
return "XMP structure: " + getPropertyCount();
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/MergeRuleSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/MergeRuleSet.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/MergeRuleSet.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/MergeRuleSet.java Thu Mar 5 11:03:54 2009
@@ -32,7 +32,7 @@
private Map rules = new java.util.HashMap();
private PropertyMerger defaultMerger = new ReplacePropertyMerger();
-
+
/** Main constructor. */
public MergeRuleSet() {
}
@@ -46,7 +46,7 @@
PropertyMerger merger = (PropertyMerger)rules.get(prop.getName());
return (merger != null ? merger : defaultMerger);
}
-
+
/**
* Adds a merge rule to this set.
* @param propName the name of the property
@@ -55,5 +55,5 @@
public void addRule(QName propName, PropertyMerger merger) {
rules.put(propName, merger);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/PropertyMerger.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/PropertyMerger.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/PropertyMerger.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/merge/PropertyMerger.java Thu Mar 5 11:03:54 2009
@@ -33,5 +33,5 @@
* @param target the target metadata object
*/
void merge(XMPProperty sourceProp, Metadata target);
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreSchema.java Thu Mar 5 11:03:54 2009
@@ -31,22 +31,22 @@
*/
public class DublinCoreSchema extends XMPSchema {
- /** Namespace URI for Dublin Core */
+ /** Namespace URI for Dublin Core */
public static final String NAMESPACE = XMPConstants.DUBLIN_CORE_NAMESPACE;
private static MergeRuleSet dcMergeRuleSet;
-
+
static {
dcMergeRuleSet = new MergeRuleSet();
//Dates are added up not replaced
dcMergeRuleSet.addRule(new QName(NAMESPACE, "date"), new ArrayAddPropertyMerger());
}
-
+
/** Creates a new schema instance for Dublin Core. */
public DublinCoreSchema() {
super(NAMESPACE, "dc");
}
-
+
/**
* Creates and returns an adapter for this schema around the given metadata object.
* @param meta the metadata object
@@ -60,5 +60,5 @@
public MergeRuleSet getDefaultMergeRuleSet() {
return dcMergeRuleSet;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java Thu Mar 5 11:03:54 2009
@@ -68,7 +68,7 @@
public Date getCreateDate() {
return getDateValue(CREATE_DATE);
}
-
+
/**
* Sets the date and time the resource was last modified.
* @param modifyDate the modification date
@@ -81,7 +81,7 @@
public Date getModifyDate() {
return getDateValue(MODIFY_DATE);
}
-
+
/**
* Sets the date and time any metadata for this resource was last changed.
* @param metadataDate the modification date for the metadata
@@ -89,7 +89,7 @@
public void setMetadataDate(Date metadataDate) {
setDateValue(METADATA_DATE, metadataDate);
}
-
+
/** @return the date and time the resource was originally created */
public Date getMetadataDate() {
return getDateValue(METADATA_DATE);
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicSchema.java Thu Mar 5 11:03:54 2009
@@ -31,16 +31,16 @@
*/
public class XMPBasicSchema extends XMPSchema {
- /** Namespace URI for XMP Basic */
+ /** Namespace URI for XMP Basic */
public static final String NAMESPACE = XMPConstants.XMP_BASIC_NAMESPACE;
-
+
private static MergeRuleSet mergeRuleSet = new MergeRuleSet();
-
+
/** Creates a new schema instance for Dublin Core. */
public XMPBasicSchema() {
super(NAMESPACE, "xmp");
}
-
+
static {
//CreateDate shall be preserved if it exists
mergeRuleSet.addRule(new QName(NAMESPACE, "CreateDate"), new NoReplacePropertyMerger());
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java Thu Mar 5 11:03:54 2009
@@ -44,7 +44,7 @@
public String getKeywords() {
return getValue(KEYWORDS);
}
-
+
/**
* Sets the keywords.
* @param value the keywords
@@ -57,7 +57,7 @@
public String getPDFVersion() {
return getValue(PDFVERSION);
}
-
+
/**
* Sets the PDF version
* @param value the PDF version (ex. "1.4")
@@ -70,7 +70,7 @@
public String getProducer() {
return getValue(PRODUCER);
}
-
+
/**
* Sets the name of the tool that produced the PDF document
* @param value the producer
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFSchema.java Thu Mar 5 11:03:54 2009
@@ -29,16 +29,16 @@
*/
public class AdobePDFSchema extends XMPSchema {
- /** Namespace URI for the Adobe PDF XMP schema */
+ /** Namespace URI for the Adobe PDF XMP schema */
public static final String NAMESPACE = XMPConstants.ADOBE_PDF_NAMESPACE;
-
+
private static MergeRuleSet mergeRuleSet = new MergeRuleSet();
-
+
/** Creates a new schema instance for Dublin Core. */
public AdobePDFSchema() {
super(NAMESPACE, "pdf");
}
-
+
/**
* Creates and returns an adapter for this schema around the given metadata object.
* @param meta the metadata object
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java Thu Mar 5 11:03:54 2009
@@ -24,8 +24,8 @@
import org.apache.xmlgraphics.xmp.XMPSchemaRegistry;
/**
- * Schema adapter implementation for both the old (deprecated) and the current PDF/A schema.
- * The old namespace is still needed to make Adobe Acrobat happy.
+ * Schema adapter implementation for both the old (deprecated) and the current PDF/A schema.
+ * The old namespace is still needed to make Adobe Acrobat happy.
*/
public class PDFAAdapter extends XMPSchemaAdapter {
@@ -36,7 +36,7 @@
/**
* Constructs a new adapter for PDF/A around the given metadata object.
* @param meta the underlying metadata
- * @param namespace the namespace to access the schema (must be one of the PDF/A schema
+ * @param namespace the namespace to access the schema (must be one of the PDF/A schema
* namespaces)
*/
public PDFAAdapter(Metadata meta, String namespace) {
@@ -63,12 +63,12 @@
public void setAmendment(String value) {
setValue(AMD, value);
}
-
+
/** @return the PDF/A amendment identifier */
public String getAmendment() {
return getValue(AMD);
}
-
+
/**
* Sets the PDF/A conformance level.
* @param value the conformance level ("A" or "B" for PDF/A-1)
@@ -76,10 +76,10 @@
public void setConformance(String value) {
setValue(CONFORMANCE, value);
}
-
+
/** @return the PDF/A conformance level */
public String getConformance() {
return getValue(CONFORMANCE);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAOldXMPSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAOldXMPSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAOldXMPSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAOldXMPSchema.java Thu Mar 5 11:03:54 2009
@@ -31,16 +31,16 @@
*/
public class PDFAOldXMPSchema extends XMPSchema {
- /** Namespace URI for Dublin Core */
+ /** Namespace URI for Dublin Core */
public static final String NAMESPACE = XMPConstants.PDF_A_IDENTIFICATION_OLD;
-
+
private static MergeRuleSet mergeRuleSet = new MergeRuleSet();
-
+
/** Creates a new schema instance for Dublin Core. */
public PDFAOldXMPSchema() {
super(NAMESPACE, "pdfaid_1");
}
-
+
/**
* Creates and returns an adapter for this schema around the given metadata object.
* @param meta the metadata object
@@ -54,6 +54,6 @@
public MergeRuleSet getDefaultMergeRuleSet() {
return mergeRuleSet;
}
-
-
+
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAXMPSchema.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAXMPSchema.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAXMPSchema.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAXMPSchema.java Thu Mar 5 11:03:54 2009
@@ -29,16 +29,16 @@
*/
public class PDFAXMPSchema extends XMPSchema {
- /** Namespace URI for Dublin Core */
+ /** Namespace URI for Dublin Core */
public static final String NAMESPACE = XMPConstants.PDF_A_IDENTIFICATION;
-
+
private static MergeRuleSet mergeRuleSet = new MergeRuleSet();
-
+
/** Creates a new schema instance for Dublin Core. */
public PDFAXMPSchema() {
super(NAMESPACE, "pdfaid");
}
-
+
/**
* Creates and returns an adapter for this schema around the given metadata object.
* @param meta the metadata object
@@ -52,5 +52,5 @@
public MergeRuleSet getDefaultMergeRuleSet() {
return mergeRuleSet;
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/fonts/GlyphsTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/fonts/GlyphsTest.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/fonts/GlyphsTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/fonts/GlyphsTest.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.fonts;
import junit.framework.TestCase;
@@ -29,7 +29,7 @@
public void testGetUnicodeSequenceForGlyphName() throws Exception {
String glyph;
String unicodes;
-
+
glyph = "Omega";
unicodes = Glyphs.getUnicodeSequenceForGlyphName(glyph);
assertEquals(1, unicodes.length());
@@ -47,7 +47,7 @@
assertEquals(1, unicodes.length());
assertEquals("Must contain 0041 - LATIN CAPITAL LETTER A",
unicodes.charAt(0), '\u0041');
-
+
glyph = "rehyehaleflamarabic";
unicodes = Glyphs.getUnicodeSequenceForGlyphName(glyph);
assertEquals(4, unicodes.length());
@@ -59,7 +59,7 @@
unicodes.charAt(2), '\uFE8E');
assertEquals("Expected 0644 - ARABIC LETTER LAM at position 3",
unicodes.charAt(3), '\u0644');
-
+
glyph = "Lcommaaccent_uni20AC0308_u20AC";
unicodes = Glyphs.getUnicodeSequenceForGlyphName(glyph);
assertEquals(4, unicodes.length());
@@ -71,12 +71,12 @@
unicodes.charAt(2), '\u0308');
assertEquals("Must contain 20AC",
unicodes.charAt(3), '\u20AC');
-
+
glyph = "blah";
unicodes = Glyphs.getUnicodeSequenceForGlyphName(glyph);
assertNull(unicodes);
}
-
+
public void testGetCharNameAlternativesFor() throws Exception {
String[] alts = Glyphs.getCharNameAlternativesFor("Omega");
assertEquals(1, alts.length);
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/PNGEncoderTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/PNGEncoderTest.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/PNGEncoderTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/PNGEncoderTest.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,7 +61,7 @@
ig.draw(new Rectangle2D.Double(0.5, 0.5, 199, 149));
ig.dispose();
- image = image.getSubimage(50, 0, 50, 25);
+ image = image.getSubimage(50, 0, 50, 25);
// Create an output stream where the PNG data
// will be stored.
@@ -81,7 +81,7 @@
// Now, try to decode image
InputStream is = buildInputStream(bos);
- PNGImageDecoder pngImageDecoder
+ PNGImageDecoder pngImageDecoder
= new PNGImageDecoder(is, new PNGDecodeParam());
RenderedImage decodedRenderedImage = null;
@@ -95,7 +95,7 @@
decodedRenderedImage.getHeight(),
BufferedImage.TYPE_INT_ARGB);
ig = decodedImage.createGraphics();
- ig.drawRenderedImage(decodedRenderedImage,
+ ig.drawRenderedImage(decodedRenderedImage,
new AffineTransform());
ig.dispose();
}
@@ -130,7 +130,7 @@
public static boolean checkIdentical(BufferedImage imgA,
BufferedImage imgB) {
boolean identical = true;
- if (imgA.getWidth() == imgB.getWidth()
+ if (imgA.getWidth() == imgB.getWidth()
&& imgA.getHeight() == imgB.getHeight()){
int w = imgA.getWidth();
int h = imgA.getHeight();
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/CorruptImagesTestCase.java Thu Mar 5 11:03:54 2009
@@ -27,17 +27,17 @@
public class CorruptImagesTestCase extends TestCase {
private MockImageContext imageContext = MockImageContext.getInstance();
-
+
public CorruptImagesTestCase(String name) {
super(name);
}
-
+
public void testCorruptPNG() throws Exception {
String uri = "corrupt-image.png";
-
+
ImageSessionContext sessionContext = imageContext.newSessionContext();
ImageManager manager = imageContext.getImageManager();
-
+
try {
manager.preloadImage(uri, sessionContext);
fail("Expected an ImageException!");
@@ -46,5 +46,5 @@
assertNotNull(ie.getMessage());
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java Thu Mar 5 11:03:54 2009
@@ -42,24 +42,24 @@
public class ImageLoaderTestCase extends TestCase {
private MockImageContext imageContext = MockImageContext.getInstance();
-
+
public ImageLoaderTestCase(String name) {
super(name);
}
-
+
private MyImageSessionContext createImageSessionContext() {
return new MyImageSessionContext(imageContext);
}
-
+
public void testPNG() throws Exception {
String uri = "asf-logo.png";
-
+
MyImageSessionContext sessionContext = createImageSessionContext();
ImageManager manager = imageContext.getImageManager();
ImageInfo info = manager.preloadImage(uri, sessionContext);
assertNotNull("ImageInfo must not be null", info);
-
+
Image img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, sessionContext);
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
@@ -70,19 +70,19 @@
info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image
assertEquals(126734, info.getSize().getWidthMpt());
assertEquals(38245, info.getSize().getHeightMpt());
-
+
sessionContext.checkAllStreamsClosed();
}
-
+
public void testGIF() throws Exception {
String uri = "bgimg72dpi.gif";
-
+
MyImageSessionContext sessionContext = createImageSessionContext();
ImageManager manager = imageContext.getImageManager();
ImageInfo info = manager.preloadImage(uri, sessionContext);
assertNotNull("ImageInfo must not be null", info);
-
+
Image img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, sessionContext);
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
@@ -93,19 +93,19 @@
info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image
assertEquals(192000, info.getSize().getWidthMpt());
assertEquals(192000, info.getSize().getHeightMpt());
-
+
sessionContext.checkAllStreamsClosed();
}
-
+
public void testEPSASCII() throws Exception {
String uri = "barcode.eps";
-
+
MyImageSessionContext sessionContext = createImageSessionContext();
ImageManager manager = imageContext.getImageManager();
ImageInfo info = manager.preloadImage(uri, sessionContext);
assertNotNull("ImageInfo must not be null", info);
-
+
Image img = manager.getImage(info, ImageFlavor.RAW_EPS, sessionContext);
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.RAW_EPS, img.getFlavor());
@@ -122,19 +122,19 @@
} finally {
IOUtils.closeQuietly(in);
}
-
+
sessionContext.checkAllStreamsClosed();
}
-
+
public void testEPSBinary() throws Exception {
String uri = "img-with-tiff-preview.eps";
-
+
MyImageSessionContext sessionContext = createImageSessionContext();
ImageManager manager = imageContext.getImageManager();
ImageInfo info = manager.preloadImage(uri, sessionContext);
assertNotNull("ImageInfo must not be null", info);
-
+
Image img = manager.getImage(info, ImageFlavor.RAW_EPS, sessionContext);
assertNotNull("Image must not be null", img);
assertEquals(ImageFlavor.RAW_EPS, img.getFlavor());
@@ -151,14 +151,14 @@
} finally {
IOUtils.closeQuietly(in);
}
-
+
sessionContext.checkAllStreamsClosed();
}
-
+
private static class MyImageSessionContext extends MockImageSessionContext {
private List streams = new java.util.ArrayList();
-
+
public MyImageSessionContext(ImageContext context) {
super(context);
}
@@ -175,7 +175,7 @@
}
return src;
}
-
+
/** {@inheritDoc} */
protected Source resolveURI(String uri) {
Source src = super.resolveURI(uri);
@@ -190,7 +190,7 @@
}
return src;
}
-
+
public void checkAllStreamsClosed() {
Iterator iter = streams.iterator();
while (iter.hasNext()) {
@@ -201,7 +201,7 @@
}
}
}
-
+
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageSessionContextTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageSessionContextTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageSessionContextTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageSessionContextTestCase.java Thu Mar 5 11:03:54 2009
@@ -47,11 +47,11 @@
public class ImageSessionContextTestCase extends TestCase {
private MockImageContext imageContext = MockImageContext.getInstance();
-
+
public ImageSessionContextTestCase(String name) {
super(name);
}
-
+
public void testStreamSourceWithSystemID() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -64,7 +64,7 @@
}
};
String uri = "img:asf-logo.png";
-
+
ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
assertTrue(imgSrc.isFastSource()); //Access through local file system
}
@@ -86,7 +86,7 @@
}
};
String uri = "img:asf-logo.png";
-
+
ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
//We don't pass in the URI, so no fast source is possible
assertTrue(!imgSrc.isFastSource());
@@ -105,7 +105,7 @@
}
};
String uri = "img:asf-logo.png";
-
+
ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
assertTrue(imgSrc.isFastSource()); //Accessed through the local file system
}
@@ -129,7 +129,7 @@
}
};
String uri = "img:asf-logo.png";
-
+
ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
assertTrue(imgSrc.isFastSource()); //Access through local file system (thanks to the URI
//being passed through by the URIResolver)
@@ -152,7 +152,7 @@
assertTrue(src instanceof StreamSource); //Source remains unchanged
assertTrue(ImageUtil.hasReader(src));
}
-
+
private ImageSource checkImageInputStreamAvailable(String uri, URIResolver resolver) {
Source src = resolve(uri, resolver);
assertNotNull("Source must not be null", src);
@@ -168,7 +168,7 @@
Source src = sessionContext.newSource(uri);
return src;
}
-
+
public void testSAXSourceWithSystemID() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -182,11 +182,11 @@
}
};
String uri = "img:asf-logo.png";
-
+
ImageSource imgSrc = checkImageInputStreamAvailable(uri, resolver);
assertTrue(imgSrc.isFastSource());
}
-
+
public void testSAXSourceWithInputStream() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -209,7 +209,7 @@
checkImageInputStreamAvailable(uri, resolver);
}
-
+
public void testSAXSourceWithReader() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -229,9 +229,9 @@
assertTrue(src instanceof SAXSource); //Source remains unchanged
assertTrue(ImageUtil.hasReader(src));
}
-
+
private static final String SOME_XML = "<root><child id='1'>Hello World!</child></root>";
-
+
public void testSAXSourceWithXMLReader() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -252,7 +252,7 @@
assertNotNull(saxSrc.getXMLReader());
assertNotNull(saxSrc.getInputSource());
}
-
+
public void testDOMSource() throws Exception {
URIResolver resolver = new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
@@ -260,7 +260,7 @@
String xml = href.substring(4);
InputSource is = new InputSource(new java.io.StringReader(xml));
SAXSource sax = new SAXSource(createSomeXMLReader(), is);
-
+
//Convert SAXSource to DOMSource
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
@@ -279,7 +279,7 @@
DOMSource domSrc = (DOMSource)src;
assertNotNull(domSrc.getNode());
}
-
+
private XMLReader createSomeXMLReader() {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
SAXParser parser;
@@ -291,5 +291,5 @@
return null;
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageUtilTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageUtilTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageUtilTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ImageUtilTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
*/
public void testNeedPageIndex() throws Exception {
int pageIndex;
-
+
pageIndex = ImageUtil.needPageIndexFromURI("http://localhost/images/scan1.tif");
assertEquals(0, pageIndex);
pageIndex = ImageUtil.needPageIndexFromURI("http://localhost/images/scan1.tif#page=3");
@@ -61,23 +61,23 @@
pageIndex = ImageUtil.needPageIndexFromURI("file:///C:/images/scan1.tif#page=44");
assertEquals(43, pageIndex);
}
-
+
/**
* Tests {@link ImageUtil.getPageIndexFromURI(String)}.
* @throws Exception if an error occurs
*/
public void testGetPageIndex() throws Exception {
Integer pageIndex;
-
+
pageIndex = ImageUtil.getPageIndexFromURI("http://localhost/images/scan1.tif");
assertNull(pageIndex);
pageIndex = ImageUtil.getPageIndexFromURI("http://localhost/images/scan1.tif#page=3");
assertEquals(2, pageIndex.intValue());
//Note: no detailed test anymore as this is tested through needPageIndexFromURI().
-
+
//getPageIndexFromURI only works on URIs, so ignore anything that doesn't have a '#'
pageIndex = ImageUtil.getPageIndexFromURI("C:\\Temp\\scan1.tif");
assertNull(pageIndex);
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageContext.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageContext.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageContext.java Thu Mar 5 11:03:54 2009
@@ -25,16 +25,16 @@
public class MockImageContext implements ImageContext {
private static MockImageContext instance;
-
+
private ImageManager imageManager = new ImageManager(this);
-
+
public static MockImageContext getInstance() {
if (instance == null) {
instance = new MockImageContext();
}
return instance;
}
-
+
/** {@inheritDoc} */
public float getSourceResolution() {
return 72;
@@ -43,7 +43,7 @@
public ImageManager getImageManager() {
return this.imageManager;
}
-
+
public ImageSessionContext newSessionContext() {
return new MockImageSessionContext(this);
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageSessionContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageSessionContext.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageSessionContext.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/MockImageSessionContext.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader;
import java.io.File;
@@ -29,11 +29,11 @@
public class MockImageSessionContext extends DefaultImageSessionContext {
public static final File IMAGE_BASE_DIR = new File("./test/images/");
-
+
public MockImageSessionContext(ImageContext context) {
super(context, IMAGE_BASE_DIR);
}
-
+
/** {@inheritDoc} */
public float getTargetResolution() {
return 300;
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableInputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableInputStream.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableInputStream.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableInputStream.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader;
import java.io.FilterInputStream;
@@ -33,10 +33,10 @@
/** logger */
protected static Log log = LogFactory.getLog(ObservableInputStream.class);
-
+
private boolean closed;
private String systemID;
-
+
/**
* Main constructor.
* @param in the underlying input stream
@@ -61,12 +61,12 @@
throw new IllegalStateException("Stream is already closed!");
}
}
-
+
/** {@inheritDoc} */
public boolean isClosed() {
return this.closed;
}
-
+
/** {@inheritDoc} */
public String getSystemID() {
return this.systemID;
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableStream.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableStream.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/ObservableStream.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader;
import java.lang.reflect.InvocationHandler;
@@ -39,30 +39,30 @@
* @return true if the stream is closed
*/
boolean isClosed();
-
+
/**
* Returns the system ID for the stream being observed.
* @return the system ID
*/
String getSystemID();
-
+
public static class Factory {
-
+
public static ImageInputStream observe(ImageInputStream iin, String systemID) {
return (ImageInputStream)Proxy.newProxyInstance(
Factory.class.getClassLoader(),
new Class[] {ImageInputStream.class, ObservableStream.class},
new ObservingImageInputStreamInvocationHandler(iin, systemID));
}
-
+
}
-
+
public static class ObservingImageInputStreamInvocationHandler
implements InvocationHandler, ObservableStream {
/** logger */
protected static Log log = LogFactory.getLog(ObservableInputStream.class);
-
+
private ImageInputStream iin;
private boolean closed;
private String systemID;
@@ -71,7 +71,7 @@
this.iin = iin;
this.systemID = systemID;
}
-
+
/** {@inheritDoc} */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getDeclaringClass().equals(ObservableStream.class)) {
@@ -105,5 +105,5 @@
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/SimpleURIResolverBasedImageSessionContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/SimpleURIResolverBasedImageSessionContext.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/SimpleURIResolverBasedImageSessionContext.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/SimpleURIResolverBasedImageSessionContext.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader;
import java.io.File;
@@ -41,12 +41,12 @@
* @param baseDir the base directory
* @param resolver the URI resolver
*/
- public SimpleURIResolverBasedImageSessionContext(ImageContext context,
+ public SimpleURIResolverBasedImageSessionContext(ImageContext context,
File baseDir, URIResolver resolver) {
super(context, baseDir);
this.resolver = resolver;
}
-
+
/** {@inheritDoc} */
protected Source resolveURI(String uri) {
try {
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheLoggingStatistics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheLoggingStatistics.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheLoggingStatistics.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheLoggingStatistics.java Thu Mar 5 11:03:54 2009
@@ -67,7 +67,7 @@
super.cacheMissImageInfo(uri);
log.info("ImageInfo Cache MISS: " + uri);
}
-
-
+
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/loader/cache/ImageCacheTestCase.java Thu Mar 5 11:03:54 2009
@@ -36,7 +36,7 @@
public class ImageCacheTestCase extends TestCase {
private MockImageContext imageContext = MockImageContext.getInstance();
-
+
/**
* Tests the ImageInfo cache.
* @throws Exception if an error occurs
@@ -45,33 +45,33 @@
ImageSessionContext sessionContext = imageContext.newSessionContext();
ImageManager manager = imageContext.getImageManager();
-
+
String invalid1 = "invalid1.jpg";
String invalid2 = "invalid2.jpg";
String valid1 = "bgimg300dpi.bmp";
String valid2 = "big-image.png";
-
+
ImageCacheStatistics statistics = new ImageCacheLoggingStatistics(true);
manager.getCache().setCacheListener(statistics);
-
+
ImageInfo info1, info2;
info1 = manager.getImageInfo(valid1, sessionContext);
assertNotNull(info1);
assertEquals(valid1, info1.getOriginalURI());
-
+
try {
manager.getImageInfo(invalid1, sessionContext);
fail("Expected FileNotFoundException for invalid URI");
} catch (FileNotFoundException e) {
//expected
}
-
+
//2 requests:
assertEquals(0, statistics.getImageInfoCacheHits());
assertEquals(2, statistics.getImageInfoCacheMisses());
assertEquals(0, statistics.getInvalidHits());
statistics.reset();
-
+
//Cache Hit
info1 = manager.getImageInfo(valid1, sessionContext);
assertNotNull(info1);
@@ -81,7 +81,7 @@
info2 = manager.getImageInfo(valid2, sessionContext);
assertNotNull(info2);
assertEquals(valid2, info2.getOriginalURI());
-
+
try {
//Invalid Hit
manager.getImageInfo(invalid1, sessionContext);
@@ -96,13 +96,13 @@
} catch (FileNotFoundException e) {
//expected
}
-
+
//4 requests:
assertEquals(1, statistics.getImageInfoCacheHits());
assertEquals(2, statistics.getImageInfoCacheMisses());
assertEquals(1, statistics.getInvalidHits());
statistics.reset();
-
+
}
/**
@@ -112,31 +112,31 @@
public void testImageCache1() throws Exception {
ImageSessionContext sessionContext = imageContext.newSessionContext();
ImageManager manager = imageContext.getImageManager();
-
+
String valid1 = "bgimg72dpi.gif";
-
+
ImageCacheStatistics statistics = new ImageCacheLoggingStatistics(true);
manager.getCache().setCacheListener(statistics);
-
+
ImageInfo info = manager.getImageInfo(valid1, sessionContext);
assertNotNull(info);
-
+
ImageBuffered img1 = (ImageBuffered)manager.getImage(
info, ImageFlavor.BUFFERED_IMAGE, sessionContext);
assertNotNull(img1);
assertNotNull(img1.getBufferedImage());
-
+
ImageBuffered img2 = (ImageBuffered)manager.getImage(
info, ImageFlavor.BUFFERED_IMAGE, sessionContext);
//ImageBuffered does not have to be the same instance but we want at least the
//BufferedImage to be reused.
assertTrue("BufferedImage must be reused",
img1.getBufferedImage() == img2.getBufferedImage());
-
+
assertEquals(1, statistics.getImageCacheHits());
assertEquals(1, statistics.getImageCacheMisses());
}
-
+
/**
* Tests the image cache reusing a cacheable Image created by one of the ImageConverters in
* a converter pipeline.
@@ -145,20 +145,20 @@
public void DISABLEDtestImageCache2() throws Exception {
ImageSessionContext sessionContext = imageContext.newSessionContext();
ImageManager manager = imageContext.getImageManager();
-
+
String valid1 = "test/resources/images/img-w-size.svg";
-
+
ImageCacheStatistics statistics = new ImageCacheLoggingStatistics(true);
manager.getCache().setCacheListener(statistics);
-
+
ImageInfo info = manager.getImageInfo(valid1, sessionContext);
assertNotNull(info);
-
+
ImageBuffered img1 = (ImageBuffered)manager.getImage(
info, ImageFlavor.BUFFERED_IMAGE, sessionContext);
assertNotNull(img1);
assertNotNull(img1.getBufferedImage());
-
+
ImageBuffered img2 = (ImageBuffered)manager.getImage(
info, ImageFlavor.BUFFERED_IMAGE, sessionContext);
//ImageBuffered does not have to be the same instance but we want at least the
@@ -169,5 +169,5 @@
assertEquals(1, statistics.getImageCacheHits()); //1=BufferedImage
assertEquals(3, statistics.getImageCacheMisses()); //3=BufferedImage,Graphics2DImage,DOM
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/writer/internal/TIFFImageWriterTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/writer/internal/TIFFImageWriterTest.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/writer/internal/TIFFImageWriterTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/writer/internal/TIFFImageWriterTest.java Thu Mar 5 11:03:54 2009
@@ -37,7 +37,7 @@
BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_GRAY);
imageWriter.writeImage(image, out);
}
-
+
public void testJPEGWritingWithoutJPEGParams() throws Exception {
//This used to generate a NPE because the JPEG encoding params were not set
OutputStream out = new NullOutputStream();
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/PSEscapeTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/PSEscapeTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/PSEscapeTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/PSEscapeTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.ps;
import org.apache.xmlgraphics.ps.PSGenerator;
@@ -30,13 +30,13 @@
public void testBasics() throws Exception {
StringBuffer sb = new StringBuffer();
-
+
PSGenerator.escapeChar('a', sb);
PSGenerator.escapeChar('b', sb);
PSGenerator.escapeChar('c', sb);
PSGenerator.escapeChar('!', sb);
assertEquals("abc!", sb.toString());
-
+
sb.setLength(0);
PSGenerator.escapeChar('0', sb);
PSGenerator.escapeChar('\t', sb);
@@ -49,7 +49,7 @@
PSGenerator.escapeChar('\u20AC', sb); //EURO Sign
assertEquals("0\\t\\(x\\)\\n\\036\\344?", sb.toString());
}
-
+
public void testStringToDSC() throws Exception {
String escaped;
escaped = PSGenerator.convertStringToDSC("0\t(x)\n\u001E\u00E4\u20AC");
@@ -59,5 +59,5 @@
escaped = PSGenerator.convertStringToDSC("0\t(x)\n\u001E\u00E4\u20AC", true);
assertEquals("(0\\t\\(x\\)\\n\\036\\344?)", escaped);
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCCommentBoundingBoxTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCCommentBoundingBoxTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCCommentBoundingBoxTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCCommentBoundingBoxTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,5 +49,5 @@
289.12, 412.2, 306.777 - 289.12, 429.11 - 412.2);
assertEquals(refRect2D, bbox.getBoundingBox());
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@
private String[] toArray(List params) {
return (String[])params.toArray(new String[params.size()]);
}
-
+
public void testText() throws Exception {
DSCCommentBeginResource obj = new DSCCommentBeginResource();
String[] res = toArray(obj.splitParams("procset Test"));
@@ -43,7 +43,7 @@
assertEquals("procset", res[0]);
assertEquals("Test", res[1]);
}
-
+
public void testParentheseText() throws Exception {
DSCCommentBeginResource obj = new DSCCommentBeginResource();
String[] res = toArray(obj.splitParams("procset (Hello World!)"));
@@ -68,5 +68,5 @@
assertEquals("procset", res[0]);
assertEquals("Hello (wonderful) World! blahblah", res[1]);
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
public void testEndComment() throws Exception {
DSCEvent event;
-
+
event = new DSCCommentEndComments();
assertTrue(DSCTools.headerCommentsEndHere(event));
@@ -53,5 +53,5 @@
event = new PostScriptLine("/pgsave save def");
assertTrue(DSCTools.headerCommentsEndHere(event));
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ClasspathResourceTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ClasspathResourceTest.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ClasspathResourceTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ClasspathResourceTest.java Thu Mar 5 11:03:54 2009
@@ -32,7 +32,7 @@
/**
* Tests whether the file /sample.txt with mime-type text/plain exists.
- *
+ *
* @throws Exception
* in case of an error
*/
@@ -52,7 +52,7 @@
/**
* Tests the mode where Service returns class names.
- *
+ *
* @throws Exception
* in case of an error
*/
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/HexUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/HexUtil.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/HexUtil.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/HexUtil.java Thu Mar 5 11:03:54 2009
@@ -24,7 +24,7 @@
*/
public class HexUtil {
- private static final char[] DIGITS =
+ private static final char[] DIGITS =
{'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
@@ -41,5 +41,5 @@
}
return sb.toString();
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ServiceTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ServiceTest.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ServiceTest.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/ServiceTest.java Thu Mar 5 11:03:54 2009
@@ -39,13 +39,13 @@
boolean found = false;
Object writer1 = null;
Object writer2 = null;
-
+
//First run: Find a writer implementation (one of the two must be available)
Iterator iter = Service.providers(cls);
while (iter.hasNext()) {
Object obj = iter.next();
assertNotNull(obj);
- String className = obj.getClass().getName();
+ String className = obj.getClass().getName();
if ("org.apache.xmlgraphics.image.writer.internal.PNGImageWriter".equals(className)) {
writer1 = obj;
found = true;
@@ -64,7 +64,7 @@
while (iter.hasNext()) {
Object obj = iter.next();
assertNotNull(obj);
- String className = obj.getClass().getName();
+ String className = obj.getClass().getName();
if ("org.apache.xmlgraphics.image.writer.internal.PNGImageWriter".equals(className)) {
assertTrue(obj == writer1);
break;
@@ -75,7 +75,7 @@
}
}
}
-
+
/**
* Tests the mode where Service returns class names.
* @throws Exception in case of an error
@@ -104,5 +104,5 @@
assertTrue("Returned object must be a class name", obj instanceof String);
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85InputStreamTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85InputStreamTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85InputStreamTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85InputStreamTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.util.io;
import java.io.ByteArrayInputStream;
@@ -34,7 +34,7 @@
* Test case for ASCII85InputStream.
* <p>
* ATTENTION: Some of the tests here depend on the correct behaviour of
- * ASCII85OutputStream. If something fails here make sure
+ * ASCII85OutputStream. If something fails here make sure
* ASCII85OutputStreamTestCase runs!
*/
public class ASCII85InputStreamTestCase extends TestCase {
@@ -60,7 +60,7 @@
System.arraycopy(ASCII85OutputStreamTestCase.DATA, 0, buf, 0, buf.length);
return buf;
}
-
+
private String encode(byte[] data, int len) throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
java.io.OutputStream out = new ASCII85OutputStream(baout);
@@ -68,15 +68,15 @@
out.close();
return new String(baout.toByteArray(), "US-ASCII");
}
-
-
+
+
private void innerTestDecode(byte[] data) throws Exception {
String encoded = encode(data, data.length);
if (DEBUG) {
if (data[0] == 0) {
System.out.println("self-encode: " + data.length + " chunk 000102030405...");
} else {
- System.out.println("self-encode: " + new String(data, "US-ASCII")
+ System.out.println("self-encode: " + new String(data, "US-ASCII")
+ " " + HexUtil.toHex(data));
}
System.out.println(" ---> " + encoded);
@@ -86,13 +86,13 @@
if (data[0] == 0) {
System.out.println("decoded: " + data.length + " chunk 000102030405...");
} else {
- System.out.println("decoded: " + new String(decoded, "US-ASCII")
+ System.out.println("decoded: " + new String(decoded, "US-ASCII")
+ " " + HexUtil.toHex(decoded));
}
}
assertEquals(HexUtil.toHex(data), HexUtil.toHex(decoded));
}
-
+
/**
* Tests the output of ASCII85.
* @throws Exception if an error occurs
@@ -102,7 +102,7 @@
innerTestDecode("1. Bodypart".getBytes("US-ASCII"));
if (DEBUG) {
System.out.println("===========================================");
- }
+ }
innerTestDecode(getChunk(1));
innerTestDecode(getChunk(2));
@@ -111,8 +111,8 @@
innerTestDecode(getChunk(5));
if (DEBUG) {
System.out.println("===========================================");
- }
-
+ }
+
innerTestDecode(getChunk(10));
innerTestDecode(getChunk(62));
innerTestDecode(getChunk(63));
@@ -121,7 +121,7 @@
if (DEBUG) {
System.out.println("===========================================");
- }
+ }
String sz;
sz = HexUtil.toHex(decode("zz~>"));
assertEquals(HexUtil.toHex(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}), sz);
@@ -129,7 +129,7 @@
assertEquals(HexUtil.toHex(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}), sz);
if (DEBUG) {
System.out.println("===========================================");
- }
+ }
try {
decode("vz~>");
fail("Illegal character should be detected");
@@ -147,7 +147,7 @@
//expected
}*/
}
-
+
private byte[] getFullASCIIRange() {
java.io.ByteArrayOutputStream baout = new java.io.ByteArrayOutputStream(256);
for (int i = 254; i < 256; i++) {
@@ -163,5 +163,5 @@
public void testFullASCIIRange() throws Exception {
innerTestDecode(getFullASCIIRange());
}
-
+
}
Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85OutputStreamTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85OutputStreamTestCase.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85OutputStreamTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/io/ASCII85OutputStreamTestCase.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.util.io;
import java.io.OutputStream;
@@ -32,7 +32,7 @@
/** Test data */
public static final byte[] DATA = new byte[100];
-
+
static {
//Fill in some data
for (int i = 0; i < 100; i++) {
@@ -50,7 +50,7 @@
private String encode(int count) throws Exception {
return encode(DATA, count);
}
-
+
private String encode(byte[] data, int len) throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutputStream out = new ASCII85OutputStream(baout);
@@ -66,20 +66,20 @@
public void testOutput() throws Exception {
String sz = encode(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, 8);
assertEquals("zz~>", sz);
-
+
String s3 = encode(3);
//System.out.println(">>>" + s3 + "<<<");
assertEquals("!!*-~>", s3);
-
+
String s10 = encode(10);
//System.out.println(">>>" + s10 + "<<<");
assertEquals("!!*-'\"9eu7#RL~>", s10);
-
+
String s62 = encode(62);
//System.out.println(">>>" + s62 + "<<<");
assertEquals("!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,"
+ "UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?W~>", s62);
-
+
String s63 = encode(63);
//System.out.println(">>>" + s63 + "<<<");
assertEquals("!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,"
@@ -89,12 +89,12 @@
//System.out.println(">>>" + s64 + "<<<");
assertEquals("!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,"
+ "UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm\n~>", s64);
-
+
String s65 = encode(65);
//System.out.println(">>>" + s65 + "<<<");
assertEquals("!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,"
+ "UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm\n5Q~>", s65);
-
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org