Exception Fact Sheet for "batik"

The goal of an Exception Fact Sheet is to reveal the design of exception handling in an application.

--Maxence, Martin

For feedback, please contact Martin

Table of contents

Basic Statistics

Number of Classes 2559
Number of Domain Exception Types (Thrown or Caught) 16
Number of Domain Checked Exception Types 4
Number of Domain Runtime Exception Types 11
Number of Domain Unknown Exception Types 1
nTh = Number of Throw 1728
nTh = Number of Throw in Catch 300
Number of Catch-Rethrow (may not be correct) 32
nC = Number of Catch 759
nCTh = Number of Catch with Throw 296
Number of Empty Catch (really Empty) 120
Number of Empty Catch (with comments) 44
Number of Empty Catch 164
nM = Number of Methods 14692
nbFunctionWithCatch = Number of Methods with Catch 527 / 14692
nbFunctionWithThrow = Number of Methods with Throw 1174 / 14692
nbFunctionWithThrowS = Number of Methods with ThrowS 1706 / 14692
nbFunctionTransmitting = Number of Methods with "Throws" but NO catch, NO throw (only transmitting) 1205 / 14692
P1 = nCTh / nC 39% (0.39)
P2 = nMC / nM 3.6% (0.036)
P3 = nbFunctionWithThrow / nbFunction 8% (0.08)
P4 = nbFunctionTransmitting / nbFunction 8.2% (0.082)
P5 = nbThrowInCatch / nbThrow 17.4% (0.174)
R2 = nCatch / nThrow 0.439
A1 = Number of Caught Exception Types From External Libraries 49
A2 = Number of Reused Exception Types From External Libraries (thrown from application code) 21

W1 is a rough estimation of the richness of the exception model. It does not take into account the inheritance relationships between domain exceptions.

Proportion P1 measures the overall exception flow. According to our experience, it varies from 5% to 70%. Early-catch design generally yields a low P1, libraries that must warn clients about errors (e.g. databases) generally have a high P1.

Proportion P2 measures the dispersion of catch blocks in the application. According to our experience, it varies from 2% to 15%. A small P2 indicates a rather centralized management of errors.

R1 shows how many exceptions types from libraries (incl. JDK) are thrown from application code. For instance, IllegalArgumentException comes from the JDK but is used in many applications.

A1 measures the awareness of the application to library exceptions. A high value of A1 means either that the application is polluted with checked exceptions or that it is able to apply specific recovery depending on the library exception.

Exception Hierachy

Exception Map

Each exception that is used at least once in the project is a dot. A orange dot represents a domain exception that is defined in the application. A blue dot exception is defined in the JDK or in a library. The x-axis represents the number of times an exception is caught, the y-axis the number of times an exception is thrown.

Exceptions With State

State means fields. Number of exceptions with state: 14
EventException
              package org.w3c.dom.events;public class EventException extends RuntimeException {
    public EventException(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
    // EventExceptionCode
    /**
     *  If the <code>Event.type</code> was not specified by initializing the 
     * event before the method was called. Specification of the 
     * <code>Event.type</code> as <code>null</code> or an empty string will 
     * also trigger this exception. 
     */
    public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
    /**
     *  If the <code>Event</code> object is already dispatched in the tree. 
     * @since DOM Level 3
     */
    public static final short DISPATCH_REQUEST_ERR      = 1;

}
            
SVGConverterException
              package org.apache.batik.apps.rasterizer;public class SVGConverterException extends Exception {
    /**
     * Error code
     */
    protected String errorCode;

    /**
     * Additional information about the error condition
     */
    protected Object[] errorInfo;

    /**
     * Defines whether or not this is a fatal error condition
     */
    protected boolean isFatal;

    public SVGConverterException(String errorCode){
        this(errorCode, null, false);
    }

    public SVGConverterException(String errorCode, 
                                  Object[] errorInfo){
        this(errorCode, errorInfo, false);
    }

    public SVGConverterException(String errorCode,
                                  Object[] errorInfo,
                                  boolean isFatal){
        this.errorCode = errorCode;
        this.errorInfo = errorInfo;
        this.isFatal = isFatal;
    }

    public SVGConverterException(String errorCode,
                                  boolean isFatal){
        this(errorCode, null, isFatal);
    }

    public boolean isFatal(){
        return isFatal;
    }

    public String getMessage(){
        return Messages.formatMessage(errorCode, errorInfo);
    }

    public String getErrorCode(){
        return errorCode;
    }
}
            
TranscoderException
              package org.apache.batik.transcoder;public class TranscoderException extends Exception {

    /** The enclosed exception. */
    protected Exception ex;

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param s the detail message of this exception
     */
    public TranscoderException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param ex the enclosed exception
     */
    public TranscoderException(Exception ex) {
        this(null, ex);
    }

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public TranscoderException(String s, Exception ex) {
        super(s);
        this.ex = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (ex != null) {
            msg += "\nEnclosed Exception:\n";
            msg += ex.getMessage();
        }
        return msg;
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public Exception getException() {
        return ex;
    }
}
            
SVGGraphics2DIOException
              package org.apache.batik.svggen;public class SVGGraphics2DIOException extends IOException {
    /** The enclosed exception. */
    private IOException embedded;

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     */
    public SVGGraphics2DIOException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param ex the enclosed exception
     */
    public SVGGraphics2DIOException(IOException ex) {
        this(null, ex);
    }

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public SVGGraphics2DIOException(String s, IOException ex) {
        super(s);
        embedded = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public IOException getException() {
        return embedded;
    }
}
            
SAXIOException
              package org.apache.batik.dom.util;public class SAXIOException extends IOException {

    protected SAXException saxe;

    public SAXIOException( SAXException saxe) {
        super(saxe.getMessage());
        this.saxe = saxe;
    }

    public SAXException getSAXException() { return saxe; }
    public Throwable    getCause() { return saxe; }
}
            
SVGGraphics2DRuntimeException
              package org.apache.batik.svggen;public class SVGGraphics2DRuntimeException extends RuntimeException {
    /** The enclosed exception. */
    private Exception embedded;

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     */
    public SVGGraphics2DRuntimeException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param ex the enclosed exception
     */
    public SVGGraphics2DRuntimeException(Exception ex) {
        this(null, ex);
    }

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public SVGGraphics2DRuntimeException(String s, Exception ex) {
        super(s);
        embedded = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public Exception getException() {
        return embedded;
    }
}
            
InterpreterException
              package org.apache.batik.script;public class InterpreterException extends RuntimeException {
    private int line = -1; // -1 when unknown
    private int column = -1; // -1 when unknown
    private Exception embedded = null; // null when unknown

    /**
     * Builds an instance of <code>InterpreterException</code>.
     * @param message the <code>Exception</code> message.
     * @param lineno the number of the line the error occurs.
     * @param columnno the number of the column the error occurs.
     */
    public InterpreterException(String message, int lineno, int columnno) {
        super(message);
        line = lineno;
        column = columnno;
    }

    /**
     * Builds an instance of <code>InterpreterException</code>.
     * @param exception the embedded exception.
     * @param message the <code>Exception</code> message.
     * @param lineno the number of the line the error occurs.
     * @param columnno the number of the column the error occurs.
     */
    public InterpreterException(Exception exception,
                                String message, int lineno, int columnno) {
        this(message, lineno, columnno);
        embedded = exception;
    }

    /**
     * Returns the line number where the error occurs. If this value is not
     * known, returns -1.
     */
    public int getLineNumber() {
        return line;
    }

    /**
     * Returns the column number where the error occurs. If this value is not
     * known, returns -1.
     */
    public int getColumnNumber() {
        return column;
    }

    /**
     * Returns the embedded exception. If no embedded exception is set,
     * returns null.
     */
    public Exception getException() {
        return embedded;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }
}
            
AnimationException
              package org.apache.batik.anim;public class AnimationException extends RuntimeException {

    /**
     * The timed element on which the error occurred.
     */
    protected TimedElement e;

    /**
     * The error code.
     */
    protected String code;

    /**
     * The parameters to use for the error message.
     */
    protected Object[] params;

    /**
     * The message.
     */
    protected String message;

    /**
     * Creates a new AnimationException.
     * @param e the animation element on which the error occurred
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public AnimationException(TimedElement e, String code, Object[] params) {
        this.e = e;
        this.code = code;
        this.params = params;
    }

    /**
     * Returns the timed element that caused this animation exception.
     */
    public TimedElement getElement() {
        return e;
    }

    /**
     * Returns the error code.
     */
    public String getCode() {
        return code;
    }

    /**
     * Returns the error message parameters.
     */
    public Object[] getParams() {
        return params;
    }

    /**
     * Returns the error message according to the error code and parameters.
     */
    public String getMessage() {
        return TimedElement.formatMessage(code, params);
    }
}
            
XMLException
              package org.apache.batik.xml;public class XMLException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;

    /**
     * Creates a new XMLException.
     * @param message The error or warning message.
     */
    public XMLException (String message) {
        super(message);
        exception = null;
    }
    
    /**
     * Creates a new XMLException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the XMLException.
     * @param e The exception to be wrapped in a XMLException.
     */
    public XMLException (Exception e) {
        exception = e;
    }
    
    /**
     * Creates a new XMLException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public XMLException (String message, Exception e) {
        super(message);
        exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the XMLException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the 
     * standard error stream.
     */
    public void printStackTrace() { 
        if (exception == null) {
            super.printStackTrace();
        } else {
            synchronized (System.err) {
                System.err.println(this);
                super.printStackTrace();
            }
        }
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the 
     * specified print stream.
     *
     * @param s <code>PrintStream</code> to use for output
     */
    public void printStackTrace(java.io.PrintStream s) { 
        if (exception == null) {
            super.printStackTrace(s);
        } else {
            synchronized (s) {
                s.println(this);
                super.printStackTrace();
            }
        }
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the specified
     * print writer.
     *
     * @param s <code>PrintWriter</code> to use for output
     */
    public void printStackTrace(java.io.PrintWriter s) { 
        if (exception == null) {
            super.printStackTrace(s);
        } else {
            synchronized (s) {
                s.println(this);
                super.printStackTrace(s);
            }
        }
    }
}
            
ParseException
              package org.apache.batik.parser;public class ParseException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;
    
    /**
     * @serial The line number.
     */
    protected int lineNumber;

    /**
     * @serial The column number.
     */
    protected int columnNumber;

    /**
     * Creates a new ParseException.
     * @param message The error or warning message.
     * @param line The line of the last parsed character.
     * @param column The column of the last parsed character.
     */
    public ParseException (String message, int line, int column) {
        super(message);
        exception = null;
        lineNumber = line;
        columnNumber = column;
    }
    
    /**
     * Creates a new ParseException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the ParseException.
     * @param e The exception to be wrapped in a ParseException.
     */
    public ParseException (Exception e) {
        exception = e;
        lineNumber = -1;
        columnNumber = -1;
    }
    
    /**
     * Creates a new ParseException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public ParseException (String message, Exception e) {
        super(message);
        this.exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the ParseException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Returns the line of the last parsed character.
     */
    public int getLineNumber() {
        return lineNumber;
    }

    /**
     * Returns the column of the last parsed character.
     */
    public int getColumnNumber() {
        return columnNumber;
    }
}
              package org.apache.batik.css.parser;public class ParseException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;
    
    /**
     * @serial The line number.
     */
    protected int lineNumber;

    /**
     * @serial The column number.
     */
    protected int columnNumber;

    /**
     * Creates a new ParseException.
     * @param message The error or warning message.
     * @param line The line of the last parsed character.
     * @param column The column of the last parsed character.
     */
    public ParseException (String message, int line, int column) {
        super(message);
        exception = null;
        lineNumber = line;
        columnNumber = column;
    }
    
    /**
     * Creates a new ParseException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the ParseException.
     * @param e The exception to be wrapped in a ParseException.
     */
    public ParseException (Exception e) {
        exception = e;
        lineNumber = -1;
        columnNumber = -1;
    }
    
    /**
     * Creates a new ParseException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public ParseException (String message, Exception e) {
        super(message);
        this.exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the ParseException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Returns the line of the last parsed character.
     */
    public int getLineNumber() {
        return lineNumber;
    }

    /**
     * Returns the column of the last parsed character.
     */
    public int getColumnNumber() {
        return columnNumber;
    }
}
            
LiveAttributeException
              package org.apache.batik.dom.svg;public class LiveAttributeException extends RuntimeException {

    // Constants for the error code.
    public static final short ERR_ATTRIBUTE_MISSING   = 0;
    public static final short ERR_ATTRIBUTE_MALFORMED = 1;
    public static final short ERR_ATTRIBUTE_NEGATIVE  = 2;

    /**
     * The element on which the error occured.
     */
    protected Element e;

    /**
     * The attribute name.
     */
    protected String attributeName;

    /**
     * The reason for the exception.  This must be one of the ERR_* constants
     * defined in this class.
     */
    protected short code;

    /**
     * The malformed attribute value.
     */
    protected String value;

    /**
     * Constructs a new <tt>LiveAttributeException</tt> with the specified
     * parameters.
     *
     * @param e the element on which the error occured
     * @param an the attribute name
     * @param code the error code
     * @param val the malformed attribute value
     */
    public LiveAttributeException(Element e, String an, short code,
                                  String val) {
        this.e = e;
        this.attributeName = an;
        this.code = code;
        this.value = val;
    }

    /**
     * Returns the element on which the error occurred.
     */
    public Element getElement() {
        return e;
    }

    /**
     * Returns the attribute name.
     */
    public String getAttributeName() {
        return attributeName;
    }

    /**
     * Returns the error code.
     */
    public short getCode() {
        return code;
    }

    /**
     * Returns the problematic attribute value.
     */
    public String getValue() {
        return value;
    }
}
            
BridgeException
              package org.apache.batik.bridge;public class BridgeException extends RuntimeException {

    /** The element on which the error occured. */
    protected Element e;

    /** The error code. */
    protected String code;

    /**
     * The message.
     */
    protected String message;

    /** The paramters to use for the error message. */
    protected Object [] params;

    /** The line number on which the error occured. */
    protected int line;

    /** The graphics node that represents the current state of the GVT tree. */
    protected GraphicsNode node;

    /**
     * Constructs a new <tt>BridgeException</tt> based on the specified
     * <tt>LiveAttributeException</tt>.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param ex the {@link LiveAttributeException}
     */
    public BridgeException(BridgeContext ctx, LiveAttributeException ex) {
        switch (ex.getCode()) {
            case LiveAttributeException.ERR_ATTRIBUTE_MISSING:
                this.code = ErrorConstants.ERR_ATTRIBUTE_MISSING;
                break;
            case LiveAttributeException.ERR_ATTRIBUTE_MALFORMED:
                this.code = ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED;
                break;
            case LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE:
                this.code = ErrorConstants.ERR_LENGTH_NEGATIVE;
                break;
            default:
                throw new IllegalStateException
                    ("Unknown LiveAttributeException error code "
                     + ex.getCode());
        }
        this.e = ex.getElement();
        this.params = new Object[] { ex.getAttributeName(), ex.getValue() };
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

     /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public BridgeException(BridgeContext ctx, Element e, String code,
                           Object[] params) {

        this.e = e;
        this.code = code;
        this.params = params;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param ex the exception which was the root-cause for this exception
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public BridgeException(BridgeContext ctx, Element e, Exception ex, String code,
                           Object[] params) {

        // todo ex can be chained in jdk >= 1.4
        this.e = e;

        message = ex.getMessage();
        this.code = code;
        this.params = params;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param message the error message
     */
    public BridgeException(BridgeContext ctx, Element e, String message) {
        this.e = e;
        this.message = message;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Returns the element on which the error occurred.
     */
    public Element getElement() {
        return e;
    }

    /**
     * Sets the graphics node that represents the current GVT tree built.
     *
     * @param node the graphics node
     */
    public void setGraphicsNode(GraphicsNode node) {
        this.node = node;
    }

    /**
     * Returns the graphics node that represents the current GVT tree built.
     */
    public GraphicsNode getGraphicsNode() {
        return node;
    }

    /**
     * Returns the error message according to the error code and parameters.
     */
    public String getMessage() {
        if (message != null) {
            return message;
        }

        String uri;
        String lname = "<Unknown Element>";
        SVGDocument doc = null;
        if (e != null) {
            doc = (SVGDocument)e.getOwnerDocument();
            lname = e.getLocalName();
        }
        if (doc == null)  uri = "<Unknown Document>";
        else              uri = doc.getURL();
        Object [] fullparams = new Object[params.length+3];
        fullparams[0] = uri;
        fullparams[1] = new Integer(line);
        fullparams[2] = lname;
        System.arraycopy( params, 0, fullparams, 3, params.length );
        return Messages.formatMessage(code, fullparams);
    }

    /**
     * Returns the exception's error code
     */
    public String getCode() {
        return code;
    }
}
            
MissingListenerException
              package org.apache.batik.util.gui.resource;public class MissingListenerException extends RuntimeException {
    /**
     * The class name of the listener bundle requested
     * @serial
     */
    private String className;

    /**
     * The name of the specific listener requested by the user
     * @serial
     */
    private String key;

    /**
     * Constructs a MissingListenerException with the specified information.
     * A detail message is a String that describes this particular exception.
     * @param s the detail message
     * @param className the name of the listener class
     * @param key the key for the missing listener.
     */
    public MissingListenerException(String s, String className, String key) {
        super(s);
        this.className = className;
        this.key = key;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getClassName() {
        return className;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getKey() {
        return key;
    }

    /**
     * Returns a printable representation of this object
     */
    public String toString() {
        return super.toString()+" ("+getKey()+", bundle: "+getClassName()+")";
    }
}
            
ResourceFormatException
              package org.apache.batik.util.resources;public class ResourceFormatException extends RuntimeException {

    /**
     * The class name of the resource bundle requested
     * @serial
     */
    protected String className;

    /**
     * The name of the specific resource requested by the user
     * @serial
     */
    protected String key;

    /**
     * Constructs a ResourceFormatException with the specified information.
     * A detail message is a String that describes this particular exception.
     * @param s the detail message
     * @param className the name of the resource class
     * @param key the key for the malformed resource.
     */
    public ResourceFormatException(String s, String className, String key) {
        super(s);
        this.className = className;
        this.key = key;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getClassName() {
        return className;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getKey() {
        return key;
    }

    /**
     * Returns a printable representation of this object
     */
    public String toString() {
        return super.toString()+" ("+getKey()+", bundle: "+getClassName()+")";
    }
}
            

Thrown Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be thrown, thrown from within a catch, or declared in the signature of a method (usually for checked exceptions). Hovering over a number triggers showing code snippets from the application code.

Type Exception Thrown Thrown
from Catch
Declared
- Unknown 585
              
//in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
throw e;

              
//in sources/org/apache/batik/svggen/DefaultErrorHandler.java
throw ex;

              
//in sources/org/apache/batik/svggen/SVGGraphics2D.java
throw io;

              
//in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
throw td;

              
//in sources/org/apache/batik/script/rhino/svg12/GlobalWrapper.java
throw Context.reportRuntimeError("First argument to startMouseCapture must be an EventTarget");

              
//in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
throw ibe;

              
//in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
throw ie;

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
//in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                            ("values.to.by.path.missing",
                             new Object[] { null });

              
//in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                            ("values.to.by.path.missing",
                             new Object[] { null });

              
//in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_POINTS_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/InterpolatingAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_SPLINES_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/InterpolatingAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                        ("values.to.by.missing", new Object[] { null });

              
//in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                        ("values.to.by.missing", new Object[] { null });

              
//in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                ("attribute.malformed",
                 new Object[] { null,
                                SMILConstants.SMIL_KEY_SPLINES_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_BEGIN_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                        ("attribute.malformed",
                         new Object[] { null, SMIL_DUR_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_END_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                    ("attribute.malformed",
                     new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_FILL_ATTRIBUTE });

              
//in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_RESTART_ATTRIBUTE });

              
//in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
throw td;

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
throw td;

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory2");

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                   IllegalArgumentException("TIFFDirectory3");

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
//in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory2");

              
//in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
throw td;

              
//in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
throw new
                  IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam0"));

              
//in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
throw new
                   IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam1"));

              
//in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
throw td;

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.pi.target");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("xml.reserved");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.doctype");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("pi.end.expected");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.tag.end");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.end.tag");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("pi.end.expected");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.comment");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.comment");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.name");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.pi.target");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("xml.reserved");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("character.reference");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("character.reference");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
//in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
//in sources/org/apache/batik/parser/DefaultErrorHandler.java
throw e;

              
//in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
throw ex;

              
//in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
throw ex;

              
//in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
throw ex;

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("element", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "version" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "version" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.data", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end.tag", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("character.data", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("section.end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("notation.definition", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("left.brace", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("nmtoken", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("nmtoken", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("default.decl", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
//in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "import.node",
                                     new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                 "import.document",
                                 new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                 "import.document",
                                 new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                     "child.type",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    new Integer(t),
                                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "document.child.already.exists",
                                     new Object[] { new Integer(t),
                                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "xml.version",
                                     new Object[] { v });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "adopt.document",
                                         new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "adopt.document.type",
                                          new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.node",
                 new Object[] { new Integer(an.getNodeType()),
                               an.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "rename.document.element",
                                     new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "rename.node",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "wf.invalid.name",
                                     new Object[] { qn });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "node.from.wrong.document",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "qname",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName(),
                                                    qn });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "prefix",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName(),
                                                    prefix });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                         "namespace",
                                         new Object[] { new Integer(nt),
                                                        n.getNodeName(),
                                                        ns });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                        ((short) 17 /*DOMException.TYPE_MISMATCH_ERR*/,
                         "domconfig.param.type",
                         new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_FOUND_ERR,
                     "domconfig.param.not.found",
                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_SUPPORTED_ERR,
                     "domconfig.param.value",
                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    ((short) 17 /*DOMException.TYPE_MISMATCH_ERR*/,
                     "domconfig.param.type",
                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_SUPPORTED_ERR,
                     "domconfig.param.value",
                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_FOUND_ERR,
                     "domconfig.param.not.found",
                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.INVALID_EXPRESSION_ERR,
                     "xpath.invalid.expression",
                     new Object[] { expr, te.getMessage() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.WRONG_DOCUMENT_ERR,
                     "node.from.wrong.document",
                     new Object[] { new Integer(contextNode.getNodeType()),
                                    contextNode.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "xpath.invalid.result.type",
                                         new Object[] { new Integer(type) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                        (DOMException.NOT_SUPPORTED_ERR,
                         "xpath.invalid.context.node",
                         new Object[] { new Integer(contextNode.getNodeType()),
                                        contextNode.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.INVALID_EXPRESSION_ERR,
                     "xpath.error",
                     new Object[] { xpath.getPatternString(),
                                    te.getMessage() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.TYPE_ERR,
                     "xpath.cannot.convert.result",
                     new Object[] { new Integer(type),
                                    te.getMessage() });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
//in sources/org/apache/batik/dom/svg12/XBLOMElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/svg12/XBLOMElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
//in sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java
throw createDOMException
                        (DOMException.NAMESPACE_ERR,
                         "prefix",
                         new Object[] { new Integer(getNodeType()),
                                        getNodeName(),
                                        prefix });

              
//in sources/org/apache/batik/dom/svg12/XBLEventSupport.java
throw createEventException
                (DOMException.NOT_SUPPORTED_ERR,
                 "unsupported.event",
                 new Object[] {});

              
//in sources/org/apache/batik/dom/svg12/XBLEventSupport.java
throw createEventException
                (EventException.UNSPECIFIED_EVENT_TYPE_ERR,
                 "unspecified.event",
                 new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
//in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "need.parent",
                                     new Object[] {});

              
//in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException
                    (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                     "readonly.node",
                     new Object[] { new Integer(n.getNodeType()),
                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException
                    (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                     "readonly.node",
                     new Object[] { new Integer(n.getNodeType()),
                                    n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractElementNS.java
throw createDOMException
                    (DOMException.NAMESPACE_ERR,
                     "namespace.uri",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName(),
                                    nsURI });

              
//in sources/org/apache/batik/dom/AbstractAttrNS.java
throw createDOMException
                    (DOMException.NAMESPACE_ERR,
                     "namespace.uri",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName(),
                                    nsURI });

              
//in sources/org/apache/batik/dom/AbstractAttrNS.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace.uri",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    nsURI });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.INVALID_STATE_ERR,
                                 "node.type",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName()});

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "parent.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "sibling.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "sibling.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName()});

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace.uri",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    uri });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "xml.name",
                                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                            getNodeName(),
                                new Integer(n.getNodeType()),
                                            n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractDocumentFragment.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractEntity.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
//in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "animation.dur.indefinite",
                                     null);

              
//in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio",
                 new Object[] { value });

              
//in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "preserve.aspect.ratio.align",
                 new Object[] { new Integer(align) });

              
//in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "preserve.aspect.ratio.meet.or.slice",
                 new Object[] { new Integer(meetOrSlice) });

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point", null);

              
//in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGZoomAndPanSupport.java
throw ((AbstractNode)elt).createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "zoom.and.pan",
                 new Object[] { new Integer(val) });

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR, "invalid.suspend.handle",
                 new Object[] { new Integer(suspend_handle_id) });

              
//in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
//in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
//in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/svg/SVGOMElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
//in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw currentElt.createSVGException
                            (SVGException.SVG_MATRIX_NOT_INVERTABLE,
                             "noninvertiblematrix",
                             null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.preserve.aspect.ratio", null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.preserve.aspect.ratio", null);

              
//in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
throw document.createDOMException
                (DOMException.NOT_FOUND_ERR, "invalid.element",
                 new Object[] { namespaceURI, qualifiedName });

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
//in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
//in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
//in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{""} );

              
//in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{localName} );

              
//in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
//in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
//in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
//in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(refChild.getNodeType()),
                                refChild.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(oldChild.getNodeType()),
                                oldChild.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(oldChild.getNodeType()),
                                oldChild.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.WRONG_DOCUMENT_ERR,
                                     "node.from.wrong.document",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "add.self", new Object[] { getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                    (DOMException.HIERARCHY_REQUEST_ERR,
                     "add.ancestor",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(r.getNodeType()),
                                r.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(o.getNodeType()),
                                o.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(n.getNodeType()),
                                n.getNodeName() });

              
//in sources/org/apache/batik/dom/traversal/DOMTreeWalker.java
throw ((AbstractNode)root).createDOMException
                (DOMException.NOT_SUPPORTED_ERR,
                 "null.current.node",  null);

              
//in sources/org/apache/batik/dom/traversal/TraversalSupport.java
throw doc.createDOMException
                (DOMException.NOT_SUPPORTED_ERR, "null.root",  null);

              
//in sources/org/apache/batik/dom/traversal/TraversalSupport.java
throw doc.createDOMException
                (DOMException.NOT_SUPPORTED_ERR, "null.root",  null);

              
//in sources/org/apache/batik/dom/traversal/DOMNodeIterator.java
throw document.createDOMException
                (DOMException.INVALID_STATE_ERR,
                 "detached.iterator",  null);

              
//in sources/org/apache/batik/dom/traversal/DOMNodeIterator.java
throw document.createDOMException
                (DOMException.INVALID_STATE_ERR,
                 "detached.iterator",  null);

              
//in sources/org/apache/batik/dom/events/EventSupport.java
throw createEventException(DOMException.NOT_SUPPORTED_ERR,
                                       "unsupported.event",
                                       new Object[] { });

              
//in sources/org/apache/batik/dom/events/EventSupport.java
throw createEventException
                (EventException.UNSPECIFIED_EVENT_TYPE_ERR,
                 "unspecified.event",
                 new Object[] {});

              
//in sources/org/apache/batik/dom/events/EventSupport.java
throw td;

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
//in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "negative.count",
                                     new Object[] { new Integer(count) });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                   "xml.name",
                   new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                   "attribute.missing",
                   new Object[] { oldAttr.getName() });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                                     "attribute.missing",
                                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                                     "attribute.missing",
                                     new Object[] { ns, ln });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { a.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { a.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                      (DOMException.HIERARCHY_REQUEST_ERR,
                       "child.type",
                       new Object[] { new Integer(getNodeType()),
                                      getNodeName(),
                                      new Integer(n.getNodeType()),
                                      n.getNodeName() });

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{""} );

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{localName} );

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.WRONG_DOCUMENT_ERR,
                        "node.from.wrong.document",
                        new Object[]{new Integer( arg.getNodeType() ),
                                arg.getNodeName()} );

              
//in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.WRONG_DOCUMENT_ERR,
                        "inuse.attribute",
                        new Object[]{arg.getNodeName()} );

              
//in sources/org/apache/batik/dom/util/DOMUtilities.java
throw new
                    IOException("Unserializable processing instruction node");

              
//in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw (InterruptedIOException) ex;

              
//in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw (InterruptedIOException)ex;

              
//in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw ex;

              
//in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw ex;

              
//in sources/org/apache/batik/dom/AbstractEntityReference.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "xml.name",
                                     new Object[] { name });

              
//in sources/org/apache/batik/dom/AbstractEntityReference.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
//in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
throw createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node",
                 new Object[] { new Integer(getNodeType()), getNodeName() });

              
//in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
throw createDOMException
                (DOMException.INVALID_CHARACTER_ERR, "prefix",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                prefix });

              
//in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.se;

              
//in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.se;

              
//in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.rex;

              
//in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
throw td;

              
//in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
throw td;

              
//in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
throw td;

              
//in sources/org/apache/batik/swing/gvt/JGVTComponent.java
throw td;

              
//in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
throw td;

              
//in sources/org/apache/batik/bridge/DefaultScriptSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
throw doc.createXPathException
                (XPathException.INVALID_EXPRESSION_ERR,
                 "xpath.invalid.expression",
                 new Object[] { expression, te.getMessage() });

              
//in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
throw doc.createXPathException
                        (XPathException.INVALID_EXPRESSION_ERR,
                         "xpath.error",
                         new Object[] { expression, te.getMessage() });

              
//in sources/org/apache/batik/bridge/UpdateManager.java
throw td;

              
//in sources/org/apache/batik/bridge/DefaultExternalResourceSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/CursorManager.java
throw be;

              
//in sources/org/apache/batik/bridge/CursorManager.java
throw ex;

              
//in sources/org/apache/batik/bridge/NoLoadScriptSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/EmbededExternalResourceSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/NoLoadExternalResourceSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ex;

              
//in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ex;

              
//in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ibe;

              
//in sources/org/apache/batik/bridge/EmbededScriptSecurity.java
throw se;

              
//in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
throw e;

              
//in sources/org/apache/batik/bridge/GVTBuilder.java
throw ex;

              
//in sources/org/apache/batik/bridge/GVTBuilder.java
throw ex;

              
//in sources/org/apache/batik/util/ParsedURLData.java
throw e;

              
//in sources/org/apache/batik/util/CleanerThread.java
throw td;

              
//in sources/org/apache/batik/util/EventDispatcher.java
throw td;

              
//in sources/org/apache/batik/util/EventDispatcher.java
throw td;

              
//in sources/org/apache/batik/util/RunnableQueue.java
throw td;

              
//in sources/org/apache/batik/util/RunnableQueue.java
throw td;

              
//in sources/org/apache/batik/util/PreferenceManager.java
throw e3;

              
//in sources/org/apache/batik/css/parser/DefaultErrorHandler.java
throw e;

              
//in sources/org/apache/batik/css/parser/Parser.java
throw e;

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.bracket");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier.or.string");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.bracket");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                                ("duplicate.pseudo.element");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.brace");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.function");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("eof");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("eof.expected");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("colon");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                            ("token", new Object[] { new Integer(current) });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                            ("token", new Object[] { new Integer(current) });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                    ("token",
                     new Object[] { new Integer(current) });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                ("token",
                 new Object[] { new Integer(current) });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                ("token",
                 new Object[] { new Integer(current) });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                    ("rgb.color", new Object[] { val });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("rgb.color");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("rgb.color", new Object[] { val });

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("number.format");

              
//in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("number.format");

              
//in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/svg12/MarginShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg12/LineHeightManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/LengthManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/LengthManager.java
throw createInvalidFloatTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidFloatTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidIdentifierDOMException
                            (lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidLexicalUnitDOMException
                        (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidLexicalUnitDOMException
            (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                        (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidIdentifierDOMException(s);

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
throw createInvalidFloatValueDOMException(i);

              
//in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
throw createInvalidFloatValueDOMException(floatValue);

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (intLU.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
throw createInvalidRGBComponentUnitDOMException
            (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
throw createInvalidFloatTypeDOMException(unitType);

              
//in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
throw createInvalidFloatTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidIdentifierDOMException(id);

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createMalformedLexicalUnitDOMException();

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException((short)-1);

              
//in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
throw createInvalidFloatValueDOMException(floatValue);

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
//in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
//in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
//in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
//in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
//in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
//in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
//in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
//in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidStringTypeDOMException(type);

              
//in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidIdentifierDOMException(value);

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw e;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
//in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

            
- -
- Builder 520
              
// in sources/org/apache/batik/script/rhino/svg12/GlobalWrapper.java
throw Context.reportRuntimeError("First argument to startMouseCapture must be an EventTarget");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/script/rhino/WindowWrapper.java
throw Context.reportRuntimeError("invalid argument count");

              
// in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                            ("values.to.by.path.missing",
                             new Object[] { null });

              
// in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                            ("values.to.by.path.missing",
                             new Object[] { null });

              
// in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/MotionAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_POINTS_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/InterpolatingAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_SPLINES_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/InterpolatingAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                        ("values.to.by.missing", new Object[] { null });

              
// in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                        ("values.to.by.missing", new Object[] { null });

              
// in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                    ("attribute.malformed",
                     new Object[] { null,
                                    SMILConstants.SMIL_KEY_TIMES_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/SimpleAnimation.java
throw timedElement.createException
                ("attribute.malformed",
                 new Object[] { null,
                                SMILConstants.SMIL_KEY_SPLINES_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_BEGIN_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                        ("attribute.malformed",
                         new Object[] { null, SMIL_DUR_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_END_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                    ("attribute.malformed",
                     new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_FILL_ATTRIBUTE });

              
// in sources/org/apache/batik/anim/timing/TimedElement.java
throw createException
                ("attribute.malformed",
                 new Object[] { null, SMIL_RESTART_ATTRIBUTE });

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory2");

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                   IllegalArgumentException("TIFFDirectory3");

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory1");

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
throw new
                IllegalArgumentException("TIFFDirectory2");

              
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
throw new
                  IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam0"));

              
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
throw new
                   IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam1"));

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.pi.target");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("xml.reserved");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.doctype");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("pi.end.expected");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.tag.end");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.end.tag");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("pi.end.expected");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.comment");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.comment");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.name");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.pi.target");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("xml.reserved");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("malformed.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.character");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("character.reference");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("character.reference");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("invalid.parameter.entity");

              
// in sources/org/apache/batik/xml/XMLScanner.java
throw createXMLException("unexpected.eof");

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("element", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "version" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "version" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.data", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("pi.end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("token", new Object[] { "=" });

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end.tag", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("character.data", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("section.end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("notation.definition", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("left.brace", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("nmtoken", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("nmtoken", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("default.decl", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("xml", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("string", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("space", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("name", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("end", null);

              
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
throw fatalError("right.brace", null);

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "import.node",
                                     new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                 "import.document",
                                 new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                 "import.document",
                                 new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                     "child.type",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    new Integer(t),
                                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "document.child.already.exists",
                                     new Object[] { new Integer(t),
                                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "xml.version",
                                     new Object[] { v });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "adopt.document",
                                         new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "adopt.document.type",
                                          new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.node",
                 new Object[] { new Integer(an.getNodeType()),
                               an.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "rename.document.element",
                                     new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "rename.node",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "wf.invalid.name",
                                     new Object[] { qn });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "node.from.wrong.document",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "qname",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName(),
                                                    qn });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "prefix",
                                     new Object[] { new Integer(nt),
                                                    n.getNodeName(),
                                                    prefix });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                         "namespace",
                                         new Object[] { new Integer(nt),
                                                        n.getNodeName(),
                                                        ns });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                        ((short) 17 /*DOMException.TYPE_MISMATCH_ERR*/,
                         "domconfig.param.type",
                         new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_FOUND_ERR,
                     "domconfig.param.not.found",
                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_SUPPORTED_ERR,
                     "domconfig.param.value",
                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    ((short) 17 /*DOMException.TYPE_MISMATCH_ERR*/,
                     "domconfig.param.type",
                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_SUPPORTED_ERR,
                     "domconfig.param.value",
                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.NOT_FOUND_ERR,
                     "domconfig.param.not.found",
                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.INVALID_EXPRESSION_ERR,
                     "xpath.invalid.expression",
                     new Object[] { expr, te.getMessage() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                    (DOMException.WRONG_DOCUMENT_ERR,
                     "node.from.wrong.document",
                     new Object[] { new Integer(contextNode.getNodeType()),
                                    contextNode.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                         "xpath.invalid.result.type",
                                         new Object[] { new Integer(type) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createDOMException
                        (DOMException.NOT_SUPPORTED_ERR,
                         "xpath.invalid.context.node",
                         new Object[] { new Integer(contextNode.getNodeType()),
                                        contextNode.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.INVALID_EXPRESSION_ERR,
                     "xpath.error",
                     new Object[] { xpath.getPatternString(),
                                    te.getMessage() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                    (XPathException.TYPE_ERR,
                     "xpath.cannot.convert.result",
                     new Object[] { new Integer(type),
                                    te.getMessage() });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/AbstractDocument.java
throw createXPathException
                        (XPathException.TYPE_ERR,
                         "xpath.invalid.result.type",
                         new Object[] { new Integer(resultType) });

              
// in sources/org/apache/batik/dom/svg12/XBLOMElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/svg12/XBLOMElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
// in sources/org/apache/batik/dom/svg12/XBLOMDefinitionElement.java
throw createDOMException
                        (DOMException.NAMESPACE_ERR,
                         "prefix",
                         new Object[] { new Integer(getNodeType()),
                                        getNodeName(),
                                        prefix });

              
// in sources/org/apache/batik/dom/svg12/XBLEventSupport.java
throw createEventException
                (DOMException.NOT_SUPPORTED_ERR,
                 "unsupported.event",
                 new Object[] {});

              
// in sources/org/apache/batik/dom/svg12/XBLEventSupport.java
throw createEventException
                (EventException.UNSPECIFIED_EVENT_TYPE_ERR,
                 "unspecified.event",
                 new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
// in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "need.parent",
                                     new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException
                    (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                     "readonly.node",
                     new Object[] { new Integer(n.getNodeType()),
                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractText.java
throw createDOMException
                    (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                     "readonly.node",
                     new Object[] { new Integer(n.getNodeType()),
                                    n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractElementNS.java
throw createDOMException
                    (DOMException.NAMESPACE_ERR,
                     "namespace.uri",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName(),
                                    nsURI });

              
// in sources/org/apache/batik/dom/AbstractAttrNS.java
throw createDOMException
                    (DOMException.NAMESPACE_ERR,
                     "namespace.uri",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName(),
                                    nsURI });

              
// in sources/org/apache/batik/dom/AbstractAttrNS.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace.uri",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    nsURI });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.INVALID_STATE_ERR,
                                 "node.type",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName()});

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "parent.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "sibling.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "sibling.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName()});

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NAMESPACE_ERR,
                                     "namespace.uri",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    uri });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractNode.java
throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR,
                                 "children.not.allowed",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "xml.name",
                                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractAttr.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                            getNodeName(),
                                new Integer(n.getNodeType()),
                                            n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractDocumentFragment.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractEntity.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
throw createDOMException(DOMException.NOT_SUPPORTED_ERR,
                                     "animation.dur.indefinite",
                                     null);

              
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio",
                 new Object[] { value });

              
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "preserve.aspect.ratio.align",
                 new Object[] { new Integer(align) });

              
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
throw createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "preserve.aspect.ratio.meet.or.slice",
                 new Object[] { new Integer(meetOrSlice) });

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                             (DOMException.INDEX_SIZE_ERR, "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.INDEX_SIZE_ERR,
                 "",null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point", null);

              
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
throw svgelt.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGZoomAndPanSupport.java
throw ((AbstractNode)elt).createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "zoom.and.pan",
                 new Object[] { new Integer(val) });

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.length.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR, "invalid.suspend.handle",
                 new Object[] { new Integer(suspend_handle_id) });

              
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
throw path.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.point", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.transform.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "prefix",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName(),
                                                    prefix });

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.point.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.pathseg.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw svgelt.createDOMException
                        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                         "readonly.rect", null);

              
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
throw currentElt.createSVGException
                            (SVGException.SVG_MATRIX_NOT_INVERTABLE,
                             "noninvertiblematrix",
                             null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.number.list", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.preserve.aspect.ratio", null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR,
                 "readonly.preserve.aspect.ratio", null);

              
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
throw document.createDOMException
                (DOMException.NOT_FOUND_ERR, "invalid.element",
                 new Object[] { namespaceURI, qualifiedName });

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
throw element.createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle",
                 null);

              
// in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
// in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{""} );

              
// in sources/org/apache/batik/dom/svg/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{localName} );

              
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
throw createDOMException
                (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds",
                 new Object[] { new Integer(index) } );

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(refChild.getNodeType()),
                                refChild.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(oldChild.getNodeType()),
                                oldChild.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(oldChild.getNodeType()),
                                oldChild.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException(DOMException.WRONG_DOCUMENT_ERR,
                                     "node.from.wrong.document",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "add.self", new Object[] { getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                    (DOMException.HIERARCHY_REQUEST_ERR,
                     "add.ancestor",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(r.getNodeType()),
                                r.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(o.getNodeType()),
                                o.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractParentNode.java
throw createDOMException
                (DOMException.NOT_FOUND_ERR,
                 "child.missing",
                 new Object[] { new Integer(n.getNodeType()),
                                n.getNodeName() });

              
// in sources/org/apache/batik/dom/traversal/DOMTreeWalker.java
throw ((AbstractNode)root).createDOMException
                (DOMException.NOT_SUPPORTED_ERR,
                 "null.current.node",  null);

              
// in sources/org/apache/batik/dom/traversal/TraversalSupport.java
throw doc.createDOMException
                (DOMException.NOT_SUPPORTED_ERR, "null.root",  null);

              
// in sources/org/apache/batik/dom/traversal/TraversalSupport.java
throw doc.createDOMException
                (DOMException.NOT_SUPPORTED_ERR, "null.root",  null);

              
// in sources/org/apache/batik/dom/traversal/DOMNodeIterator.java
throw document.createDOMException
                (DOMException.INVALID_STATE_ERR,
                 "detached.iterator",  null);

              
// in sources/org/apache/batik/dom/traversal/DOMNodeIterator.java
throw document.createDOMException
                (DOMException.INVALID_STATE_ERR,
                 "detached.iterator",  null);

              
// in sources/org/apache/batik/dom/events/EventSupport.java
throw createEventException(DOMException.NOT_SUPPORTED_ERR,
                                       "unsupported.event",
                                       new Object[] { });

              
// in sources/org/apache/batik/dom/events/EventSupport.java
throw createEventException
                (EventException.UNSPECIFIED_EVENT_TYPE_ERR,
                 "unspecified.event",
                 new Object[] {});

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { new Integer(getNodeType()),
                                                    getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "offset",
                                     new Object[] { new Integer(offset) });

              
// in sources/org/apache/batik/dom/AbstractCharacterData.java
throw createDOMException(DOMException.INDEX_SIZE_ERR,
                                     "negative.count",
                                     new Object[] { new Integer(count) });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                   "xml.name",
                   new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                   "attribute.missing",
                   new Object[] { oldAttr.getName() });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                                     "attribute.missing",
                                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NOT_FOUND_ERR,
                                     "attribute.missing",
                                     new Object[] { ns, ln });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { a.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                     "readonly.node",
                                     new Object[] { a.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                      (DOMException.HIERARCHY_REQUEST_ERR,
                       "child.type",
                       new Object[] { new Integer(getNodeType()),
                                      getNodeName(),
                                      new Integer(n.getNodeType()),
                                      n.getNodeName() });

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{""} );

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.NOT_FOUND_ERR,
                        "attribute.missing",
                        new Object[]{localName} );

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException
                        ( DOMException.NO_MODIFICATION_ALLOWED_ERR,
                                "readonly.node.map",
                                new Object[]{} );

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.WRONG_DOCUMENT_ERR,
                        "node.from.wrong.document",
                        new Object[]{new Integer( arg.getNodeType() ),
                                arg.getNodeName()} );

              
// in sources/org/apache/batik/dom/AbstractElement.java
throw createDOMException( DOMException.WRONG_DOCUMENT_ERR,
                        "inuse.attribute",
                        new Object[]{arg.getNodeName()} );

              
// in sources/org/apache/batik/dom/util/DOMUtilities.java
throw new
                    IOException("Unserializable processing instruction node");

              
// in sources/org/apache/batik/dom/AbstractEntityReference.java
throw createDOMException(DOMException.INVALID_CHARACTER_ERR,
                                     "xml.name",
                                     new Object[] { name });

              
// in sources/org/apache/batik/dom/AbstractEntityReference.java
throw createDOMException
                (DOMException.HIERARCHY_REQUEST_ERR,
                 "child.type",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                new Integer(n.getNodeType()),
                                n.getNodeName() });

              
// in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
throw createDOMException
                (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node",
                 new Object[] { new Integer(getNodeType()), getNodeName() });

              
// in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
throw createDOMException
                (DOMException.INVALID_CHARACTER_ERR, "prefix",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                prefix });

              
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
throw doc.createXPathException
                (XPathException.INVALID_EXPRESSION_ERR,
                 "xpath.invalid.expression",
                 new Object[] { expression, te.getMessage() });

              
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
throw doc.createXPathException
                        (XPathException.INVALID_EXPRESSION_ERR,
                         "xpath.error",
                         new Object[] { expression, te.getMessage() });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.element.position");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.bracket");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier.or.string");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.bracket");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                                ("duplicate.pseudo.element");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("right.brace");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("pseudo.function");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("eof");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("eof.expected");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("identifier");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("colon");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                            ("token", new Object[] { new Integer(current) });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                            ("token", new Object[] { new Integer(current) });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                    ("token",
                     new Object[] { new Integer(current) });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                ("token",
                 new Object[] { new Integer(current) });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                ("token",
                 new Object[] { new Integer(current) });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException
                    ("rgb.color", new Object[] { val });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("rgb.color");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("rgb.color", new Object[] { val });

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("number.format");

              
// in sources/org/apache/batik/css/parser/Parser.java
throw createCSSParseException("number.format");

              
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/svg12/MarginShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg12/LineHeightManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/LengthManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/LengthManager.java
throw createInvalidFloatTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
throw createInvalidFloatTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidIdentifierDOMException
                            (lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidLexicalUnitDOMException
                        (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidLexicalUnitDOMException
            (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                        (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidIdentifierDOMException(s);

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
throw createInvalidFloatValueDOMException(i);

              
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
throw createInvalidFloatValueDOMException(floatValue);

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                                (intLU.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createInvalidLexicalUnitDOMException
                    (intLU.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/css2/FontShorthandManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
throw createInvalidRGBComponentUnitDOMException
            (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
throw createInvalidFloatTypeDOMException(unitType);

              
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
throw createInvalidFloatTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidIdentifierDOMException(id);

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createMalformedLexicalUnitDOMException();

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException
                    (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException((short)-1);

              
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
throw createInvalidIdentifierDOMException(value);

              
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
throw createInvalidFloatValueDOMException(floatValue);

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
throw createDOMException();

              
// in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
// in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
// in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
// in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
// in sources/org/apache/batik/css/engine/value/RectManager.java
throw createMalformedRectDOMException();

              
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidIdentifierDOMException(lu.getStringValue());

              
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidLexicalUnitDOMException
                (lu.getLexicalUnitType());

              
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidStringTypeDOMException(type);

              
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
throw createInvalidIdentifierDOMException(value);

            
- -
- Variable 67
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
throw e;

              
// in sources/org/apache/batik/svggen/DefaultErrorHandler.java
throw ex;

              
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
throw io;

              
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
throw td;

              
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
throw ibe;

              
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
throw ie;

              
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
throw td;

              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
throw td;

              
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
throw td;

              
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
throw td;

              
// in sources/org/apache/batik/parser/DefaultErrorHandler.java
throw e;

              
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
throw ex;

              
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
throw ex;

              
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
throw ex;

              
// in sources/org/apache/batik/dom/svg/SVGZoomAndPanSupport.java
throw ((AbstractNode)elt).createDOMException
                (DOMException.INVALID_MODIFICATION_ERR,
                 "zoom.and.pan",
                 new Object[] { new Integer(val) });

              
// in sources/org/apache/batik/dom/traversal/DOMTreeWalker.java
throw ((AbstractNode)root).createDOMException
                (DOMException.NOT_SUPPORTED_ERR,
                 "null.current.node",  null);

              
// in sources/org/apache/batik/dom/events/EventSupport.java
throw td;

              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw (InterruptedIOException) ex;

              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw (InterruptedIOException)ex;

              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw ex;

              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
throw ex;

              
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.se;

              
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.se;

              
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
throw q.rex;

              
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
throw td;

              
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
throw td;

              
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
throw td;

              
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
throw td;

              
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
throw td;

              
// in sources/org/apache/batik/bridge/DefaultScriptSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/UpdateManager.java
throw td;

              
// in sources/org/apache/batik/bridge/DefaultExternalResourceSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/CursorManager.java
throw be;

              
// in sources/org/apache/batik/bridge/CursorManager.java
throw ex;

              
// in sources/org/apache/batik/bridge/NoLoadScriptSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/EmbededExternalResourceSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/NoLoadExternalResourceSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ex;

              
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ex;

              
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
throw ibe;

              
// in sources/org/apache/batik/bridge/EmbededScriptSecurity.java
throw se;

              
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
throw e;

              
// in sources/org/apache/batik/bridge/GVTBuilder.java
throw ex;

              
// in sources/org/apache/batik/bridge/GVTBuilder.java
throw ex;

              
// in sources/org/apache/batik/util/ParsedURLData.java
throw e;

              
// in sources/org/apache/batik/util/CleanerThread.java
throw td;

              
// in sources/org/apache/batik/util/EventDispatcher.java
throw td;

              
// in sources/org/apache/batik/util/EventDispatcher.java
throw td;

              
// in sources/org/apache/batik/util/RunnableQueue.java
throw td;

              
// in sources/org/apache/batik/util/RunnableQueue.java
throw td;

              
// in sources/org/apache/batik/util/PreferenceManager.java
throw e3;

              
// in sources/org/apache/batik/css/parser/DefaultErrorHandler.java
throw e;

              
// in sources/org/apache/batik/css/parser/Parser.java
throw e;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw e;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

              
// in sources/org/apache/batik/css/engine/CSSEngine.java
throw de;

            
- -
(Domain) BridgeException 193
              
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
protected RegionInfo buildRegion(UnitProcessor.Context uctx, Element e, float verticalAlignment) { String s; // 'x' attribute - default is 0 s = e.getAttribute(BATIK_EXT_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, BATIK_EXT_X_ATTRIBUTE, uctx); } // 'y' attribute - default is 0 s = e.getAttribute(BATIK_EXT_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, BATIK_EXT_Y_ATTRIBUTE, uctx); } // 'width' attribute - required s = e.getAttribute(BATIK_EXT_WIDTH_ATTRIBUTE); float w; if (s.length() != 0) { w = UnitProcessor.svgHorizontalLengthToUserSpace (s, BATIK_EXT_WIDTH_ATTRIBUTE, uctx); } else { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_WIDTH_ATTRIBUTE, s}); } // A value of zero disables rendering of the element if (w == 0) { return null; } // 'height' attribute - required s = e.getAttribute(BATIK_EXT_HEIGHT_ATTRIBUTE); float h; if (s.length() != 0) { h = UnitProcessor.svgVerticalLengthToUserSpace (s, BATIK_EXT_HEIGHT_ATTRIBUTE, uctx); } else { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_HEIGHT_ATTRIBUTE, s}); } // A value of zero disables rendering of the element if (h == 0) { return null; } return new RegionInfo(x,y,w,h,verticalAlignment); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e); String s; // 'cx' attribute - default is 0 s = e.getAttributeNS(null, SVG_CX_ATTRIBUTE); float cx = 0; if (s.length() != 0) { cx = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_CX_ATTRIBUTE, uctx); } // 'cy' attribute - default is 0 s = e.getAttributeNS(null, SVG_CY_ATTRIBUTE); float cy = 0; if (s.length() != 0) { cy = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_CY_ATTRIBUTE, uctx); } // 'r' attribute - required s = e.getAttributeNS(null, SVG_R_ATTRIBUTE); float r; if (s.length() == 0) throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_R_ATTRIBUTE, s}); r = UnitProcessor.svgOtherLengthToUserSpace (s, SVG_R_ATTRIBUTE, uctx); // 'ir' attribute - required s = e.getAttributeNS(null, BATIK_EXT_IR_ATTRIBUTE); float ir; if (s.length() == 0) throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_IR_ATTRIBUTE, s}); ir = UnitProcessor.svgOtherLengthToUserSpace (s, BATIK_EXT_IR_ATTRIBUTE, uctx); // 'sides' attribute - default is 3 int sides = convertSides(e, BATIK_EXT_SIDES_ATTRIBUTE, 3, ctx); GeneralPath gp = new GeneralPath(); double angle, x, y; final double SECTOR = 2.0 * Math.PI/sides; final double HALF_PI = Math.PI / 2.0; for (int i=0; i<sides; i++) { angle = i * SECTOR - HALF_PI; x = cx + ir*Math.cos(angle); y = cy - ir*Math.sin(angle); if (i==0) gp.moveTo((float)x, (float)y); else gp.lineTo((float)x, (float)y); angle = (i+0.5) * SECTOR - HALF_PI; x = cx + r*Math.cos(angle); y = cy - r*Math.sin(angle); gp.lineTo((float)x, (float)y); } gp.closePath(); shapeNode.setShape(gp); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e); String s; // 'cx' attribute - default is 0 s = e.getAttributeNS(null, SVG_CX_ATTRIBUTE); float cx = 0; if (s.length() != 0) { cx = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_CX_ATTRIBUTE, uctx); } // 'cy' attribute - default is 0 s = e.getAttributeNS(null, SVG_CY_ATTRIBUTE); float cy = 0; if (s.length() != 0) { cy = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_CY_ATTRIBUTE, uctx); } // 'r' attribute - required s = e.getAttributeNS(null, SVG_R_ATTRIBUTE); float r; if (s.length() != 0) { r = UnitProcessor.svgOtherLengthToUserSpace (s, SVG_R_ATTRIBUTE, uctx); } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_R_ATTRIBUTE, s}); } // 'sides' attribute - default is 3 int sides = convertSides(e, BATIK_EXT_SIDES_ATTRIBUTE, 3, ctx); GeneralPath gp = new GeneralPath(); for (int i=0; i<sides; i++) { double angle = (i+0.5)*(2*Math.PI/sides) - (Math.PI/2); double x = cx + r*Math.cos(angle); double y = cy - r*Math.sin(angle); if (i==0) gp.moveTo((float)x, (float)y); else gp.lineTo((float)x, (float)y); } gp.closePath(); shapeNode.setShape(gp); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // The default region is the union of the input sources // regions unless 'in' is 'SourceGraphic' in which case the // default region is the filterChain's region Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE); Rectangle2D defaultRegion; if (in == sourceGraphics) { defaultRegion = filterRegion; } else { defaultRegion = in.getBounds2D(); } Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); float trim = 1; String s = filterElement.getAttributeNS (null, BATIK_EXT_TRIM_ATTRIBUTE); if (s.length() != 0) { try { trim = SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); } } if (trim < 0) trim =0; else if (trim > 100) trim=100; Filter filter = in; filter = new BatikHistogramNormalizationFilter8Bit(filter, trim/100); filter = new PadRable8Bit(filter, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(filter, filterElement); return filter; }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { Class cls = JSVGComponent.class; URL blURL = cls.getResource("resources/BrokenLink.svg"); if (blURL == null) throw new BridgeException (bridgeContext, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] { url, message }); DocumentLoader loader = bridgeContext.getDocumentLoader(); SVGDocument doc = null; try { doc = (SVGDocument)loader.loadDocument(blURL.toString()); if (doc == null) return doc; DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); doc = (SVGDocument)DOMUtilities.deepCloneDocument(doc, impl); String title; Element infoE, titleE, descE; infoE = doc.getElementById("__More_About"); if (infoE == null) return doc; titleE = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_TITLE_TAG); title = Messages.formatMessage(BROKEN_LINK_TITLE, null); titleE.appendChild(doc.createTextNode(title)); descE = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_DESC_TAG); descE.appendChild(doc.createTextNode(message)); infoE.insertBefore(descE, infoE.getFirstChild()); infoE.insertBefore(titleE, descE); } catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); } return doc; }
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPolylineElement pe = (SVGOMPolylineElement) e; try { SVGOMAnimatedPoints _points = pe.getSVGOMAnimatedPoints(); _points.check(); SVGPointList pl = _points.getAnimatedPoints(); int size = pl.getNumberOfItems(); if (size == 0) { shapeNode.setShape(DEFAULT_SHAPE); } else { AWTPolylineProducer app = new AWTPolylineProducer(); app.setWindingRule(CSSUtilities.convertFillRule(e)); app.startPoints(); for (int i = 0; i < size; i++) { SVGPoint p = pl.getItem(i); app.point(p.getX(), p.getY()); } app.endPoints(); shapeNode.setShape(app.getShape()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPathElement pe = (SVGOMPathElement) e; AWTPathProducer app = new AWTPathProducer(); try { // 'd' attribute - required SVGOMAnimatedPathData _d = pe.getAnimatedPathData(); _d.check(); SVGPathSegList p = _d.getAnimatedPathSegList(); app.setWindingRule(CSSUtilities.convertFillRule(e)); SVGAnimatedPathDataSupport.handlePathSegList(p, app); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } finally { shapeNode.setShape(app.getShape()); } }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
protected static float [] convertTableValues(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TABLE_VALUES_ATTRIBUTE); if (s.length() == 0) { return null; } StringTokenizer tokens = new StringTokenizer(s, " ,"); float [] v = new float[tokens.countTokens()]; try { for (int i = 0; tokens.hasMoreTokens(); ++i) { v[i] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); } return v; }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
protected static int convertType(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_TYPE_ATTRIBUTE}); } if (SVG_DISCRETE_VALUE.equals(s)) { return ComponentTransferFunction.DISCRETE; } if (SVG_IDENTITY_VALUE.equals(s)) { return ComponentTransferFunction.IDENTITY; } if (SVG_GAMMA_VALUE.equals(s)) { return ComponentTransferFunction.GAMMA; } if (SVG_LINEAR_VALUE.equals(s)) { return ComponentTransferFunction.LINEAR; } if (SVG_TABLE_VALUE.equals(s)) { return ComponentTransferFunction.TABLE; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/svg12/SVGMultiImageElementBridge.java
protected static Rectangle2D getImageBounds(BridgeContext ctx, Element element) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); // 'x' attribute - default is 0 String s = element.getAttributeNS(null, SVG_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_X_ATTRIBUTE, uctx); } // 'y' attribute - default is 0 s = element.getAttributeNS(null, SVG_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_Y_ATTRIBUTE, uctx); } // 'width' attribute - required s = element.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE); float w; if (s.length() == 0) { throw new BridgeException(ctx, element, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_WIDTH_ATTRIBUTE}); } else { w = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_WIDTH_ATTRIBUTE, uctx); } // 'height' attribute - required s = element.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE); float h; if (s.length() == 0) { throw new BridgeException(ctx, element, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HEIGHT_ATTRIBUTE}); } else { h = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_HEIGHT_ATTRIBUTE, uctx); } return new Rectangle2D.Float(x, y, w, h); }
// in sources/org/apache/batik/bridge/svg12/SVGMultiImageElementBridge.java
protected void addRefInfo(Element e, Collection elems, Collection minDim, Collection maxDim, Rectangle2D bounds) { String uriStr = XLinkSupport.getXLinkHref(e); if (uriStr.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } String baseURI = AbstractNode.getBaseURI(e); ParsedURL purl; if (baseURI == null) purl = new ParsedURL(uriStr); else purl = new ParsedURL(baseURI, uriStr); Document doc = e.getOwnerDocument(); Element imgElem = doc.createElementNS(SVG_NAMESPACE_URI, SVG_IMAGE_TAG); imgElem.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE, purl.toString()); // move the attributes from <subImageRef> to the <image> element NamedNodeMap attrs = e.getAttributes(); int len = attrs.getLength(); for (int i = 0; i < len; i++) { Attr attr = (Attr)attrs.item(i); imgElem.setAttributeNS(attr.getNamespaceURI(), attr.getName(), attr.getValue()); } String s; s = e.getAttribute("x"); if (s.length() == 0) imgElem.setAttribute("x", "0"); s = e.getAttribute("y"); if (s.length() == 0) imgElem.setAttribute("y", "0"); s = e.getAttribute("width"); if (s.length() == 0) imgElem.setAttribute("width", "100%"); s = e.getAttribute("height"); if (s.length() == 0) imgElem.setAttribute("height", "100%"); e.appendChild(imgElem); elems.add(imgElem); minDim.add(getElementMinPixel(e, bounds)); maxDim.add(getElementMaxPixel(e, bounds)); }
// in sources/org/apache/batik/bridge/svg12/SVGSolidColorElementBridge.java
protected static float extractOpacity(Element paintElement, float opacity, BridgeContext ctx) { Map refs = new HashMap(); CSSEngine eng = CSSUtilities.getCSSEngine(paintElement); int pidx = eng.getPropertyIndex (SVG12CSSConstants.CSS_SOLID_OPACITY_PROPERTY); for (;;) { Value opacityVal = CSSUtilities.getComputedStyle(paintElement, pidx); // Was solid-opacity explicity set on this element? StyleMap sm = ((CSSStylableElement)paintElement).getComputedStyleMap(null); if (!sm.isNullCascaded(pidx)) { // It was explicit... float attr = PaintServer.convertOpacity(opacityVal); return (opacity * attr); } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { return opacity; // no xlink:href found, exit } SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); // check if there is circular dependencies if (refs.containsKey(purl)) { throw new BridgeException (ctx, paintElement, ErrorConstants.ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.put(purl, purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/svg12/SVGSolidColorElementBridge.java
protected static Color extractColor(Element paintElement, float opacity, BridgeContext ctx) { Map refs = new HashMap(); CSSEngine eng = CSSUtilities.getCSSEngine(paintElement); int pidx = eng.getPropertyIndex (SVG12CSSConstants.CSS_SOLID_COLOR_PROPERTY); for (;;) { Value colorDef = CSSUtilities.getComputedStyle(paintElement, pidx); // Was solid-color explicity set on this element? StyleMap sm = ((CSSStylableElement)paintElement).getComputedStyleMap(null); if (!sm.isNullCascaded(pidx)) { // It was explicit... if (colorDef.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { return PaintServer.convertColor(colorDef, opacity); } else { return PaintServer.convertRGBICCColor (paintElement, colorDef.item(0), (ICCColor)colorDef.item(1), opacity, ctx); } } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { // no xlink:href found, exit return new Color(0, 0, 0, opacity); } SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); // check if there is circular dependencies if (refs.containsKey(purl)) { throw new BridgeException (ctx, paintElement, ErrorConstants.ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.put(purl, purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
protected void addDefinitionRef(Element defRef) { String ref = defRef.getAttributeNS(null, XBL_REF_ATTRIBUTE); Element e = ctx.getReferencedElement(defRef, ref); if (!XBL_NAMESPACE_URI.equals(e.getNamespaceURI()) || !XBL_DEFINITION_TAG.equals(e.getLocalName())) { throw new BridgeException (ctx, defRef, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { ref }); } ImportRecord ir = new ImportRecord(defRef, e); imports.put(defRef, ir); NodeEventTarget et = (NodeEventTarget) defRef; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", refAttrListener, false, null); XBLOMDefinitionElement d = (XBLOMDefinitionElement) defRef; String ns = d.getElementNamespaceURI(); String ln = d.getElementLocalName(); addDefinition(ns, ln, (XBLOMDefinitionElement) e, defRef); }
// in sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
protected void addImport(Element imp) { String bindings = imp.getAttributeNS(null, XBL_BINDINGS_ATTRIBUTE); Node n = ctx.getReferencedNode(imp, bindings); if (n.getNodeType() == Node.ELEMENT_NODE && !(XBL_NAMESPACE_URI.equals(n.getNamespaceURI()) && XBL_XBL_TAG.equals(n.getLocalName()))) { throw new BridgeException (ctx, imp, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { n }); } ImportRecord ir = new ImportRecord(imp, n); imports.put(imp, ir); NodeEventTarget et = (NodeEventTarget) imp; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", importAttrListener, false, null); et = (NodeEventTarget) n; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", ir.importInsertedListener, false, null); et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", ir.importRemovedListener, false, null); et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified", ir.importSubtreeListener, false, null); addImportedDefinitions(imp, n); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
protected void initializeAnimation() { // Determine the target element. String uri = XLinkSupport.getXLinkHref(element); Node t; if (uri.length() == 0) { t = element.getParentNode(); } else { t = ctx.getReferencedElement(element, uri); if (t.getOwnerDocument() != element.getOwnerDocument()) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } } animationTarget = null; if (t instanceof SVGOMElement) { targetElement = (SVGOMElement) t; animationTarget = targetElement; } if (animationTarget == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } // Get the attribute/property name. String an = element.getAttributeNS(null, SVG_ATTRIBUTE_NAME_ATTRIBUTE); int ci = an.indexOf(':'); if (ci == -1) { if (element.hasProperty(an)) { animationType = AnimationEngine.ANIM_TYPE_CSS; attributeLocalName = an; } else { animationType = AnimationEngine.ANIM_TYPE_XML; attributeLocalName = an; } } else { animationType = AnimationEngine.ANIM_TYPE_XML; String prefix = an.substring(0, ci); attributeNamespaceURI = element.lookupNamespaceURI(prefix); attributeLocalName = an.substring(ci + 1); } if (animationType == AnimationEngine.ANIM_TYPE_CSS && !targetElement.isPropertyAnimatable(attributeLocalName) || animationType == AnimationEngine.ANIM_TYPE_XML && !targetElement.isAttributeAnimatable(attributeNamespaceURI, attributeLocalName)) { throw new BridgeException (ctx, element, "attribute.not.animatable", new Object[] { targetElement.getNodeName(), an }); } // Check that the attribute/property is animatable with this // animation element. int type; if (animationType == AnimationEngine.ANIM_TYPE_CSS) { type = targetElement.getPropertyType(attributeLocalName); } else { type = targetElement.getAttributeType(attributeNamespaceURI, attributeLocalName); } if (!canAnimateType(type)) { throw new BridgeException (ctx, element, "type.not.animatable", new Object[] { targetElement.getNodeName(), an, element.getNodeName() }); } // Add the animation. timedElement = createTimedElement(); animation = createAnimation(animationTarget); eng.addAnimation(animationTarget, animationType, attributeNamespaceURI, attributeLocalName, animation); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
protected AnimatableValue parseAnimatableValue(String an) { if (!element.hasAttributeNS(null, an)) { return null; } String s = element.getAttributeNS(null, an); AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, animationType == AnimationEngine.ANIM_TYPE_CSS, s); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { an, s }); } return val; }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { boolean rebuild = false; if (alav.getNamespaceURI() == null) { String ln = alav.getLocalName(); if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) { rebuild = true; } else if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; // X & Y are ignored on outermost SVG. boolean isOutermost = doc.getRootElement() == e; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); float y = _y.getCheckedValue(); AffineTransform positionTransform = AffineTransform.getTranslateInstance(x, y); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; cgn.setPositionTransform(positionTransform); return; } } else if (ln.equals(SVG_VIEW_BOX_ATTRIBUTE) || ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; boolean isOutermost = doc.getRootElement() == e; // X & Y are ignored on outermost SVG. float x = 0; float y = 0; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); y = _y.getCheckedValue(); } // 'width' attribute - default is 100% AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) se.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - default is 100% AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) se.getHeight(); float h = _height.getCheckedValue(); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; // 'viewBox' and "preserveAspectRatio' attributes SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox(); SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio(); AffineTransform newVT = ViewBox.getPreserveAspectRatioTransform (e, vb, par, w, h, ctx); AffineTransform oldVT = cgn.getViewingTransform(); if ((newVT.getScaleX() != oldVT.getScaleX()) || (newVT.getScaleY() != oldVT.getScaleY()) || (newVT.getShearX() != oldVT.getShearX()) || (newVT.getShearY() != oldVT.getShearY())) rebuild = true; else { // Only differs in translate. cgn.setViewingTransform(newVT); // 'overflow' and 'clip' Shape clip = null; if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { // clip:auto clip = new Rectangle2D.Float(x, y, w, h); } else { // clip:rect(<x> <y> <w> <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { AffineTransform at; at = cgn.getPositionTransform(); if (at == null) at = new AffineTransform(); else at = new AffineTransform(at); at.concatenate(newVT); at = at.createInverse(); // clip in user space clip = at.createTransformedShape(clip); Filter filter = cgn.getGraphicsNodeRable(true); cgn.setClip(new ClipRable8Bit(filter, clip)); } catch (NoninvertibleTransformException ex) {} } } } if (rebuild) { CompositeGraphicsNode gn = node.getParent(); gn.remove(node); disposeTree(e, false); handleElementAdded(gn, e.getParentNode(), e); return; } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { throw new BridgeException(ctx, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/bridge/SVGFeBlendElementBridge.java
protected static CompositeRule convertMode(Element filterElement, BridgeContext ctx) { String rule = filterElement.getAttributeNS(null, SVG_MODE_ATTRIBUTE); if (rule.length() == 0) { return CompositeRule.OVER; } if (SVG_NORMAL_VALUE.equals(rule)) { return CompositeRule.OVER; } if (SVG_MULTIPLY_VALUE.equals(rule)) { return CompositeRule.MULTIPLY; } if (SVG_SCREEN_VALUE.equals(rule)) { return CompositeRule.SCREEN; } if (SVG_DARKEN_VALUE.equals(rule)) { return CompositeRule.DARKEN; } if (SVG_LIGHTEN_VALUE.equals(rule)) { return CompositeRule.LIGHTEN; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_MODE_ATTRIBUTE, rule}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
public SVGFontFace createFontFace(BridgeContext ctx, Element fontFaceElement) { // get all the font-face attributes String familyNames = fontFaceElement.getAttributeNS (null, SVG_FONT_FAMILY_ATTRIBUTE); // units per em String unitsPerEmStr = fontFaceElement.getAttributeNS (null, SVG_UNITS_PER_EM_ATTRIBUTE); if (unitsPerEmStr.length() == 0) { unitsPerEmStr = SVG_FONT_FACE_UNITS_PER_EM_DEFAULT_VALUE; } float unitsPerEm; try { unitsPerEm = SVGUtilities.convertSVGNumber(unitsPerEmStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); } // font-weight String fontWeight = fontFaceElement.getAttributeNS (null, SVG_FONT_WEIGHT_ATTRIBUTE); if (fontWeight.length() == 0) { fontWeight = SVG_FONT_FACE_FONT_WEIGHT_DEFAULT_VALUE; } // font-style String fontStyle = fontFaceElement.getAttributeNS (null, SVG_FONT_STYLE_ATTRIBUTE); if (fontStyle.length() == 0) { fontStyle = SVG_FONT_FACE_FONT_STYLE_DEFAULT_VALUE; } // font-variant String fontVariant = fontFaceElement.getAttributeNS (null, SVG_FONT_VARIANT_ATTRIBUTE); if (fontVariant.length() == 0) { fontVariant = SVG_FONT_FACE_FONT_VARIANT_DEFAULT_VALUE; } // font-stretch String fontStretch = fontFaceElement.getAttributeNS (null, SVG_FONT_STRETCH_ATTRIBUTE); if (fontStretch.length() == 0) { fontStretch = SVG_FONT_FACE_FONT_STRETCH_DEFAULT_VALUE; } // slopeStr String slopeStr = fontFaceElement.getAttributeNS (null, SVG_SLOPE_ATTRIBUTE); if (slopeStr.length() == 0) { slopeStr = SVG_FONT_FACE_SLOPE_DEFAULT_VALUE; } float slope; try { slope = SVGUtilities.convertSVGNumber(slopeStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); } // panose-1 String panose1 = fontFaceElement.getAttributeNS (null, SVG_PANOSE_1_ATTRIBUTE); if (panose1.length() == 0) { panose1 = SVG_FONT_FACE_PANOSE_1_DEFAULT_VALUE; } // ascent String ascentStr = fontFaceElement.getAttributeNS (null, SVG_ASCENT_ATTRIBUTE); if (ascentStr.length() == 0) { // set it to be unitsPerEm * .8 ascentStr = String.valueOf( unitsPerEm * 0.8); } float ascent; try { ascent = SVGUtilities.convertSVGNumber(ascentStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); } // descent String descentStr = fontFaceElement.getAttributeNS (null, SVG_DESCENT_ATTRIBUTE); if (descentStr.length() == 0) { // set it to be unitsPerEm *.2. descentStr = String.valueOf(unitsPerEm*0.2); } float descent; try { descent = SVGUtilities.convertSVGNumber(descentStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); } // underline-position String underlinePosStr = fontFaceElement.getAttributeNS (null, SVG_UNDERLINE_POSITION_ATTRIBUTE); if (underlinePosStr.length() == 0) { underlinePosStr = String.valueOf(-3*unitsPerEm/40); } float underlinePos; try { underlinePos = SVGUtilities.convertSVGNumber(underlinePosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); } // underline-thickness String underlineThicknessStr = fontFaceElement.getAttributeNS (null, SVG_UNDERLINE_THICKNESS_ATTRIBUTE); if (underlineThicknessStr.length() == 0) { underlineThicknessStr = String.valueOf(unitsPerEm/20); } float underlineThickness; try { underlineThickness = SVGUtilities.convertSVGNumber(underlineThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); } // strikethrough-position String strikethroughPosStr = fontFaceElement.getAttributeNS (null, SVG_STRIKETHROUGH_POSITION_ATTRIBUTE); if (strikethroughPosStr.length() == 0) { strikethroughPosStr = String.valueOf(3*ascent/8); } float strikethroughPos; try { strikethroughPos = SVGUtilities.convertSVGNumber(strikethroughPosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); } // strikethrough-thickness String strikethroughThicknessStr = fontFaceElement.getAttributeNS (null, SVG_STRIKETHROUGH_THICKNESS_ATTRIBUTE); if (strikethroughThicknessStr.length() == 0) { strikethroughThicknessStr = String.valueOf(unitsPerEm/20); } float strikethroughThickness; try { strikethroughThickness = SVGUtilities.convertSVGNumber(strikethroughThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); } // overline-position String overlinePosStr = fontFaceElement.getAttributeNS (null, SVG_OVERLINE_POSITION_ATTRIBUTE); if (overlinePosStr.length() == 0) { overlinePosStr = String.valueOf(ascent); } float overlinePos; try { overlinePos = SVGUtilities.convertSVGNumber(overlinePosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); } // overline-thickness String overlineThicknessStr = fontFaceElement.getAttributeNS (null, SVG_OVERLINE_THICKNESS_ATTRIBUTE); if (overlineThicknessStr.length() == 0) { overlineThicknessStr = String.valueOf(unitsPerEm/20); } float overlineThickness; try { overlineThickness = SVGUtilities.convertSVGNumber(overlineThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); } List srcs = null; Element fontElt = SVGUtilities.getParentElement(fontFaceElement); if (!fontElt.getNamespaceURI().equals(SVG_NAMESPACE_URI) || !fontElt.getLocalName().equals(SVG_FONT_TAG)) { srcs = getFontFaceSrcs(fontFaceElement); } // TODO: get the rest of the attributes return new SVGFontFace(fontFaceElement, srcs, familyNames, unitsPerEm, fontWeight, fontStyle, fontVariant, fontStretch, slope, panose1, ascent, descent, strikethroughPos, strikethroughThickness, underlinePos, underlineThickness, overlinePos, overlineThickness); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getViewTransform(String ref, Element e, float w, float h, BridgeContext ctx) { // no reference has been specified, no extra viewBox is defined if (ref == null || ref.length() == 0) { return getPreserveAspectRatioTransform(e, w, h, ctx); } ViewHandler vh = new ViewHandler(); FragmentIdentifierParser p = new FragmentIdentifierParser(); p.setFragmentIdentifierHandler(vh); p.parse(ref); // Determine the 'view' element that ref refers to. Element viewElement = e; if (vh.hasId) { Document document = e.getOwnerDocument(); viewElement = document.getElementById(vh.id); } if (viewElement == null) { throw new BridgeException(ctx, e, ERR_URI_MALFORMED, new Object[] {ref}); } if (!(viewElement.getNamespaceURI().equals(SVG_NAMESPACE_URI) && viewElement.getLocalName().equals(SVG_VIEW_TAG))) { viewElement = null; } Element ancestorSVG = getClosestAncestorSVGElement(e); // 'viewBox' float[] vb; if (vh.hasViewBox) { vb = vh.viewBox; } else { Element elt; if (DOMUtilities.isAttributeSpecifiedNS (viewElement, null, SVG_VIEW_BOX_ATTRIBUTE)) { elt = viewElement; } else { elt = ancestorSVG; } String viewBoxStr = elt.getAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE); vb = parseViewBoxAttribute(elt, viewBoxStr, ctx); } // 'preserveAspectRatio' short align; boolean meet; if (vh.hasPreserveAspectRatio) { align = vh.align; meet = vh.meet; } else { Element elt; if (DOMUtilities.isAttributeSpecifiedNS (viewElement, null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { elt = viewElement; } else { elt = ancestorSVG; } String aspectRatio = elt.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); PreserveAspectRatioParser pp = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); pp.setPreserveAspectRatioHandler(ph); try { pp.parse(aspectRatio); } catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } align = ph.align; meet = ph.meet; } // the additional transform that may appear on the URI AffineTransform transform = getPreserveAspectRatioTransform(vb, align, meet, w, h); if (vh.hasTransform) { transform.concatenate(vh.getAffineTransform()); } return transform; }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform(Element e, String viewBox, String aspectRatio, float w, float h, BridgeContext ctx) { // no viewBox specified if (viewBox.length() == 0) { return new AffineTransform(); } float[] vb = parseViewBoxAttribute(e, viewBox, ctx); // 'preserveAspectRatio' attribute PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform(Element e, float[] vb, float w, float h, BridgeContext ctx) { String aspectRatio = e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); // 'preserveAspectRatio' attribute PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform (Element e, float[] vb, float w, float h, SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) { // 'preserveAspectRatio' attribute try { SVGPreserveAspectRatio pAR = aPAR.getAnimVal(); short align = pAR.getAlign(); boolean meet = pAR.getMeetOrSlice() == SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; return getPreserveAspectRatioTransform(vb, align, meet, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/ViewBox.java
public static float[] parseViewBoxAttribute(Element e, String value, BridgeContext ctx) { if (value.length() == 0) { return null; } int i = 0; float[] vb = new float[4]; StringTokenizer st = new StringTokenizer(value, " ,"); try { while (i < 4 && st.hasMoreTokens()) { vb[i] = Float.parseFloat(st.nextToken()); i++; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); } if (i != 4) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value}); } // A negative value for <width> or <height> is an error if (vb[2] < 0 || vb[3] < 0) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value}); } // A value of zero for width or height disables rendering of the element if (vb[2] == 0 || vb[3] == 0) { return null; // <!> FIXME : must disable ! } return vb; }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
protected static double[] convertKernelUnitLength(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE); if (s.length() == 0) { return null; } double [] units = new double[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { units[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { units[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { units[1] = units[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } if (tokens.hasMoreTokens() || units[0] <= 0 || units[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } return units; }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
protected static MultipleGradientPaint.CycleMethodEnum convertSpreadMethod (Element paintElement, String s, BridgeContext ctx) { if (SVG_REPEAT_VALUE.equals(s)) { return MultipleGradientPaint.REPEAT; } if (SVG_REFLECT_VALUE.equals(s)) { return MultipleGradientPaint.REFLECT; } if (SVG_PAD_VALUE.equals(s)) { return MultipleGradientPaint.NO_CYCLE; } throw new BridgeException (ctx, paintElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPREAD_METHOD_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
protected static List extractStop(Element paintElement, float opacity, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { List stops = extractLocalStop(paintElement, opacity, ctx); if (stops != null) { return stops; // stop elements found, exit } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { return null; // no xlink:href found, exit } // check if there is circular dependencies String baseURI = ((AbstractNode) paintElement).getBaseURI(); ParsedURL purl = new ParsedURL(baseURI, uri); if (contains(refs, purl)) { throw new BridgeException(ctx, paintElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
public Stop createStop(BridgeContext ctx, Element gradientElement, Element stopElement, float opacity) { String s = stopElement.getAttributeNS(null, SVG_OFFSET_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException (ctx, stopElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_OFFSET_ATTRIBUTE}); } float offset; try { offset = SVGUtilities.convertRatio(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); } Color color = CSSUtilities.convertStopColor(stopElement, opacity, ctx); return new Stop(color, offset); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float[][] convertValuesToMatrix(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); float [][] matrix = new float[4][5]; if (s.length() == 0) { matrix[0][0] = 1; matrix[1][1] = 1; matrix[2][2] = 1; matrix[3][3] = 1; return matrix; } StringTokenizer tokens = new StringTokenizer(s, " ,"); int n = 0; try { while (n < 20 && tokens.hasMoreTokens()) { matrix[n/5][n%5] = SVGUtilities.convertSVGNumber(tokens.nextToken()); n++; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); } if (n != 20 || tokens.hasMoreTokens()) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } for (int i = 0; i < 4; ++i) { matrix[i][4] *= 255; } return matrix; }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float convertValuesToSaturate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 1; // default is 1 try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float convertValuesToHueRotate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 0; // default is 0 try { return (float) Math.toRadians( SVGUtilities.convertSVGNumber(s) ); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static int convertType(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { return ColorMatrixRable.TYPE_MATRIX; } if (SVG_HUE_ROTATE_VALUE.equals(s)) { return ColorMatrixRable.TYPE_HUE_ROTATE; } if (SVG_LUMINANCE_TO_ALPHA_VALUE.equals(s)) { return ColorMatrixRable.TYPE_LUMINANCE_TO_ALPHA; } if (SVG_MATRIX_VALUE.equals(s)) { return ColorMatrixRable.TYPE_MATRIX; } if (SVG_SATURATE_VALUE.equals(s)) { return ColorMatrixRable.TYPE_SATURATE; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeDisplacementMapElementBridge.java
protected static ARGBChannel convertChannelSelector(Element filterElement, String attrName, ARGBChannel defaultChannel, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultChannel; } if (SVG_A_VALUE.equals(s)) { return ARGBChannel.A; } if (SVG_R_VALUE.equals(s)) { return ARGBChannel.R; } if (SVG_G_VALUE.equals(s)) { return ARGBChannel.G; } if (SVG_B_VALUE.equals(s)) { return ARGBChannel.B; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
protected AffineTransform computeTransform(SVGTransformable te, BridgeContext ctx) { try { AffineTransform at = new AffineTransform(); // 'transform' SVGOMAnimatedTransformList atl = (SVGOMAnimatedTransformList) te.getTransform(); if (atl.isSpecified()) { atl.check(); AbstractSVGTransformList tl = (AbstractSVGTransformList) te.getTransform().getAnimVal(); at.concatenate(tl.getAffineTransform()); } // motion animation if (e instanceof SVGMotionAnimatableElement) { SVGMotionAnimatableElement mae = (SVGMotionAnimatableElement) e; AffineTransform mat = mae.getMotionTransform(); if (mat != null) { at.concatenate(mat); } } return at; } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/CursorManager.java
public Cursor convertSVGCursorElement(Element cursorElement) { // One of the cursor url resolved to a <cursor> element // Try to handle its image. String uriStr = XLinkSupport.getXLinkHref(cursorElement); if (uriStr.length() == 0) { throw new BridgeException(ctx, cursorElement, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } String baseURI = AbstractNode.getBaseURI(cursorElement); ParsedURL purl; if (baseURI == null) { purl = new ParsedURL(uriStr); } else { purl = new ParsedURL(baseURI, uriStr); } // // Convert the cursor's hot spot // UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, cursorElement); String s = cursorElement.getAttributeNS(null, SVG_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_X_ATTRIBUTE, uctx); } s = cursorElement.getAttributeNS(null, SVG_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_Y_ATTRIBUTE, uctx); } CursorDescriptor desc = new CursorDescriptor(purl, x, y); // // Check if there is a cursor in the cache for this url // Cursor cachedCursor = cursorCache.getCursor(desc); if (cachedCursor != null) { return cachedCursor; } // // Load image into Filter f and transform hotSpot to // cursor space. // Point2D.Float hotSpot = new Point2D.Float(x, y); Filter f = cursorHrefToFilter(cursorElement, purl, hotSpot); if (f == null) { cursorCache.clearCursor(desc); return null; } // The returned Filter is guaranteed to create a // default rendering of the desired size Rectangle cursorSize = f.getBounds2D().getBounds(); RenderedImage ri = f.createScaledRendering(cursorSize.width, cursorSize.height, null); Image img = null; if (ri instanceof Image) { img = (Image)ri; } else { img = renderedImageToImage(ri); } // Make sure the not spot does not fall out of the cursor area. If it // does, then clamp the coordinates to the image space. hotSpot.x = hotSpot.x < 0 ? 0 : hotSpot.x; hotSpot.y = hotSpot.y < 0 ? 0 : hotSpot.y; hotSpot.x = hotSpot.x > (cursorSize.width-1) ? cursorSize.width - 1 : hotSpot.x; hotSpot.y = hotSpot.y > (cursorSize.height-1) ? cursorSize.height - 1: hotSpot.y; // // The cursor image is now into 'img' // Cursor c = Toolkit.getDefaultToolkit() .createCustomCursor(img, new Point(Math.round(hotSpot.x), Math.round(hotSpot.y)), purl.toString()); cursorCache.putCursor(desc, c); return c; }
// in sources/org/apache/batik/bridge/CursorManager.java
protected Filter cursorHrefToFilter(Element cursorElement, ParsedURL purl, Point2D hotSpot) { AffineRable8Bit f = null; String uriStr = purl.toString(); Dimension cursorSize = null; // Try to load as an SVG Document DocumentLoader loader = ctx.getDocumentLoader(); SVGDocument svgDoc = (SVGDocument)cursorElement.getOwnerDocument(); URIResolver resolver = ctx.createURIResolver(svgDoc, loader); try { Element rootElement = null; Node n = resolver.getNode(uriStr, cursorElement); if (n.getNodeType() == Node.DOCUMENT_NODE) { SVGDocument doc = (SVGDocument)n; // FIXX: really should be subCtx here. ctx.initializeDocument(doc); rootElement = doc.getRootElement(); } else { throw new BridgeException (ctx, cursorElement, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } GraphicsNode node = ctx.getGVTBuilder().build(ctx, rootElement); // // The cursorSize define the viewport into which the // cursor is displayed. That viewport is platform // dependant and is not defined by the SVG content. // float width = DEFAULT_PREFERRED_WIDTH; float height = DEFAULT_PREFERRED_HEIGHT; UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, rootElement); String s = rootElement.getAttribute(SVG_WIDTH_ATTRIBUTE); if (s.length() != 0) { width = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_WIDTH_ATTRIBUTE, uctx); } s = rootElement.getAttribute(SVG_HEIGHT_ATTRIBUTE); if (s.length() != 0) { height = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_HEIGHT_ATTRIBUTE, uctx); } cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize (Math.round(width), Math.round(height)); // Handle the viewBox transform AffineTransform at = ViewBox.getPreserveAspectRatioTransform (rootElement, cursorSize.width, cursorSize.height, ctx); Filter filter = node.getGraphicsNodeRable(true); f = new AffineRable8Bit(filter, at); } catch (BridgeException ex) { throw ex; } catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); } catch (Exception ex) { /* Nothing to do */ } // If f is null, it means that we are not dealing with // an SVG image. Try as a raster image. if (f == null) { ImageTagRegistry reg = ImageTagRegistry.getRegistry(); Filter filter = reg.readURL(purl); if (filter == null) { return null; } // Check if we got a broken image if (BrokenLinkProvider.hasBrokenLinkProperty(filter)) { return null; } Rectangle preferredSize = filter.getBounds2D().getBounds(); cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize (preferredSize.width, preferredSize.height); if (preferredSize != null && preferredSize.width >0 && preferredSize.height > 0 ) { AffineTransform at = new AffineTransform(); if (preferredSize.width > cursorSize.width || preferredSize.height > cursorSize.height) { at = ViewBox.getPreserveAspectRatioTransform (new float[] {0, 0, preferredSize.width, preferredSize.height}, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN, true, cursorSize.width, cursorSize.height); } f = new AffineRable8Bit(filter, at); } else { // Invalid Size return null; } } // // Transform the hot spot from image space to cursor space // AffineTransform at = f.getAffine(); at.transform(hotSpot, hotSpot); // // In all cases, clip to the cursor boundaries // Rectangle cursorViewport = new Rectangle(0, 0, cursorSize.width, cursorSize.height); PadRable8Bit cursorImage = new PadRable8Bit(f, cursorViewport, PadMode.ZERO_PAD); return cursorImage; }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPolygonElement pe = (SVGOMPolygonElement) e; try { SVGOMAnimatedPoints _points = pe.getSVGOMAnimatedPoints(); _points.check(); SVGPointList pl = _points.getAnimatedPoints(); int size = pl.getNumberOfItems(); if (size == 0) { shapeNode.setShape(DEFAULT_SHAPE); } else { AWTPolygonProducer app = new AWTPolygonProducer(); app.setWindingRule(CSSUtilities.convertFillRule(e)); app.startPoints(); for (int i = 0; i < size; i++) { SVGPoint p = pl.getItem(i); app.point(p.getX(), p.getY()); } app.endPoints(); shapeNode.setShape(app.getShape()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static int[] convertOrder(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_ORDER_ATTRIBUTE); if (s.length() == 0) { return new int[] {3, 3}; } int [] orderXY = new int[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { orderXY[0] = SVGUtilities.convertSVGInteger(tokens.nextToken()); if (tokens.hasMoreTokens()) { orderXY[1] = SVGUtilities.convertSVGInteger(tokens.nextToken()); } else { orderXY[1] = orderXY[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens() || orderXY[0] <= 0 || orderXY[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s}); } return orderXY; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static float[] convertKernelMatrix(Element filterElement, int[] orderXY, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_KERNEL_MATRIX_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE}); } int size = orderXY[0]*orderXY[1]; float [] kernelMatrix = new float[size]; StringTokenizer tokens = new StringTokenizer(s, " ,"); int i = 0; try { while (tokens.hasMoreTokens() && i < size) { kernelMatrix[i++] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); } if (i != size) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s}); } return kernelMatrix; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static float convertDivisor(Element filterElement, float[] kernelMatrix, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_DIVISOR_ATTRIBUTE); if (s.length() == 0) { // default is sum of kernel values (if sum is zero then 1.0) float sum = 0; for (int i=0; i < kernelMatrix.length; ++i) { sum += kernelMatrix[i]; } return (sum == 0) ? 1.0f : sum; } else { try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); } } }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static int[] convertTarget(Element filterElement, int[] orderXY, BridgeContext ctx) { int[] targetXY = new int[2]; // 'targetX' attribute - default is floor(orderX / 2) String s = filterElement.getAttributeNS(null, SVG_TARGET_X_ATTRIBUTE); if (s.length() == 0) { targetXY[0] = orderXY[0] / 2; } else { try { int v = SVGUtilities.convertSVGInteger(s); if (v < 0 || v >= orderXY[0]) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s}); } targetXY[0] = v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); } } // 'targetY' attribute - default is floor(orderY / 2) s = filterElement.getAttributeNS(null, SVG_TARGET_Y_ATTRIBUTE); if (s.length() == 0) { targetXY[1] = orderXY[1] / 2; } else { try { int v = SVGUtilities.convertSVGInteger(s); if (v < 0 || v >= orderXY[1]) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s}); } targetXY[1] = v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); } } return targetXY; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static double[] convertKernelUnitLength(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE); if (s.length() == 0) { return null; } double [] units = new double[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { units[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { units[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { units[1] = units[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } if (tokens.hasMoreTokens() || units[0] <= 0 || units[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } return units; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static PadMode convertEdgeMode(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_EDGE_MODE_ATTRIBUTE); if (s.length() == 0) { return PadMode.REPLICATE; } if (SVG_DUPLICATE_VALUE.equals(s)) { return PadMode.REPLICATE; } if (SVG_WRAP_VALUE.equals(s)) { return PadMode.WRAP; } if (SVG_NONE_VALUE.equals(s)) { return PadMode.ZERO_PAD; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_EDGE_MODE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static boolean convertPreserveAlpha(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_PRESERVE_ALPHA_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_TRUE_VALUE.equals(s)) { return true; } if (SVG_FALSE_VALUE.equals(s)) { return false; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ALPHA_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFilterElementBridge.java
protected static Filter buildFilterPrimitives(Element filterElement, Rectangle2D filterRegion, Element filteredElement, GraphicsNode filteredNode, Filter in, Map filterNodeMap, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { Filter newIn = buildLocalFilterPrimitives(filterElement, filterRegion, filteredElement, filteredNode, in, filterNodeMap, ctx); if (newIn != in) { return newIn; // filter primitives found, exit } String uri = XLinkSupport.getXLinkHref(filterElement); if (uri.length() == 0) { return in; // no xlink:href found, exit } // check if there is circular dependencies SVGOMDocument doc = (SVGOMDocument)filterElement.getOwnerDocument(); ParsedURL url = new ParsedURL(doc.getURLObject(), uri); if (refs.contains(url)) { throw new BridgeException(ctx, filterElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(url); filterElement = ctx.getReferencedElement(filterElement, uri); } }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
public ICCColorSpaceExt createICCColorSpaceExt(BridgeContext ctx, Element paintedElement, String iccProfileName) { // Check if there is one if the cache. ICCColorSpaceExt cs = cache.request(iccProfileName.toLowerCase()); // todo locale?? if (cs != null){ return cs; } // There was no cached copies for the profile. Load it now. // Search for a color-profile element with specific name Document doc = paintedElement.getOwnerDocument(); NodeList list = doc.getElementsByTagNameNS(SVG_NAMESPACE_URI, SVG_COLOR_PROFILE_TAG); int n = list.getLength(); Element profile = null; for(int i=0; i<n; i++){ Node node = list.item(i); if(node.getNodeType() == Node.ELEMENT_NODE){ Element profileNode = (Element)node; String nameAttr = profileNode.getAttributeNS(null, SVG_NAME_ATTRIBUTE); if(iccProfileName.equalsIgnoreCase(nameAttr)){ profile = profileNode; } } } if(profile == null) return null; // Now that we have a profile element, // try to load the corresponding ICC profile xlink:href String href = XLinkSupport.getXLinkHref(profile); ICC_Profile p = null; if (href != null) { String baseURI = ((AbstractNode) profile).getBaseURI(); ParsedURL pDocURL = null; if (baseURI != null) { pDocURL = new ParsedURL(baseURI); } ParsedURL purl = new ParsedURL(pDocURL, href); if (!purl.complete()) throw new BridgeException(ctx, paintedElement, ERR_URI_MALFORMED, new Object[] {href}); try { ctx.getUserAgent().checkLoadExternalResource(purl, pDocURL); p = ICC_Profile.getInstance(purl.openStream()); } catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? } catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); } } if (p == null) { return null; } // Extract the rendering intent from profile element int intent = convertIntent(profile, ctx); cs = new ICCColorSpaceExt(p, intent); // Add profile to cache cache.put(iccProfileName.toLowerCase(), cs); return cs; }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
private static int convertIntent(Element profile, BridgeContext ctx) { String intent = profile.getAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE); if (intent.length() == 0) { return ICCColorSpaceExt.AUTO; } if (SVG_PERCEPTUAL_VALUE.equals(intent)) { return ICCColorSpaceExt.PERCEPTUAL; } if (SVG_AUTO_VALUE.equals(intent)) { return ICCColorSpaceExt.AUTO; } if (SVG_RELATIVE_COLORIMETRIC_VALUE.equals(intent)) { return ICCColorSpaceExt.RELATIVE_COLORIMETRIC; } if (SVG_ABSOLUTE_COLORIMETRIC_VALUE.equals(intent)) { return ICCColorSpaceExt.ABSOLUTE_COLORIMETRIC; } if (SVG_SATURATION_VALUE.equals(intent)) { return ICCColorSpaceExt.SATURATION; } throw new BridgeException (ctx, profile, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RENDERING_INTENT_ATTRIBUTE, intent}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
protected static float[] convertRadius(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_RADIUS_ATTRIBUTE); if (s.length() == 0) { return new float[] {0, 0}; } float [] radii = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { radii[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { radii[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { radii[1] = radii[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens() || radii[0] < 0 || radii[1] < 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s}); } return radii; }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
protected static boolean convertOperator(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_OPERATOR_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_ERODE_VALUE.equals(s)) { return false; } if (SVG_DILATE_VALUE.equals(s)) { return true; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OPERATOR_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
public Glyph createGlyph(BridgeContext ctx, Element glyphElement, Element textElement, int glyphCode, float fontSize, GVTFontFace fontFace, TextPaintInfo tpi) { float fontHeight = fontFace.getUnitsPerEm(); float scale = fontSize/fontHeight; AffineTransform scaleTransform = AffineTransform.getScaleInstance(scale, -scale); // create a shape that represents the d attribute String d = glyphElement.getAttributeNS(null, SVG_D_ATTRIBUTE); Shape dShape = null; if (d.length() != 0) { AWTPathProducer app = new AWTPathProducer(); // Glyph is supposed to use properties from text element. app.setWindingRule(CSSUtilities.convertFillRule(textElement)); try { PathParser pathParser = new PathParser(); pathParser.setPathHandler(app); pathParser.parse(d); } catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); } finally { // transform the shape into the correct coord system Shape shape = app.getShape(); Shape transformedShape = scaleTransform.createTransformedShape(shape); dShape = transformedShape; } } // process any glyph children // first see if there are any, because don't want to do the following // bit of code if we can avoid it NodeList glyphChildren = glyphElement.getChildNodes(); int numChildren = glyphChildren.getLength(); int numGlyphChildren = 0; for (int i = 0; i < numChildren; i++) { Node childNode = glyphChildren.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { numGlyphChildren++; } } CompositeGraphicsNode glyphContentNode = null; if (numGlyphChildren > 0) { // the glyph has child elements // build the GVT tree that represents the glyph children GVTBuilder builder = ctx.getGVTBuilder(); glyphContentNode = new CompositeGraphicsNode(); // // need to clone the parent font element and glyph element // this is so that the glyph doesn't inherit anything past the font element // Element fontElementClone = (Element)glyphElement.getParentNode().cloneNode(false); // copy all font attributes over NamedNodeMap fontAttributes = glyphElement.getParentNode().getAttributes(); int numAttributes = fontAttributes.getLength(); for (int i = 0; i < numAttributes; i++) { fontElementClone.setAttributeNode((Attr)fontAttributes.item(i)); } Element clonedGlyphElement = (Element)glyphElement.cloneNode(true); fontElementClone.appendChild(clonedGlyphElement); textElement.appendChild(fontElementClone); CompositeGraphicsNode glyphChildrenNode = new CompositeGraphicsNode(); glyphChildrenNode.setTransform(scaleTransform); NodeList clonedGlyphChildren = clonedGlyphElement.getChildNodes(); int numClonedChildren = clonedGlyphChildren.getLength(); for (int i = 0; i < numClonedChildren; i++) { Node childNode = clonedGlyphChildren.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element)childNode; GraphicsNode childGraphicsNode = builder.build(ctx, childElement); glyphChildrenNode.add(childGraphicsNode); } } glyphContentNode.add(glyphChildrenNode); textElement.removeChild(fontElementClone); } // set up glyph attributes // unicode String unicode = glyphElement.getAttributeNS(null, SVG_UNICODE_ATTRIBUTE); // glyph-name String nameList = glyphElement.getAttributeNS(null, SVG_GLYPH_NAME_ATTRIBUTE); List names = new ArrayList(); StringTokenizer st = new StringTokenizer(nameList, " ,"); while (st.hasMoreTokens()) { names.add(st.nextToken()); } // orientation String orientation = glyphElement.getAttributeNS(null, SVG_ORIENTATION_ATTRIBUTE); // arabicForm String arabicForm = glyphElement.getAttributeNS(null, SVG_ARABIC_FORM_ATTRIBUTE); // lang String lang = glyphElement.getAttributeNS(null, SVG_LANG_ATTRIBUTE); Element parentFontElement = (Element)glyphElement.getParentNode(); // horz-adv-x String s = glyphElement.getAttributeNS(null, SVG_HORIZ_ADV_X_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ADV_X_ATTRIBUTE); if (s.length() == 0) { // throw an exception since this attribute is required on the font element throw new BridgeException (ctx, parentFontElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HORIZ_ADV_X_ATTRIBUTE}); } } float horizAdvX; try { horizAdvX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); } // vert-adv-y s = glyphElement.getAttributeNS(null, SVG_VERT_ADV_Y_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ADV_Y_ATTRIBUTE); if (s.length() == 0) { // not specified on parent either, use one em s = String.valueOf(fontFace.getUnitsPerEm()); } } float vertAdvY; try { vertAdvY = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); } // vert-origin-x s = glyphElement.getAttributeNS(null, SVG_VERT_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is horizAdvX/2 s = Float.toString(horizAdvX/2); } } float vertOriginX; try { vertOriginX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); } // vert-origin-y s = glyphElement.getAttributeNS(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is the fonts ascent s = String.valueOf(fontFace.getAscent()); } } float vertOriginY; try { vertOriginY = SVGUtilities.convertSVGNumber(s) * -scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); } Point2D vertOrigin = new Point2D.Float(vertOriginX, vertOriginY); // get the horizontal origin from the parent font element // horiz-origin-x s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is 0 s = SVG_HORIZ_ORIGIN_X_DEFAULT_VALUE; } float horizOriginX; try { horizOriginX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); } // horiz-origin-y s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is 0 s = SVG_HORIZ_ORIGIN_Y_DEFAULT_VALUE; } float horizOriginY; try { horizOriginY = SVGUtilities.convertSVGNumber(s) * -scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); } Point2D horizOrigin = new Point2D.Float(horizOriginX, horizOriginY); // return a new Glyph return new Glyph(unicode, names, orientation, arabicForm, lang, horizOrigin, vertOrigin, horizAdvX, vertAdvY, glyphCode, tpi, dShape, glyphContentNode); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Point2D getLocation(BridgeContext ctx, Element e) { try { SVGOMTextPositioningElement te = (SVGOMTextPositioningElement) e; // 'x' attribute - default is 0 SVGOMAnimatedLengthList _x = (SVGOMAnimatedLengthList) te.getX(); _x.check(); SVGLengthList xs = _x.getAnimVal(); float x = 0; if (xs.getNumberOfItems() > 0) { x = xs.getItem(0).getValue(); } // 'y' attribute - default is 0 SVGOMAnimatedLengthList _y = (SVGOMAnimatedLengthList) te.getY(); _y.check(); SVGLengthList ys = _y.getAnimVal(); float y = 0; if (ys.getNumberOfItems() > 0) { y = ys.getItem(0).getValue(); } return new Point2D.Float(x, y); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected void addGlyphPositionAttributes(AttributedString as, Element element, BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || (!CSSUtilities.convertDisplay(element))) { return; } if (element.getLocalName().equals(SVG_TEXT_PATH_TAG)) { // 'textPath' doesn't support position attributes. addChildGlyphPositionAttributes(as, element, ctx); return; } // calculate which chars in the string belong to this element int firstChar = getElementStartIndex(element); // No match so no chars to annotate. if (firstChar == -1) return; int lastChar = getElementEndIndex(element); // 'a' elements aren't SVGTextPositioningElements, so don't process // their positioning attributes on them. if (!(element instanceof SVGTextPositioningElement)) { addChildGlyphPositionAttributes(as, element, ctx); return; } // get all of the glyph position attribute values SVGTextPositioningElement te = (SVGTextPositioningElement) element; try { SVGOMAnimatedLengthList _x = (SVGOMAnimatedLengthList) te.getX(); _x.check(); SVGOMAnimatedLengthList _y = (SVGOMAnimatedLengthList) te.getY(); _y.check(); SVGOMAnimatedLengthList _dx = (SVGOMAnimatedLengthList) te.getDx(); _dx.check(); SVGOMAnimatedLengthList _dy = (SVGOMAnimatedLengthList) te.getDy(); _dy.check(); SVGOMAnimatedNumberList _rotate = (SVGOMAnimatedNumberList) te.getRotate(); _rotate.check(); SVGLengthList xs = _x.getAnimVal(); SVGLengthList ys = _y.getAnimVal(); SVGLengthList dxs = _dx.getAnimVal(); SVGLengthList dys = _dy.getAnimVal(); SVGNumberList rs = _rotate.getAnimVal(); int len; // process the x attribute len = xs.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.X, new Float(xs.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process the y attribute len = ys.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.Y, new Float(ys.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process dx attribute len = dxs.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.DX, new Float(dxs.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process dy attribute len = dys.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.DY, new Float(dys.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process rotate attribute len = rs.getNumberOfItems(); if (len == 1) { // not a list // each char will have the same rotate value Float rad = new Float(Math.toRadians(rs.getItem(0).getValue())); as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.ROTATION, rad, firstChar, lastChar + 1); } else if (len > 1) { // it's a list // set each rotate value from the list for (int i = 0; i < len && firstChar + i <= lastChar; i++) { Float rad = new Float(Math.toRadians(rs.getItem(i).getValue())); as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.ROTATION, rad, firstChar + i, firstChar + i + 1); } } addChildGlyphPositionAttributes(as, element, ctx); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Map getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result) { SVGTextContentElement tce = null; if (element instanceof SVGTextContentElement) { // 'a' elements aren't SVGTextContentElements, so they shouldn't // be checked for 'textLength' or 'lengthAdjust' attributes. tce = (SVGTextContentElement) element; } Map inheritMap = null; String s; if (SVG_NAMESPACE_URI.equals(element.getNamespaceURI()) && element.getLocalName().equals(SVG_ALT_GLYPH_TAG)) { result.put(ALT_GLYPH_HANDLER, new SVGAltGlyphHandler(ctx, element)); } // Add null TPI objects to the text (after we set it on the // Text we will swap in the correct values. TextPaintInfo pi = new TextPaintInfo(); // Set some basic props so we can get bounds info for complex paints. pi.visible = true; pi.fillPaint = Color.black; result.put(PAINT_INFO, pi); elemTPI.put(element, pi); if (textPath != null) { result.put(TEXTPATH, textPath); } // Text-anchor TextNode.Anchor a = TextUtilities.convertTextAnchor(element); result.put(ANCHOR_TYPE, a); // Font family List fontList = getFontList(ctx, element, result); result.put(GVT_FONTS, fontList); // Text baseline adjustment. Object bs = TextUtilities.convertBaselineShift(element); if (bs != null) { result.put(BASELINE_SHIFT, bs); } // Unicode-bidi mode Value val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.UNICODE_BIDI_INDEX); s = val.getStringValue(); if (s.charAt(0) == 'n') { if (bidiLevel != null) result.put(TextAttribute.BIDI_EMBEDDING, bidiLevel); } else { // Text direction // XXX: this needs to coordinate with the unicode-bidi // property, so that when an explicit reversal // occurs, the BIDI_EMBEDDING level is // appropriately incremented or decremented. // Note that direction is implicitly handled by unicode // BiDi algorithm in most cases, this property // is only needed when one wants to override the // normal writing direction for a string/substring. val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.DIRECTION_INDEX); String rs = val.getStringValue(); int cbidi = 0; if (bidiLevel != null) cbidi = bidiLevel.intValue(); // We don't care if it was embed or override we just want // it's level here. So map override to positive value. if (cbidi < 0) cbidi = -cbidi; switch (rs.charAt(0)) { case 'l': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_LTR); if ((cbidi & 0x1) == 1) cbidi++; // was odd now even else cbidi+=2; // next greater even number break; case 'r': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); if ((cbidi & 0x1) == 1) cbidi+=2; // next greater odd number else cbidi++; // was even now odd break; } switch (s.charAt(0)) { case 'b': // bidi-override cbidi = -cbidi; // For bidi-override we want a negative number. break; } result.put(TextAttribute.BIDI_EMBEDDING, new Integer(cbidi)); } // Writing mode val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.WRITING_MODE_INDEX); s = val.getStringValue(); switch (s.charAt(0)) { case 'l': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_LTR); break; case 'r': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_RTL); break; case 't': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_TTB); break; } // glyph-orientation-vertical val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX); int primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: // auto result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_AUTO); break; case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (V):" + primitiveType ); } // glyph-orientation-horizontal val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_HORIZONTAL_INDEX); primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (H):" + primitiveType ); } // text spacing properties... // Letter Spacing Float sp = TextUtilities.convertLetterSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.LETTER_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Word spacing sp = TextUtilities.convertWordSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.WORD_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Kerning sp = TextUtilities.convertKerning(element); if (sp != null) { result.put(GVTAttributedCharacterIterator.TextAttribute.KERNING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } if (tce == null) { return inheritMap; } try { // textLength AbstractSVGAnimatedLength textLength = (AbstractSVGAnimatedLength) tce.getTextLength(); if (textLength.isSpecified()) { if (inheritMap == null) { inheritMap = new HashMap(); } Object value = new Float(textLength.getCheckedValue()); result.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); inheritMap.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); // lengthAdjust SVGOMAnimatedEnumeration _lengthAdjust = (SVGOMAnimatedEnumeration) tce.getLengthAdjust(); if (_lengthAdjust.getCheckedVal() == SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS) { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); } else { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } return inheritMap; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AbstractAnimation createAnimation(AnimationTarget target) { animationType = AnimationEngine.ANIM_TYPE_OTHER; attributeLocalName = "motion"; AnimatableValue from = parseLengthPair(SVG_FROM_ATTRIBUTE); AnimatableValue to = parseLengthPair(SVG_TO_ATTRIBUTE); AnimatableValue by = parseLengthPair(SVG_BY_ATTRIBUTE); boolean rotateAuto = false, rotateAutoReverse = false; float rotateAngle = 0; short rotateAngleUnit = SVGAngle.SVG_ANGLETYPE_UNKNOWN; String rotateString = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); if (rotateString.length() != 0) { if (rotateString.equals("auto")) { rotateAuto = true; } else if (rotateString.equals("auto-reverse")) { rotateAuto = true; rotateAutoReverse = true; } else { class Handler implements AngleHandler { float theAngle; short theUnit = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; public void startAngle() throws ParseException { } public void angleValue(float v) throws ParseException { theAngle = v; } public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; } public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; } public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; } public void endAngle() throws ParseException { } } AngleParser ap = new AngleParser(); Handler h = new Handler(); ap.setAngleHandler(h); try { ap.parse(rotateString); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); } rotateAngle = h.theAngle; rotateAngleUnit = h.theUnit; } } return new MotionAnimation(timedElement, this, parseCalcMode(), parseKeyTimes(), parseKeySplines(), parseAdditive(), parseAccumulate(), parseValues(), from, to, by, parsePath(), parseKeyPoints(), rotateAuto, rotateAutoReverse, rotateAngle, rotateAngleUnit); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected ExtendedGeneralPath parsePath() { Node n = element.getFirstChild(); while (n != null) { if (n.getNodeType() == Node.ELEMENT_NODE && SVG_NAMESPACE_URI.equals(n.getNamespaceURI()) && SVG_MPATH_TAG.equals(n.getLocalName())) { String uri = XLinkSupport.getXLinkHref((Element) n); Element path = ctx.getReferencedElement(element, uri); if (!SVG_NAMESPACE_URI.equals(path.getNamespaceURI()) || !SVG_PATH_TAG.equals(path.getLocalName())) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } SVGOMPathElement pathElt = (SVGOMPathElement) path; AWTPathProducer app = new AWTPathProducer(); SVGAnimatedPathDataSupport.handlePathSegList (pathElt.getPathSegList(), app); return (ExtendedGeneralPath) app.getShape(); } n = n.getNextSibling(); } String pathString = element.getAttributeNS(null, SVG_PATH_ATTRIBUTE); if (pathString.length() == 0) { return null; } try { AWTPathProducer app = new AWTPathProducer(); PathParser pp = new PathParser(); pp.setPathHandler(app); pp.parse(pathString); return (ExtendedGeneralPath) app.getShape(); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); } }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected float[] parseKeyPoints() { String keyPointsString = element.getAttributeNS(null, SVG_KEY_POINTS_ATTRIBUTE); int len = keyPointsString.length(); if (len == 0) { return null; } List keyPoints = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (keyPointsString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keyPointsString.charAt(i); while (c != ' ' && c != ';' && c != ',') { i++; if (i == len) { break; } c = keyPointsString.charAt(i); } } end = i++; try { float keyPointCoord = Float.parseFloat(keyPointsString.substring(start, end)); keyPoints.add(new Float(keyPointCoord)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); } } len = keyPoints.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keyPoints.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AnimatableValue[] parseValues(String s) { try { LengthPairListParser lplp = new LengthPairListParser(); LengthArrayProducer lap = new LengthArrayProducer(); lplp.setLengthListHandler(lap); lplp.parse(s); short[] types = lap.getLengthTypeArray(); float[] values = lap.getLengthValueArray(); AnimatableValue[] ret = new AnimatableValue[types.length / 2]; for (int i = 0; i < types.length; i += 2) { float x = animationTarget.svgToUserSpace (values[i], types[i], AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH); float y = animationTarget.svgToUserSpace (values[i + 1], types[i + 1], AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT); ret[i / 2] = new AnimatableMotionPointValue(animationTarget, x, y, 0); } return ret; } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); } }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected void initializeAnimation() { // Determine the target element. String uri = XLinkSupport.getXLinkHref(element); Node t; if (uri.length() == 0) { t = element.getParentNode(); } else { t = ctx.getReferencedElement(element, uri); if (t.getOwnerDocument() != element.getOwnerDocument()) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } } animationTarget = null; if (t instanceof SVGOMElement) { targetElement = (SVGOMElement) t; animationTarget = targetElement; } if (animationTarget == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } // Add the animation. timedElement = createTimedElement(); animation = createAnimation(animationTarget); eng.addAnimation(animationTarget, AnimationEngine.ANIM_TYPE_OTHER, attributeNamespaceURI, attributeLocalName, animation); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
public TextPath createTextPath(BridgeContext ctx, Element textPathElement) { // get the referenced element String uri = XLinkSupport.getXLinkHref(textPathElement); Element pathElement = ctx.getReferencedElement(textPathElement, uri); if ((pathElement == null) || (!SVG_NAMESPACE_URI.equals(pathElement.getNamespaceURI())) || (!pathElement.getLocalName().equals(SVG_PATH_TAG))) { // couldn't find the referenced element // or the referenced element was not a path throw new BridgeException(ctx, textPathElement, ERR_URI_BAD_TARGET, new Object[] {uri}); } // construct a shape for the referenced path element String s = pathElement.getAttributeNS(null, SVG_D_ATTRIBUTE); Shape pathShape = null; if (s.length() != 0) { AWTPathProducer app = new AWTPathProducer(); app.setWindingRule(CSSUtilities.convertFillRule(pathElement)); try { PathParser pathParser = new PathParser(); pathParser.setPathHandler(app); pathParser.parse(s); } catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); } finally { pathShape = app.getShape(); } } else { throw new BridgeException(ctx, pathElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_D_ATTRIBUTE}); } // if the reference path element has a transform apply the transform // to the path shape s = pathElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE); if (s.length() != 0) { AffineTransform tr = SVGUtilities.convertTransform(pathElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx); pathShape = tr.createTransformedShape(pathShape); } // create the TextPath object that we are going to return TextPath textPath = new TextPath(new GeneralPath(pathShape)); // set the start offset if specified s = textPathElement.getAttributeNS(null, SVG_START_OFFSET_ATTRIBUTE); if (s.length() > 0) { float startOffset = 0; int percentIndex = s.indexOf('%'); if (percentIndex != -1) { // its a percentage of the length of the path float pathLength = textPath.lengthOfPath(); String percentString = s.substring(0,percentIndex); float startOffsetPercent = 0; try { startOffsetPercent = SVGUtilities.convertSVGNumber(percentString); } catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); } startOffset = (float)(startOffsetPercent * pathLength/100.0); } else { // its an absolute length UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, textPathElement); startOffset = UnitProcessor.svgOtherLengthToUserSpace(s, SVG_START_OFFSET_ATTRIBUTE, uctx); } textPath.setStartOffset(startOffset); } return textPath; }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMRectElement re = (SVGOMRectElement) e; // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) re.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) re.getY(); float y = _y.getCheckedValue(); // 'width' attribute - required AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) re.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - required AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) re.getHeight(); float h = _height.getCheckedValue(); // 'rx' attribute - default is 0 AbstractSVGAnimatedLength _rx = (AbstractSVGAnimatedLength) re.getRx(); float rx = _rx.getCheckedValue(); if (rx > w / 2) { rx = w / 2; } // 'ry' attribute - default is rx AbstractSVGAnimatedLength _ry = (AbstractSVGAnimatedLength) re.getRy(); float ry = _ry.getCheckedValue(); if (ry > h / 2) { ry = h / 2; } Shape shape; if (rx == 0 || ry == 0) { shape = new Rectangle2D.Float(x, y, w, h); } else { shape = new RoundRectangle2D.Float(x, y, w, h, rx * 2, ry * 2); } shapeNode.setShape(shape); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGPatternElementBridge.java
protected static RootGraphicsNode extractPatternContent(Element patternElement, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { RootGraphicsNode content = extractLocalPatternContent(patternElement, ctx); if (content != null) { return content; // pattern content found, exit } String uri = XLinkSupport.getXLinkHref(patternElement); if (uri.length() == 0) { return null; // no xlink:href found, exit } // check if there is circular dependencies SVGOMDocument doc = (SVGOMDocument)patternElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); if (!purl.complete()) throw new BridgeException(ctx, patternElement, ERR_URI_MALFORMED, new Object[] {uri}); if (contains(refs, purl)) { throw new BridgeException(ctx, patternElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(purl); patternElement = ctx.getReferencedElement(patternElement, uri); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { ImageNode imageNode = (ImageNode)super.createGraphicsNode(ctx, e); if (imageNode == null) { return null; } associateSVGContext(ctx, e, imageNode); hitCheckChildren = false; GraphicsNode node = buildImageGraphicsNode(ctx,e); if (node == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } imageNode.setImage(node); imageNode.setHitCheckChildren(hitCheckChildren); // 'image-rendering' and 'color-rendering' RenderingHints hints = null; hints = CSSUtilities.convertImageRendering(e, hints); hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) imageNode.setRenderingHints(hints); return imageNode; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode buildImageGraphicsNode (BridgeContext ctx, Element e){ SVGImageElement ie = (SVGImageElement) e; // 'xlink:href' attribute - required String uriStr = ie.getHref().getAnimVal(); if (uriStr.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } if (uriStr.indexOf('#') != -1) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {"xlink:href", uriStr}); } // Build the URL. String baseURI = AbstractNode.getBaseURI(e); ParsedURL purl; if (baseURI == null) { purl = new ParsedURL(uriStr); } else { purl = new ParsedURL(baseURI, uriStr); } return createImageGraphicsNode(ctx, e, purl); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl) { Rectangle2D bounds = getImageBounds(ctx, e); if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) { ShapeNode sn = new ShapeNode(); sn.setShape(bounds); return sn; } SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); String docURL = svgDoc.getURL(); ParsedURL pDocURL = null; if (docURL != null) pDocURL = new ParsedURL(docURL); UserAgent userAgent = ctx.getUserAgent(); try { userAgent.checkLoadExternalResource(purl, pDocURL); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } DocumentLoader loader = ctx.getDocumentLoader(); ImageTagRegistry reg = ImageTagRegistry.getRegistry(); ICCColorSpaceExt colorspace = extractColorSpace(e, ctx); { /** * Before we open the URL we see if we have the * URL already cached and parsed */ try { /* Check the document loader cache */ Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } } catch (BridgeException ex) { throw ex; } catch (Exception ex) { /* Nothing to do */ } /* Check the ImageTagRegistry Cache */ Filter img = reg.checkCache(purl, colorspace); if (img != null) { return createRasterImageNode(ctx, e, img, purl); } } /* The Protected Stream ensures that the stream doesn't * get closed unless we want it to. It is also based on * a Buffered Reader so in general we can mark the start * and reset rather than reopening the stream. Finally * it hides the mark/reset methods so only we get to * use them. */ ProtectedStream reference = null; try { reference = openStream(e, purl); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); } { /** * First see if we can id the file as a Raster via magic * number. This is probably the fastest mechanism. * We tell the registry what the source purl is but we * tell it not to open that url. */ Filter img = reg.readURL(reference, purl, colorspace, false, false); if (img != null) { try { reference.tie(); } catch (IOException ioe) { // This would be from a close, Let it slide... } // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } try { // Reset the stream for next try. reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { /** * Next see if it's an XML document. */ Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } catch (BridgeException ex) { reference.release(); throw ex; } catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); } catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; } catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); } try { reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { // Finally try to load the image as a raster image (JPG or // PNG) allowing the registry to open the url (so the // JDK readers can be checked). Filter img = reg.readURL(reference, purl, colorspace, true, true); if (img != null) { // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } finally { reference.release(); } return null; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { String ns = alav.getNamespaceURI(); String ln = alav.getLocalName(); if (ns == null) { if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)) { updateImageBounds(); return; } else if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) { SVGImageElement ie = (SVGImageElement) e; ImageNode imageNode = (ImageNode) node; AbstractSVGAnimatedLength _attr; if (ln.charAt(0) == 'w') { _attr = (AbstractSVGAnimatedLength) ie.getWidth(); } else { _attr = (AbstractSVGAnimatedLength) ie.getHeight(); } float val = _attr.getCheckedValue(); if (val == 0 || imageNode.getImage() instanceof ShapeNode) { rebuildImageNode(); } else { updateImageBounds(); } return; } else if (ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { updateImageBounds(); return; } } else if (ns.equals(XLINK_NAMESPACE_URI) && ln.equals(XLINK_HREF_ATTRIBUTE)) { rebuildImageNode(); return; } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected void rebuildImageNode() { // Reference copy of the imgDocument if ((imgDocument != null) && (listener != null)) { NodeEventTarget tgt = (NodeEventTarget)imgDocument.getRootElement(); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP, listener, false); listener = null; } if (imgDocument != null) { SVGSVGElement svgElement = imgDocument.getRootElement(); disposeTree(svgElement); } imgDocument = null; subCtx = null; //update of the reference of the image. GraphicsNode inode = buildImageGraphicsNode(ctx,e); ImageNode imgNode = (ImageNode)node; imgNode.setImage(inode); if (inode == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected static void initializeViewport(BridgeContext ctx, Element e, GraphicsNode node, float[] vb, Rectangle2D bounds) { float x = (float)bounds.getX(); float y = (float)bounds.getY(); float w = (float)bounds.getWidth(); float h = (float)bounds.getHeight(); try { SVGImageElement ie = (SVGImageElement) e; SVGOMAnimatedPreserveAspectRatio _par = (SVGOMAnimatedPreserveAspectRatio) ie.getPreserveAspectRatio(); _par.check(); AffineTransform at = ViewBox.getPreserveAspectRatioTransform (e, vb, w, h, _par, ctx); at.preConcatenate(AffineTransform.getTranslateInstance(x, y)); node.setTransform(at); // 'overflow' and 'clip' Shape clip = null; if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { // clip:auto clip = new Rectangle2D.Float(x, y, w, h); } else { // clip:rect(<x> <y> <w> <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { at = at.createInverse(); // clip in user space Filter filter = node.getGraphicsNodeRable(true); clip = at.createTransformedShape(clip); node.setClip(new ClipRable8Bit(filter, clip)); } catch (java.awt.geom.NoninvertibleTransformException ex) {} } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected static Rectangle2D getImageBounds(BridgeContext ctx, Element element) { try { SVGImageElement ie = (SVGImageElement) element; // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) ie.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) ie.getY(); float y = _y.getCheckedValue(); // 'width' attribute - required AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) ie.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - required AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) ie.getHeight(); float h = _height.getCheckedValue(); return new Rectangle2D.Float(x, y, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static Filter getIn2(Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Map filterMap, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_IN2_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object [] {SVG_IN2_ATTRIBUTE}); } return getFilterSource(filterElement, s, filteredElement, filteredNode, filterMap, ctx); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static int convertInteger(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } } }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static float convertNumber(Element filterElement, String attrName, float defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); } } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgLengthToObjectBoundingBox(String s, String attr, short d, Context ctx) { float v = svgToObjectBoundingBox(s, attr, d, ctx); if (v < 0) { throw new BridgeException(getBridgeContext(ctx), ctx.getElement(), ErrorConstants.ERR_LENGTH_NEGATIVE, new Object[] {attr, s}); } return v; }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToObjectBoundingBox(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgLengthToUserSpace(String s, String attr, short d, Context ctx) { float v = svgToUserSpace(s, attr, d, ctx); if (v < 0) { throw new BridgeException(getBridgeContext(ctx), ctx.getElement(), ErrorConstants.ERR_LENGTH_NEGATIVE, new Object[] {attr, s}); } else { return v; } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgToUserSpace(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToUserSpace(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); } }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
public Marker createMarker(BridgeContext ctx, Element markerElement, Element paintedElement) { GVTBuilder builder = ctx.getGVTBuilder(); CompositeGraphicsNode markerContentNode = new CompositeGraphicsNode(); // build the GVT tree that represents the marker boolean hasChildren = false; for(Node n = markerElement.getFirstChild(); n != null; n = n.getNextSibling()) { // check if the node is a valid Element if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } Element child = (Element)n; GraphicsNode markerNode = builder.build(ctx, child) ; // check if a GVT node has been created if (markerNode == null) { continue; // skip element as <marker> can contain <defs>... } hasChildren = true; markerContentNode.getChildren().add(markerNode); } if (!hasChildren) { return null; // no marker content defined } String s; UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, paintedElement); // 'markerWidth' attribute - default is 3 float markerWidth = 3; s = markerElement.getAttributeNS(null, SVG_MARKER_WIDTH_ATTRIBUTE); if (s.length() != 0) { markerWidth = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_MARKER_WIDTH_ATTRIBUTE, uctx); } if (markerWidth == 0) { // A value of zero disables rendering of the element. return null; } // 'markerHeight' attribute - default is 3 float markerHeight = 3; s = markerElement.getAttributeNS(null, SVG_MARKER_HEIGHT_ATTRIBUTE); if (s.length() != 0) { markerHeight = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_MARKER_HEIGHT_ATTRIBUTE, uctx); } if (markerHeight == 0) { // A value of zero disables rendering of the element. return null; } // 'orient' attribute - default is '0' double orient; s = markerElement.getAttributeNS(null, SVG_ORIENT_ATTRIBUTE); if (s.length() == 0) { orient = 0; } else if (SVG_AUTO_VALUE.equals(s)) { orient = Double.NaN; } else { try { orient = SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); } } // 'stroke-width' property Value val = CSSUtilities.getComputedStyle (paintedElement, SVGCSSEngine.STROKE_WIDTH_INDEX); float strokeWidth = val.getFloatValue(); // 'markerUnits' attribute - default is 'strokeWidth' short unitsType; s = markerElement.getAttributeNS(null, SVG_MARKER_UNITS_ATTRIBUTE); if (s.length() == 0) { unitsType = SVGUtilities.STROKE_WIDTH; } else { unitsType = SVGUtilities.parseMarkerCoordinateSystem (markerElement, SVG_MARKER_UNITS_ATTRIBUTE, s, ctx); } // // // // compute an additional transform for 'strokeWidth' coordinate system AffineTransform markerTxf; if (unitsType == SVGUtilities.STROKE_WIDTH) { markerTxf = new AffineTransform(); markerTxf.scale(strokeWidth, strokeWidth); } else { markerTxf = new AffineTransform(); } // 'viewBox' and 'preserveAspectRatio' attributes // viewBox -> viewport(0, 0, markerWidth, markerHeight) AffineTransform preserveAspectRatioTransform = ViewBox.getPreserveAspectRatioTransform(markerElement, markerWidth, markerHeight, ctx); if (preserveAspectRatioTransform == null) { // disable the rendering of the element return null; } else { markerTxf.concatenate(preserveAspectRatioTransform); } // now we can set the transform to the 'markerContentNode' markerContentNode.setTransform(markerTxf); // 'overflow' property if (CSSUtilities.convertOverflow(markerElement)) { // overflow:hidden Rectangle2D markerClip; float [] offsets = CSSUtilities.convertClip(markerElement); if (offsets == null) { // clip:auto markerClip = new Rectangle2D.Float(0, 0, strokeWidth * markerWidth, strokeWidth * markerHeight); } else { // clip:rect(<x>, <y>, <w>, <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left markerClip = new Rectangle2D.Float (offsets[3], offsets[0], strokeWidth * markerWidth - offsets[1] - offsets[3], strokeWidth * markerHeight - offsets[2] - offsets[0]); } CompositeGraphicsNode comp = new CompositeGraphicsNode(); comp.getChildren().add(markerContentNode); Filter clipSrc = comp.getGraphicsNodeRable(true); comp.setClip(new ClipRable8Bit(clipSrc, markerClip)); markerContentNode = comp; } // 'refX' attribute - default is 0 float refX = 0; s = markerElement.getAttributeNS(null, SVG_REF_X_ATTRIBUTE); if (s.length() != 0) { refX = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_REF_X_ATTRIBUTE, uctx); } // 'refY' attribute - default is 0 float refY = 0; s = markerElement.getAttributeNS(null, SVG_REF_Y_ATTRIBUTE); if (s.length() != 0) { refY = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_REF_Y_ATTRIBUTE, uctx); } // TK: Warning at this time, refX and refY are relative to the // paintedElement's coordinate system. We need to move the // reference point to the marker's coordinate system // Watch out: the reference point is defined a little weirdly in the // SVG spec., but the bottom line is that the marker content should // not be translated. Rather, the reference point should be computed // in viewport space (this is what the following transform // does) and used when placing the marker. // float[] ref = {refX, refY}; markerTxf.transform(ref, 0, ref, 0, 1); Marker marker = new Marker(markerContentNode, new Point2D.Float(ref[0], ref[1]), orient); return marker; }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected int parseCalcMode() { // If the attribute being animated has only non-additive values, take // the animation as having calcMode="discrete". if (animationType == AnimationEngine.ANIM_TYPE_CSS && !targetElement.isPropertyAdditive(attributeLocalName) || animationType == AnimationEngine.ANIM_TYPE_XML && !targetElement.isAttributeAdditive(attributeNamespaceURI, attributeLocalName)) { return SimpleAnimation.CALC_MODE_DISCRETE; } String calcModeString = element.getAttributeNS(null, SVG_CALC_MODE_ATTRIBUTE); if (calcModeString.length() == 0) { return getDefaultCalcMode(); } else if (calcModeString.equals(SMILConstants.SMIL_LINEAR_VALUE)) { return SimpleAnimation.CALC_MODE_LINEAR; } else if (calcModeString.equals(SMILConstants.SMIL_DISCRETE_VALUE)) { return SimpleAnimation.CALC_MODE_DISCRETE; } else if (calcModeString.equals(SMILConstants.SMIL_PACED_VALUE)) { return SimpleAnimation.CALC_MODE_PACED; } else if (calcModeString.equals(SMILConstants.SMIL_SPLINE_VALUE)) { return SimpleAnimation.CALC_MODE_SPLINE; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_CALC_MODE_ATTRIBUTE, calcModeString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected boolean parseAdditive() { String additiveString = element.getAttributeNS(null, SVG_ADDITIVE_ATTRIBUTE); if (additiveString.length() == 0 || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) { return false; } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected boolean parseAccumulate() { String accumulateString = element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE); if (accumulateString.length() == 0 || accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) { return false; } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected AnimatableValue[] parseValues() { boolean isCSS = animationType == AnimationEngine.ANIM_TYPE_CSS; String valuesString = element.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); int len = valuesString.length(); if (len == 0) { return null; } ArrayList values = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (valuesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = valuesString.charAt(i); while (c != ';') { i++; if (i == len) { break; } c = valuesString.charAt(i); } } end = i++; AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, isCSS, valuesString.substring(start, end)); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, valuesString }); } values.add(val); } AnimatableValue[] ret = new AnimatableValue[values.size()]; return (AnimatableValue[]) values.toArray(ret); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected float[] parseKeyTimes() { String keyTimesString = element.getAttributeNS(null, SVG_KEY_TIMES_ATTRIBUTE); int len = keyTimesString.length(); if (len == 0) { return null; } ArrayList keyTimes = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (keyTimesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keyTimesString.charAt(i); while (c != ' ' && c != ';') { i++; if (i == len) { break; } c = keyTimesString.charAt(i); } } end = i++; try { float keyTime = Float.parseFloat(keyTimesString.substring(start, end)); keyTimes.add(new Float(keyTime)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); } } len = keyTimes.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keyTimes.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected float[] parseKeySplines() { String keySplinesString = element.getAttributeNS(null, SVG_KEY_SPLINES_ATTRIBUTE); int len = keySplinesString.length(); if (len == 0) { return null; } List keySplines = new ArrayList(7); int count = 0, i = 0, start = 0, end; char c; outer: while (i < len) { while (keySplinesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keySplinesString.charAt(i); while (c != ' ' && c != ',' && c != ';') { i++; if (i == len) { break; } c = keySplinesString.charAt(i); } end = i++; if (c == ' ') { do { if (i == len) { break; } c = keySplinesString.charAt(i++); } while (c == ' '); if (c != ';' && c != ',') { i--; } } if (c == ';') { if (count == 3) { count = 0; } else { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); } } else { count++; } } else { end = i++; } try { float keySplineValue = Float.parseFloat(keySplinesString.substring(start, end)); keySplines.add(new Float(keySplineValue)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); } } len = keySplines.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keySplines.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Node getReferencedNode(Element e, String uri) { try { SVGDocument document = (SVGDocument)e.getOwnerDocument(); URIResolver ur = createURIResolver(document, documentLoader); Node ref = ur.getNode(uri, e); if (ref == null) { throw new BridgeException(this, e, ERR_URI_BAD_TARGET, new Object[] {uri}); } else { SVGOMDocument refDoc = (SVGOMDocument) (ref.getNodeType() == Node.DOCUMENT_NODE ? ref : ref.getOwnerDocument()); // This is new rather than attaching this BridgeContext // with the new document we now create a whole new // BridgeContext to go with the new document. // This means that the new document has it's own // world of stuff and it should avoid memory leaks // since the new document isn't 'tied into' this // bridge context. if (refDoc != document) { createSubBridgeContext(refDoc); } return ref; } } catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); } catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); } catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); } catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); } }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Element getReferencedElement(Element e, String uri) { Node ref = getReferencedNode(e, uri); if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) { throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT, new Object[] {uri}); } return (Element) ref; }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMCircleElement ce = (SVGOMCircleElement) e; // 'cx' attribute - default is 0 AbstractSVGAnimatedLength _cx = (AbstractSVGAnimatedLength) ce.getCx(); float cx = _cx.getCheckedValue(); // 'cy' attribute - default is 0 AbstractSVGAnimatedLength _cy = (AbstractSVGAnimatedLength) ce.getCy(); float cy = _cy.getCheckedValue(); // 'r' attribute - required AbstractSVGAnimatedLength _r = (AbstractSVGAnimatedLength) ce.getR(); float r = _r.getCheckedValue(); float x = cx - r; float y = cy - r; float w = r * 2; shapeNode.setShape(new Ellipse2D.Float(x, y, w, w)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeCompositeElementBridge.java
protected static CompositeRule convertOperator(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_OPERATOR_ATTRIBUTE); if (s.length() == 0) { return CompositeRule.OVER; // default is over } if (SVG_ATOP_VALUE.equals(s)) { return CompositeRule.ATOP; } if (SVG_IN_VALUE.equals(s)) { return CompositeRule.IN; } if (SVG_OVER_VALUE.equals(s)) { return CompositeRule.OVER; } if (SVG_OUT_VALUE.equals(s)) { return CompositeRule.OUT; } if (SVG_XOR_VALUE.equals(s)) { return CompositeRule.XOR; } if (SVG_ARITHMETIC_VALUE.equals(s)) { float k1 = convertNumber(filterElement, SVG_K1_ATTRIBUTE, 0, ctx); float k2 = convertNumber(filterElement, SVG_K2_ATTRIBUTE, 0, ctx); float k3 = convertNumber(filterElement, SVG_K3_ATTRIBUTE, 0, ctx); float k4 = convertNumber(filterElement, SVG_K4_ATTRIBUTE, 0, ctx); return CompositeRule.ARITHMETIC(k1, k2, k3, k4); } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OPERATOR_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
protected static float convertSpecularExponent(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_SPECULAR_EXPONENT_ATTRIBUTE); if (s.length() == 0) { return 1; // default is 1 } else { try { float v = SVGUtilities.convertSVGNumber(s); if (v < 1 || v > 128) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s}); } return v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); } } }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
public CompositeGraphicsNode buildCompositeGraphicsNode (BridgeContext ctx, Element e, CompositeGraphicsNode gn) { // get the referenced element SVGOMUseElement ue = (SVGOMUseElement) e; String uri = ue.getHref().getAnimVal(); if (uri.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } Element refElement = ctx.getReferencedElement(e, uri); SVGOMDocument document, refDocument; document = (SVGOMDocument)e.getOwnerDocument(); refDocument = (SVGOMDocument)refElement.getOwnerDocument(); boolean isLocal = (refDocument == document); BridgeContext theCtx = ctx; subCtx = null; if (!isLocal) { subCtx = (BridgeContext)refDocument.getCSSEngine().getCSSContext(); theCtx = subCtx; } // import or clone the referenced element in current document Element localRefElement; localRefElement = (Element)document.importNode(refElement, true, true); if (SVG_SYMBOL_TAG.equals(localRefElement.getLocalName())) { // The referenced 'symbol' and its contents are deep-cloned into // the generated tree, with the exception that the 'symbol' is // replaced by an 'svg'. Element svgElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_SVG_TAG); // move the attributes from <symbol> to the <svg> element NamedNodeMap attrs = localRefElement.getAttributes(); int len = attrs.getLength(); for (int i = 0; i < len; i++) { Attr attr = (Attr)attrs.item(i); svgElement.setAttributeNS(attr.getNamespaceURI(), attr.getName(), attr.getValue()); } // move the children from <symbol> to the <svg> element for (Node n = localRefElement.getFirstChild(); n != null; n = localRefElement.getFirstChild()) { svgElement.appendChild(n); } localRefElement = svgElement; } if (SVG_SVG_TAG.equals(localRefElement.getLocalName())) { // The referenced 'svg' and its contents are deep-cloned into the // generated tree. If attributes width and/or height are provided // on the 'use' element, then these values will override the // corresponding attributes on the 'svg' in the generated tree. try { SVGOMAnimatedLength al = (SVGOMAnimatedLength) ue.getWidth(); if (al.isSpecified()) { localRefElement.setAttributeNS (null, SVG_WIDTH_ATTRIBUTE, al.getAnimVal().getValueAsString()); } al = (SVGOMAnimatedLength) ue.getHeight(); if (al.isSpecified()) { localRefElement.setAttributeNS (null, SVG_HEIGHT_ATTRIBUTE, al.getAnimVal().getValueAsString()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } } // attach the referenced element to the current document SVGOMUseShadowRoot root; root = new SVGOMUseShadowRoot(document, e, isLocal); root.appendChild(localRefElement); if (gn == null) { gn = new CompositeGraphicsNode(); associateSVGContext(ctx, e, node); } else { int s = gn.size(); for (int i=0; i<s; i++) gn.remove(0); } Node oldRoot = ue.getCSSFirstChild(); if (oldRoot != null) { disposeTree(oldRoot); } ue.setUseShadowTree(root); Element g = localRefElement; // compute URIs and style sheets for the used element CSSUtilities.computeStyleAndURIs(refElement, localRefElement, uri); GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode refNode = builder.build(ctx, g); /////////////////////////////////////////////////////////////////////// gn.getChildren().add(refNode); gn.setTransform(computeTransform((SVGTransformable) e, ctx)); // set an affine transform to take into account the (x, y) // coordinates of the <use> element // 'visibility' gn.setVisible(CSSUtilities.convertVisibility(e)); RenderingHints hints = null; hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) gn.setRenderingHints(hints); // 'enable-background' Rectangle2D r = CSSUtilities.convertEnableBackground(e); if (r != null) gn.setBackgroundEnable(r); if (l != null) { // Remove event listeners NodeEventTarget target = l.target; target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true); l = null; } /////////////////////////////////////////////////////////////////////// // Handle mutations on content referenced in the same file if // we are in a dynamic context. if (isLocal && ctx.isDynamic()) { l = new ReferencedElementMutationListener(); NodeEventTarget target = (NodeEventTarget)refElement; l.target = target; target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true); } return gn; }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
protected AffineTransform computeTransform(SVGTransformable e, BridgeContext ctx) { AffineTransform at = super.computeTransform(e, ctx); SVGUseElement ue = (SVGUseElement) e; try { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) ue.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) ue.getY(); float y = _y.getCheckedValue(); AffineTransform xy = AffineTransform.getTranslateInstance(x, y); xy.preConcatenate(at); return xy; } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { String ns = alav.getNamespaceURI(); String ln = alav.getLocalName(); if (ns == null) { if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_TRANSFORM_ATTRIBUTE)) { node.setTransform (computeTransform((SVGTransformable) e, ctx)); handleGeometryChanged(); } else if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) buildCompositeGraphicsNode (ctx, e, (CompositeGraphicsNode)node); } else { if (ns.equals(XLINK_NAMESPACE_URI) && ln.equals(XLINK_HREF_ATTRIBUTE)) buildCompositeGraphicsNode (ctx, e, (CompositeGraphicsNode)node); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public AnimatableValue parseAnimatableValue(Element animElt, AnimationTarget target, String ns, String ln, boolean isCSS, String s) { SVGOMElement elt = (SVGOMElement) target.getElement(); int type; if (isCSS) { type = elt.getPropertyType(ln); } else { type = elt.getAttributeType(ns, ln); } Factory factory = factories[type]; if (factory == null) { String an = ns == null ? ln : '{' + ns + '}' + ln; throw new BridgeException (ctx, animElt, "attribute.not.animatable", new Object[] { target.getElement().getNodeName(), an }); } return factories[type].createValue(target, ns, ln, isCSS, s); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public AnimatableValue getUnderlyingCSSValue(Element animElt, AnimationTarget target, String pn) { ValueManager[] vms = cssEngine.getValueManagers(); int idx = cssEngine.getPropertyIndex(pn); if (idx != -1) { int type = vms[idx].getPropertyType(); Factory factory = factories[type]; if (factory == null) { throw new BridgeException (ctx, animElt, "attribute.not.animatable", new Object[] { target.getElement().getNodeName(), pn }); } SVGStylableElement e = (SVGStylableElement) target.getElement(); CSSStyleDeclaration over = e.getOverrideStyle(); String oldValue = over.getPropertyValue(pn); if (oldValue != null) { over.removeProperty(pn); } Value v = cssEngine.getComputedStyle(e, null, idx); if (oldValue != null && !oldValue.equals("")) { over.setProperty(pn, oldValue, null); } return factories[type].createValue(target, pn, v); } // XXX Doesn't handle shorthands. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void start(long documentStartTime) { if (started) { return; } started = true; try { try { Calendar cal = Calendar.getInstance(); cal.setTime(new Date(documentStartTime)); timedDocumentRoot.resetDocument(cal); Object[] bridges = initialBridges.toArray(); initialBridges = null; for (int i = 0; i < bridges.length; i++) { SVGAnimationElementBridge bridge = (SVGAnimationElementBridge) bridges[i]; bridge.initializeAnimation(); } for (int i = 0; i < bridges.length; i++) { SVGAnimationElementBridge bridge = (SVGAnimationElementBridge) bridges[i]; bridge.initializeTimedElement(); } // tick(0, false); // animationThread = new AnimationThread(); // animationThread.start(); UpdateManager um = ctx.getUpdateManager(); if (um != null) { RunnableQueue q = um.getUpdateRunnableQueue(); animationTickRunnable = new AnimationTickRunnable(q, this); q.setIdleRunnable(animationTickRunnable); if (initialStartTime != 0) { setCurrentTime(initialStartTime); } } } catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); } } catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void run() { SVGAnimationEngine eng = getAnimationEngine(); synchronized (eng) { try { try { eng.tick(t, false); } catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); } } catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void run() { SVGAnimationEngine eng = getAnimationEngine(); synchronized (eng) { int animationLimitingMode = eng.animationLimitingMode; float animationLimitingAmount = eng.animationLimitingAmount; try { try { long before = System.currentTimeMillis(); time.setTime(new Date(before)); float t = eng.timedDocumentRoot.convertWallclockTime(time); // if (Math.floor(t) > second) { // second = Math.floor(t); // System.err.println("fps: " + frames); // frames = 0; // } float t2 = eng.tick(t, false); long after = System.currentTimeMillis(); long dur = after - before; if (dur == 0) { dur = 1; } sumTime -= times[timeIndex]; sumTime += dur; times[timeIndex] = dur; timeIndex = (timeIndex + 1) % NUM_TIMES; if (t2 == Float.POSITIVE_INFINITY) { waitTime = Long.MAX_VALUE; } else { waitTime = before + (long) (t2 * 1000) - 1000; if (waitTime < after) { waitTime = after; } if (animationLimitingMode != 0) { float ave = (float) sumTime / NUM_TIMES; float delay; if (animationLimitingMode == 1) { // %cpu delay = ave / animationLimitingAmount - ave; } else { // fps delay = 1000f / animationLimitingAmount - ave; } long newWaitTime = after + (long) delay; if (newWaitTime > waitTime) { waitTime = newWaitTime; } } } // frames++; } catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); } exceptionCount = 0; } catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } } if (animationLimitingMode == 0) { // so we don't steal too much time from the Swing thread try { Thread.sleep(1); } catch (InterruptedException ie) { } } } }
// in sources/org/apache/batik/bridge/SVGFeImageElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'xlink:href' attribute String uriStr = XLinkSupport.getXLinkHref(filterElement); if (uriStr.length() == 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } // // According the the SVG specification, feImage behaves like // <image> if it references an SVG document or a raster image // and it behaves like a <use> if it references a document // fragment. // // To provide this behavior, depending on whether the uri // contains a fragment identifier, we create either an // <image> or a <use> element and request the corresponding // bridges to build the corresponding GraphicsNode for us. // // Then, we take care of the possible transformation needed // from objectBoundingBox space to user space. // Document document = filterElement.getOwnerDocument(); boolean isUse = uriStr.indexOf('#') != -1; Element contentElement = null; if (isUse) { contentElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_USE_TAG); } else { contentElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_IMAGE_TAG); } contentElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, uriStr); Element proxyElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG); proxyElement.appendChild(contentElement); // feImage's default region is that of the filter chain. Rectangle2D defaultRegion = filterRegion; Element filterDefElement = (Element)(filterElement.getParentNode()); Rectangle2D primitiveRegion = SVGUtilities.getBaseFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, ctx); // System.err.println(">>>>>>>> primitiveRegion : " + primitiveRegion); contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf( primitiveRegion.getX() ) ); contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf( primitiveRegion.getY() ) ); contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( primitiveRegion.getWidth() ) ); contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( primitiveRegion.getHeight() ) ); GraphicsNode node = ctx.getGVTBuilder().build(ctx, proxyElement); Filter filter = node.getGraphicsNodeRable(true); // 'primitiveUnits' attribute - default is userSpaceOnUse short coordSystemType; String s = SVGUtilities.getChainableAttributeNS (filterDefElement, null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { coordSystemType = SVGUtilities.USER_SPACE_ON_USE; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx); } // Compute the transform from object bounding box to user // space if needed. AffineTransform at = new AffineTransform(); if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX) { at = SVGUtilities.toObjectBBox(at, filteredNode); } filter = new AffineRable8Bit(filter, at); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(filter, filterElement); // get filter primitive chain region Rectangle2D primitiveRegionUserSpace = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); filter = new PadRable8Bit(filter, primitiveRegionUserSpace, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/TextUtilities.java
public static ArrayList svgRotateArrayToFloats(Element element, String attrName, String valueStr, BridgeContext ctx) { StringTokenizer st = new StringTokenizer(valueStr, ", ", false); ArrayList values = new ArrayList(); String s; while (st.hasMoreTokens()) { try { s = st.nextToken(); values.add (new Float(Math.toRadians (SVGUtilities.convertSVGNumber(s)))); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); } } return values; }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMEllipseElement ee = (SVGOMEllipseElement) e; // 'cx' attribute - default is 0 AbstractSVGAnimatedLength _cx = (AbstractSVGAnimatedLength) ee.getCx(); float cx = _cx.getCheckedValue(); // 'cy' attribute - default is 0 AbstractSVGAnimatedLength _cy = (AbstractSVGAnimatedLength) ee.getCy(); float cy = _cy.getCheckedValue(); // 'rx' attribute - required AbstractSVGAnimatedLength _rx = (AbstractSVGAnimatedLength) ee.getRx(); float rx = _rx.getCheckedValue(); // 'ry' attribute - required AbstractSVGAnimatedLength _ry = (AbstractSVGAnimatedLength) ee.getRy(); float ry = _ry.getCheckedValue(); shapeNode.setShape(new Ellipse2D.Float(cx - rx, cy - ry, rx * 2, ry * 2)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'stdDeviation' attribute - default is [0, 0] float[] stdDeviationXY = convertStdDeviation(filterElement, ctx); if (stdDeviationXY[0] < 0 || stdDeviationXY[1] < 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, String.valueOf( stdDeviationXY[ 0 ] ) + stdDeviationXY[1]}); } // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // Default region is the size of in (if in is SourceGraphic or // SourceAlpha it will already include a pad/crop to the // proper filter region size). Rectangle2D defaultRegion = in.getBounds2D(); Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); // Take the filter primitive region into account, we need to // pad/crop the input and output. PadRable pad = new PadRable8Bit(in, primitiveRegion, PadMode.ZERO_PAD); // build filter Filter blur = new GaussianBlurRable8Bit (pad, stdDeviationXY[0], stdDeviationXY[1]); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(blur, filterElement); PadRable filter = new PadRable8Bit(blur, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
protected static float[] convertStdDeviation(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_STD_DEVIATION_ATTRIBUTE); if (s.length() == 0) { return new float[] {0, 0}; } float [] stdDevs = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { stdDevs[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { stdDevs[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { stdDevs[1] = stdDevs[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s}); } return stdDevs; }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Marker convertMarker(Element e, Value v, BridgeContext ctx) { if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { return null; // 'none' } else { String uri = v.getStringValue(); Element markerElement = ctx.getReferencedElement(e, uri); Bridge bridge = ctx.getBridge(markerElement); if (bridge == null || !(bridge instanceof MarkerBridge)) { throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Paint convertURIPaint(Element paintedElement, GraphicsNode paintedNode, Value paintDef, float opacity, BridgeContext ctx) { String uri = paintDef.getStringValue(); Element paintElement = ctx.getReferencedElement(paintedElement, uri); Bridge bridge = ctx.getBridge(paintElement); if (bridge == null || !(bridge instanceof PaintBridge)) { throw new BridgeException (ctx, paintedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((PaintBridge)bridge).createPaint(ctx, paintElement, paintedElement, paintedNode, opacity); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMLineElement le = (SVGOMLineElement) e; // 'x1' attribute - default is 0 AbstractSVGAnimatedLength _x1 = (AbstractSVGAnimatedLength) le.getX1(); float x1 = _x1.getCheckedValue(); // 'y1' attribute - default is 0 AbstractSVGAnimatedLength _y1 = (AbstractSVGAnimatedLength) le.getY1(); float y1 = _y1.getCheckedValue(); // 'x2' attribute - default is 0 AbstractSVGAnimatedLength _x2 = (AbstractSVGAnimatedLength) le.getX2(); float x2 = _x2.getCheckedValue(); // 'y2' attribute - default is 0 AbstractSVGAnimatedLength _y2 = (AbstractSVGAnimatedLength) le.getY2(); float y2 = _y2.getCheckedValue(); shapeNode.setShape(new Line2D.Float(x1, y1, x2, y2)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static String getChainableAttributeNS(Element element, String namespaceURI, String attrName, BridgeContext ctx) { DocumentLoader loader = ctx.getDocumentLoader(); Element e = element; List refs = new LinkedList(); for (;;) { String v = e.getAttributeNS(namespaceURI, attrName); if (v.length() > 0) { // exit if attribute defined return v; } String uriStr = XLinkSupport.getXLinkHref(e); if (uriStr.length() == 0) { // exit if no more xlink:href return ""; } String baseURI = ((AbstractNode) e).getBaseURI(); ParsedURL purl = new ParsedURL(baseURI, uriStr); Iterator iter = refs.iterator(); while (iter.hasNext()) { if (purl.equals(iter.next())) throw new BridgeException (ctx, e, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uriStr}); } try { SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); URIResolver resolver = ctx.createURIResolver(svgDoc, loader); e = resolver.getElement(purl.toString(), e); refs.add(purl); } catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); } catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); } } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Rectangle2D convertPatternRegion(Element patternElement, Element paintedElement, GraphicsNode paintedNode, BridgeContext ctx) { // 'x' attribute - default is 0% String xStr = getChainableAttributeNS (patternElement, null, SVG_X_ATTRIBUTE, ctx); if (xStr.length() == 0) { xStr = SVG_PATTERN_X_DEFAULT_VALUE; } // 'y' attribute - default is 0% String yStr = getChainableAttributeNS (patternElement, null, SVG_Y_ATTRIBUTE, ctx); if (yStr.length() == 0) { yStr = SVG_PATTERN_Y_DEFAULT_VALUE; } // 'width' attribute - required String wStr = getChainableAttributeNS (patternElement, null, SVG_WIDTH_ATTRIBUTE, ctx); if (wStr.length() == 0) { throw new BridgeException (ctx, patternElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_WIDTH_ATTRIBUTE}); } // 'height' attribute - required String hStr = getChainableAttributeNS (patternElement, null, SVG_HEIGHT_ATTRIBUTE, ctx); if (hStr.length() == 0) { throw new BridgeException (ctx, patternElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HEIGHT_ATTRIBUTE}); } // 'patternUnits' attribute - default is 'objectBoundingBox' short unitsType; String units = getChainableAttributeNS (patternElement, null, SVG_PATTERN_UNITS_ATTRIBUTE, ctx); if (units.length() == 0) { unitsType = OBJECT_BOUNDING_BOX; } else { unitsType = parseCoordinateSystem (patternElement, SVG_PATTERN_UNITS_ATTRIBUTE, units, ctx); } // resolve units in the (referenced) paintedElement's coordinate system UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, paintedElement); return convertRegion(xStr, yStr, wStr, hStr, unitsType, paintedNode, uctx); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float [] convertFilterRes(Element filterElement, BridgeContext ctx) { float [] filterRes = new float[2]; String s = getChainableAttributeNS (filterElement, null, SVG_FILTER_RES_ATTRIBUTE, ctx); Float [] vals = convertSVGNumberOptionalNumber (filterElement, SVG_FILTER_RES_ATTRIBUTE, s, ctx); if (filterRes[0] < 0 || filterRes[1] < 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } if (vals[0] == null) filterRes[0] = -1; else { filterRes[0] = vals[0].floatValue(); if (filterRes[0] < 0) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } if (vals[1] == null) filterRes[1] = filterRes[0]; else { filterRes[1] = vals[1].floatValue(); if (filterRes[1] < 0) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } return filterRes; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Float[] convertSVGNumberOptionalNumber(Element elem, String attrName, String attrValue, BridgeContext ctx) { Float[] ret = new Float[2]; if (attrValue.length() == 0) return ret; try { StringTokenizer tokens = new StringTokenizer(attrValue, " "); ret[0] = new Float(Float.parseFloat(tokens.nextToken())); if (tokens.hasMoreTokens()) { ret[1] = new Float(Float.parseFloat(tokens.nextToken())); } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, elem, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue}); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); } return ret; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static short parseCoordinateSystem(Element e, String attr, String coordinateSystem, BridgeContext ctx) { if (SVG_USER_SPACE_ON_USE_VALUE.equals(coordinateSystem)) { return USER_SPACE_ON_USE; } else if (SVG_OBJECT_BOUNDING_BOX_VALUE.equals(coordinateSystem)) { return OBJECT_BOUNDING_BOX; } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, coordinateSystem}); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static short parseMarkerCoordinateSystem(Element e, String attr, String coordinateSystem, BridgeContext ctx) { if (SVG_USER_SPACE_ON_USE_VALUE.equals(coordinateSystem)) { return USER_SPACE_ON_USE; } else if (SVG_STROKE_WIDTH_VALUE.equals(coordinateSystem)) { return STROKE_WIDTH; } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, coordinateSystem}); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static AffineTransform convertTransform(Element e, String attr, String transform, BridgeContext ctx) { try { return AWTTransformProducer.createAffineTransform(transform); } catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float convertSnapshotTime(Element e, BridgeContext ctx) { if (!e.hasAttributeNS(null, SVG_SNAPSHOT_TIME_ATTRIBUTE)) { return 0f; } String t = e.getAttributeNS(null, SVG_SNAPSHOT_TIME_ATTRIBUTE); if (t.equals(SVG_NONE_VALUE)) { return 0f; } class Handler implements ClockHandler { float time; public void clockValue(float t) { time = t; } } ClockParser p = new ClockParser(false); Handler h = new Handler(); p.setClockHandler(h); try { p.parse(t); } catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); } return h.time; }
// in sources/org/apache/batik/bridge/SVGAnimateTransformElementBridge.java
protected short parseType() { String typeString = element.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (typeString.equals("translate")) { return SVGTransform.SVG_TRANSFORM_TRANSLATE; } else if (typeString.equals("scale")) { return SVGTransform.SVG_TRANSFORM_SCALE; } else if (typeString.equals("rotate")) { return SVGTransform.SVG_TRANSFORM_ROTATE; } else if (typeString.equals("skewX")) { return SVGTransform.SVG_TRANSFORM_SKEWX; } else if (typeString.equals("skewY")) { return SVGTransform.SVG_TRANSFORM_SKEWY; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_TYPE_ATTRIBUTE, typeString }); }
// in sources/org/apache/batik/bridge/SVGAnimateTransformElementBridge.java
protected AnimatableValue[] parseValues(short type, AnimationTarget target) { String valuesString = element.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); int len = valuesString.length(); if (len == 0) { return null; } ArrayList values = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (valuesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i < len) { c = valuesString.charAt(i); while (c != ';') { i++; if (i == len) { break; } c = valuesString.charAt(i); } } end = i++; String valueString = valuesString.substring(start, end); AnimatableValue value = parseValue(valueString, type, target); if (value == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, valuesString }); } values.add(value); } AnimatableValue[] ret = new AnimatableValue[values.size()]; return (AnimatableValue[]) values.toArray(ret); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static float[] convertBaseFrenquency(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_BASE_FREQUENCY_ATTRIBUTE); if (s.length() == 0) { return new float[] {0.001f, 0.001f}; } float[] v = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { v[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { v[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { v[1] = v[0]; } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } if (v[0] < 0 || v[1] < 0) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } return v; }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static boolean convertStitchTiles(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_STITCH_TILES_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_STITCH_VALUE.equals(s)) { return true; } if (SVG_NO_STITCH_VALUE.equals(s)) { return false; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STITCH_TILES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static boolean convertType(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_FRACTAL_NOISE_VALUE.equals(s)) { return true; } if (SVG_TURBULENCE_VALUE.equals(s)) { return false; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Filter convertFilter(Element filteredElement, GraphicsNode filteredNode, BridgeContext ctx) { Value v = getComputedStyle(filteredElement, SVGCSSEngine.FILTER_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'filter:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element filter = ctx.getReferencedElement(filteredElement, uri); Bridge bridge = ctx.getBridge(filter); if (bridge == null || !(bridge instanceof FilterBridge)) { throw new BridgeException(ctx, filteredElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((FilterBridge)bridge).createFilter(ctx, filter, filteredElement, filteredNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static ClipRable convertClipPath(Element clippedElement, GraphicsNode clippedNode, BridgeContext ctx) { Value v = getComputedStyle(clippedElement, SVGCSSEngine.CLIP_PATH_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'clip-path:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element cp = ctx.getReferencedElement(clippedElement, uri); Bridge bridge = ctx.getBridge(cp); if (bridge == null || !(bridge instanceof ClipBridge)) { throw new BridgeException(ctx, clippedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((ClipBridge)bridge).createClip(ctx, cp, clippedElement, clippedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Mask convertMask(Element maskedElement, GraphicsNode maskedNode, BridgeContext ctx) { Value v = getComputedStyle(maskedElement, SVGCSSEngine.MASK_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'mask:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element m = ctx.getReferencedElement(maskedElement, uri); Bridge bridge = ctx.getBridge(m); if (bridge == null || !(bridge instanceof MaskBridge)) { throw new BridgeException(ctx, maskedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MaskBridge)bridge).createMask(ctx, m, maskedElement, maskedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
93
              
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
0
(Lib) IllegalArgumentException 187
              
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
public void handle(ParsedURL purl, JSVGViewerFrame svgViewerFrame) throws Exception { String uri = purl.toString(); TransformerFactory tFactory = TransformerFactory.newInstance(); // First, load the input XML document into a generic DOM tree DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document inDoc = db.parse(uri); // Now, look for <?xml-stylesheet ...?> processing instructions String xslStyleSheetURI = extractXSLProcessingInstruction(inDoc); if (xslStyleSheetURI == null) { // Assume that the input file is a literal result template xslStyleSheetURI = uri; } ParsedURL parsedXSLStyleSheetURI = new ParsedURL(uri, xslStyleSheetURI); Transformer transformer = tFactory.newTransformer (new StreamSource(parsedXSLStyleSheetURI.toString())); // Set the URIResolver to properly handle document() and xsl:include transformer.setURIResolver (new DocumentURIResolver(parsedXSLStyleSheetURI.toString())); // Now, apply the transformation to the input document. // // <!> Due to issues with namespaces, the transform creates the // result in a stream which is parsed. This is sub-optimal // but this was the only solution found to be able to // generate content in the proper namespaces. // // SVGOMDocument outDoc = // (SVGOMDocument)impl.createDocument(svgNS, "svg", null); // outDoc.setURLObject(new URL(uri)); // transformer.transform // (new DOMSource(inDoc), // new DOMResult(outDoc.getDocumentElement())); // StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); transformer.transform(new DOMSource(inDoc), result); sw.flush(); sw.close(); String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; try { outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); } // Patch the result tree to go under the root node // checkAndPatch(outDoc); svgViewerFrame.getJSVGCanvas().setSVGDocument(outDoc); svgViewerFrame.setSVGDocument(outDoc, uri, outDoc.getTitle()); }
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
protected void checkAndPatch(Document doc) { Element root = doc.getDocumentElement(); Node realRoot = root.getFirstChild(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; if (realRoot == null) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_PRODUCED_NO_CONTENT)); } if (realRoot.getNodeType() != Node.ELEMENT_NODE || !SVGConstants.SVG_SVG_TAG.equals(realRoot.getLocalName())) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_OUTPUT_NOT_SVG)); } if (!svgNS.equals(realRoot.getNamespaceURI())) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_OUTPUT_WRONG_NS)); } Node child = realRoot.getFirstChild(); while ( child != null ) { root.appendChild(child); child = realRoot.getFirstChild(); } NamedNodeMap attrs = realRoot.getAttributes(); int n = attrs.getLength(); for (int i=0; i<n; i++) { root.setAttributeNode((Attr)attrs.item(i)); } root.removeChild(realRoot); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public float getLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public float getBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/apps/svgbrowser/LocalHistory.java
public int getItemIndex( JMenuItem item ) { int ic = menu.getItemCount(); for ( int i = index; i < ic; i++ ) { if ( menu.getItem( i ) == item ) { return i - index; } } throw new IllegalArgumentException("MenuItem is not from my menu!" ); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String[] optionValues, SVGConverter c){ int nOptions = optionValues != null? optionValues.length: 0; if (nOptions != getOptionValuesLength()){ throw new IllegalArgumentException(); } safeHandleOption(optionValues, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ try{ handleOption(Float.parseFloat(optionValue), c); } catch(NumberFormatException e){ throw new IllegalArgumentException(); } }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, final SVGConverter c) { try { ClockParser p = new ClockParser(false); p.setClockHandler(new ClockHandler() { public void clockValue(float v) { handleOption(v, c); } }); p.parse(optionValue); } catch (ParseException e) { throw new IllegalArgumentException(); } }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ Rectangle2D r = parseRect(optionValue); if (r==null){ throw new IllegalArgumentException(); } handleOption(r, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ Color color = parseARGB(optionValue); if (color==null){ throw new IllegalArgumentException(); } handleOption(color, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ DestinationType dstType = (DestinationType)mimeTypeMap.get(optionValue); if (dstType == null){ throw new IllegalArgumentException(); } c.setDestinationType(dstType); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setWidth(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setHeight(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setMaxWidth(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setMaxHeight(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setPixelUnitToMillimeter ((2.54f/optionValue)*10); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0 || optionValue >= 1){ throw new IllegalArgumentException(); } c.setQuality(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if ((optionValue != 1) && (optionValue != 2) && (optionValue != 4) && (optionValue != 8)) throw new IllegalArgumentException(); c.setIndexed((int)optionValue); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setDestinationType(DestinationType destinationType) { if(destinationType == null){ throw new IllegalArgumentException(); } this.destinationType = destinationType; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setQuality(float quality) throws IllegalArgumentException { if(quality >= 1){ throw new IllegalArgumentException(); } this.quality = quality; }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } Object val = values.get(arguments[index++]); if (val == null) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE, val); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } Object val = values.get(arguments[index++]); if (val == null) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_NEWLINE, val); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_PUBLIC_ID, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_SYSTEM_ID, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_XML_DECLARATION, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_TABULATION_WIDTH, new Integer(arguments[index++])); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCUMENT_WIDTH, new Integer(arguments[index++])); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
void setImageCacher(ImageCacher imageCacher) { if (imageCacher == null){ throw new IllegalArgumentException(); } // Save current DOMTreeManager if any DOMTreeManager dtm = null; if (this.imageCacher != null){ dtm = this.imageCacher.getDOMTreeManager(); } this.imageCacher = imageCacher; if (dtm != null){ this.imageCacher.setDOMTreeManager(dtm); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
public void setDOMTreeManager(DOMTreeManager domTreeManager) { if (domTreeManager == null){ throw new IllegalArgumentException(); } this.domTreeManager = domTreeManager; }
// in sources/org/apache/batik/anim/timing/TimeContainer.java
public void addChild(TimedElement e) { if (e == this) { throw new IllegalArgumentException("recursive datastructure not allowed here!"); } children.add(e); e.parent = this; setRoot(e, root); root.fireElementAdded(e); root.currentIntervalWillUpdate(); }
// in sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java
public void transform(AffineTransform at) { if (at.getType() != AffineTransform.TYPE_IDENTITY) throw new IllegalArgumentException ("ExtendedGeneralPaths can not be transformed"); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // Can't modify the transform passed in... transform = new AffineTransform(transform); // incorporate the gradient transform transform.concatenate(gradientTransform); try{ return new RadialGradientPaintContext (cm, deviceBounds, userBounds, transform, hints, (float)center.getX(), (float)center.getY(), radius, (float)focus.getX(), (float)focus.getY(), fractions, colors, cycleMethod, colorSpace); } catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); } }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // Can't modify the transform passed in... transform = new AffineTransform(transform); //incorporate the gradient transform transform.concatenate(gradientTransform); try { return new LinearGradientPaintContext(cm, deviceBounds, userBounds, transform, hints, start, end, fractions, this.getColors(), cycleMethod, colorSpace); } catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); } }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
public static WritableRaster copyRaster(Raster ras, int minX, int minY) { WritableRaster ret = Raster.createWritableRaster (ras.getSampleModel(), new Point(0,0)); ret = ret.createWritableChild (ras.getMinX()-ras.getSampleModelTranslateX(), ras.getMinY()-ras.getSampleModelTranslateY(), ras.getWidth(), ras.getHeight(), minX, minY, null); // Use System.arraycopy to copy the data between the two... DataBuffer srcDB = ras.getDataBuffer(); DataBuffer retDB = ret.getDataBuffer(); if (srcDB.getDataType() != retDB.getDataType()) { throw new IllegalArgumentException ("New DataBuffer doesn't match original"); } int len = srcDB.getSize(); int banks = srcDB.getNumBanks(); int [] offsets = srcDB.getOffsets(); for (int b=0; b< banks; b++) { switch (srcDB.getDataType()) { case DataBuffer.TYPE_BYTE: { DataBufferByte srcDBT = (DataBufferByte)srcDB; DataBufferByte retDBT = (DataBufferByte)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_INT: { DataBufferInt srcDBT = (DataBufferInt)srcDB; DataBufferInt retDBT = (DataBufferInt)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_SHORT: { DataBufferShort srcDBT = (DataBufferShort)srcDB; DataBufferShort retDBT = (DataBufferShort)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_USHORT: { DataBufferUShort srcDBT = (DataBufferUShort)srcDB; DataBufferUShort retDBT = (DataBufferUShort)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } } } return ret; }
// in sources/org/apache/batik/ext/awt/image/rendered/ColorMatrixRed.java
public void setMatrix(float[][] matrix){ float[][] tmp = copyMatrix(matrix); if(tmp == null){ throw new IllegalArgumentException(); } if(tmp.length != 4){ throw new IllegalArgumentException(); } for(int i=0; i<4; i++){ if(tmp[i].length != 5){ throw new IllegalArgumentException( String.valueOf( i ) + " : " + tmp[i].length); } } this.matrix = matrix; }
// in sources/org/apache/batik/ext/awt/image/rendered/TurbulencePatternRed.java
public WritableRaster copyData(WritableRaster dest) { // // First, check input arguments // if(dest==null) throw new IllegalArgumentException ("Cannot generate a noise pattern into a null raster"); int w = dest.getWidth(); int h = dest.getHeight(); // Access the integer buffer for the destination Raster DataBufferInt dstDB = (DataBufferInt)dest.getDataBuffer(); SinglePixelPackedSampleModel sppsm; int minX = dest.getMinX(); int minY = dest.getMinY(); sppsm = (SinglePixelPackedSampleModel)dest.getSampleModel(); int dstOff = dstDB.getOffset() + sppsm.getOffset(minX - dest.getSampleModelTranslateX(), minY - dest.getSampleModelTranslateY()); final int[] destPixels = dstDB.getBankData()[0]; int dstAdjust = sppsm.getScanlineStride() - w; // Generate pixel pattern now int i, end, dp=dstOff; final int[] rgb = new int[4]; final double[] fSum = {0, 0, 0, 0}; final double[] noise = {0, 0, 0, 0}; final double tx0, tx1, ty0, ty1; tx0 = tx[0]; tx1 = tx[1]; // Update for y step, (note we substract all the stuff we // added while going across the scan line). ty0 = ty[0]-(w*tx0); ty1 = ty[1]-(w*tx1); double[] p = {minX, minY}; txf.transform(p, 0, p, 0, 1); double point_0 = p[0]; double point_1 = p[1]; if(isFractalNoise){ if(stitchInfo == null){ if (channels.length == 4) { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++) { destPixels[dp] = turbulenceFractal_4 (point_0, point_1, fSum); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } else { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ turbulenceFractal(rgb, point_0, point_1, fSum, noise); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ StitchInfo si = new StitchInfo(); for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ si.assign(this.stitchInfo); turbulenceFractalStitch(rgb, point_0, point_1, fSum, noise, si); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ // Loop for turbulence noise if(stitchInfo == null){ if (channels.length == 4) { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ destPixels[dp] = turbulence_4 (point_0, point_1, fSum); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } else { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ turbulence(rgb, point_0, point_1, fSum, noise); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ StitchInfo si = new StitchInfo(); for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ si.assign(this.stitchInfo); turbulenceStitch(rgb, point_0, point_1, fSum, noise, si); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } return dest; }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
private void checkCompatible(ColorModel colorModel, SampleModel sampleModel){ ColorSpace cs = colorModel.getColorSpace(); // Check that model is sRGB or linear RGB if((!cs .equals (sRGB)) && (!cs .equals( lRGB))) throw new IllegalArgumentException("Expected CS_sRGB or CS_LINEAR_RGB color model"); // Check ColorModel is of type DirectColorModel if(!(colorModel instanceof DirectColorModel)) throw new IllegalArgumentException("colorModel should be an instance of DirectColorModel"); // Check transfer type if(sampleModel.getDataType() != DataBuffer.TYPE_INT) throw new IllegalArgumentException("colorModel's transferType should be DataBuffer.TYPE_INT"); // Check red, green, blue and alpha mask DirectColorModel dcm = (DirectColorModel)colorModel; if(dcm.getRedMask() != 0x00ff0000) throw new IllegalArgumentException("red mask in source should be 0x00ff0000"); if(dcm.getGreenMask() != 0x0000ff00) throw new IllegalArgumentException("green mask in source should be 0x0000ff00"); if(dcm.getBlueMask() != 0x000000ff) throw new IllegalArgumentException("blue mask in source should be 0x000000ff"); if(dcm.getAlphaMask() != 0xff000000) throw new IllegalArgumentException("alpha mask in source should be 0xff000000"); }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
private void checkCompatible(SampleModel model){ // Check model is ok: should be SinglePixelPackedSampleModel if(!(model instanceof SinglePixelPackedSampleModel)) throw new IllegalArgumentException ("MorphologyOp only works with Rasters " + "using SinglePixelPackedSampleModels"); // Check number of bands int nBands = model.getNumBands(); if(nBands!=4) throw new IllegalArgumentException ("MorphologyOp only words with Rasters having 4 bands"); // Check that integer packed. if(model.getDataType()!=DataBuffer.TYPE_INT) throw new IllegalArgumentException ("MorphologyOp only works with Rasters using DataBufferInt"); // Check bit masks int[] bitOffsets=((SinglePixelPackedSampleModel)model).getBitOffsets(); for(int i=0; i<bitOffsets.length; i++){ if(bitOffsets[i]%8 != 0) throw new IllegalArgumentException ("MorphologyOp only works with Rasters using 8 bits " + "per band : " + i + " : " + bitOffsets[i]); } }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
public WritableRaster filter(Raster src, WritableRaster dest){ // //This method sorts the pixel values in the kernel window in two steps: // 1. sort by row and store the result into an intermediate matrix // 2. sort the intermediate matrix by column and output the max/min value // into the destination matrix element //check destation if(dest!=null) checkCompatible(dest.getSampleModel()); else { if(src==null) throw new IllegalArgumentException("src should not be null when dest is null"); else dest = createCompatibleDestRaster(src); } final int w = src.getWidth(); final int h = src.getHeight(); // Access the integer buffer for each image. DataBufferInt srcDB = (DataBufferInt)src.getDataBuffer(); DataBufferInt dstDB = (DataBufferInt)dest.getDataBuffer(); // Offset defines where in the stack the real data begin final int srcOff = srcDB.getOffset(); final int dstOff = dstDB.getOffset(); // Stride is the distance between two consecutive column elements, // in the one-dimention dataBuffer final int srcScanStride = ((SinglePixelPackedSampleModel)src.getSampleModel()).getScanlineStride(); final int dstScanStride = ((SinglePixelPackedSampleModel)dest.getSampleModel()).getScanlineStride(); // Access the pixel value array final int[] srcPixels = srcDB.getBankData()[0]; final int[] destPixels = dstDB.getBankData()[0]; // The pointer of src and dest indicating where the pixel values are int sp, dp, cp; // Declaration for the circular buffer's implementation // These are the circular buffers' head pointer and // the index pointers // bufferHead points to the leftmost element in the circular buffer int bufferHead; int maxIndexA; int maxIndexR; int maxIndexG; int maxIndexB; // Temp variables int pel, currentPixel, lastPixel; int a,r,g,b; int a1,r1,g1,b1; // In both round, we are using an optimization approach // to reduce excessive computation to sort values around // the current pixel. The idea is as follows: // ---------------- // |*|V|V|$|N|V|V|&| // ---------------- // For example, suppose we've finished pixel"$" and come // to "N", the radius is 3. Then we must have got the max/min // value and index array for "$". If the max/min is at // "*"(using the index array to judge this), // we need to recompute a max/min and the index array // for "N"; if the max/min is not at "*", we can // reuse the current max/min: we simply compare it with // "&", and update the max/min and the index array. // // The first round: sort by row // if (w<=2*radiusX){ specialProcessRow(src, dest); } // when the size is large enough, we can // use standard optimization method else { final int [] bufferA = new int [rangeX]; final int [] bufferR = new int [rangeX]; final int [] bufferG = new int [rangeX]; final int [] bufferB = new int [rangeX]; for (int i=0; i<h; i++){ // initialization of pointers, indice // at the head of each row sp = srcOff + i*srcScanStride; dp = dstOff + i*dstScanStride; bufferHead = 0; maxIndexA = 0; maxIndexR = 0; maxIndexG = 0; maxIndexB = 0; // // j=0 : Initialization, compute the max/min and // index array for the use of other pixels. // pel = srcPixels[sp++]; a = pel>>>24; r = pel&0xff0000; g = pel&0xff00; b = pel&0xff; bufferA[0] = a; bufferR[0] = r; bufferG[0] = g; bufferB[0] = b; for (int k=1; k<=radiusX; k++){ currentPixel = srcPixels[sp++]; a1 = currentPixel>>>24; r1 = currentPixel&0xff0000; g1 = currentPixel&0xff00; b1 = currentPixel&0xff; bufferA[k] = a1; bufferR[k] = r1; bufferG[k] = g1; bufferB[k] = b1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = k; } if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = k; } if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = k; } if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = k; } } destPixels[dp++] = (a << 24) | r | g | b; // // 1 <= j <= radiusX : The left margin of each row. // for (int j=1; j<=radiusX; j++){ lastPixel = srcPixels[sp++]; // here is the Alpha channel // we retrieve the previous max/min value a = bufferA[maxIndexA]; a1 = lastPixel>>>24; bufferA[j+radiusX] = a1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = j+radiusX; } // now we deal with the Red channel r = bufferR[maxIndexR]; r1 = lastPixel&0xff0000; bufferR[j+radiusX] = r1; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = j+radiusX; } // now we deal with the Green channel g = bufferG[maxIndexG]; g1 = lastPixel&0xff00; bufferG[j+radiusX] = g1; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = j+radiusX; } // now we deal with the Blue channel b = bufferB[maxIndexB]; b1 = lastPixel&0xff; bufferB[j+radiusX] = b1; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = j+radiusX; } // now we have gone through the four channels and // updated the index array. then we'll pack the // new max/min value according to each channel's // max/min vlue destPixels[dp++] = (a << 24) | r | g | b; } // // radiusX <= j <= w-1-radiusX : Inner body of the row, between // left and right margins // for (int j=radiusX+1; j<=w-1-radiusX; j++){ lastPixel = srcPixels[sp++]; a1 = lastPixel>>>24; r1 = lastPixel&0xff0000; g1 = lastPixel&0xff00; b1 = lastPixel&0xff; bufferA[bufferHead] = a1; bufferR[bufferHead] = r1; bufferG[bufferHead] = g1; bufferB[bufferHead] = b1; // Alpha channel: // we need to recompute a local max/min // and update the max/min index if (maxIndexA == bufferHead){ a = bufferA[0]; maxIndexA = 0; for (int m= 1; m< rangeX; m++){ a1 = bufferA[m]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = m; } } } // we can reuse the previous max/min value else { a = bufferA[maxIndexA]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = bufferHead; } } // Red channel // we need to recompute a local max/min // and update the index array if (maxIndexR == bufferHead){ r = bufferR[0]; maxIndexR = 0; for (int m= 1; m< rangeX; m++){ r1 = bufferR[m]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = m; } } } // we can reuse the previous max/min value else { r = bufferR[maxIndexR]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = bufferHead; } } // Green channel // we need to recompute a local max/min // and update the index array if (maxIndexG == bufferHead){ g = bufferG[0]; maxIndexG = 0; for (int m= 1; m< rangeX; m++){ g1 = bufferG[m]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = m; } } } // we can reuse the previous max/min value else { g = bufferG[maxIndexG]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = bufferHead; } } // Blue channel // we need to recompute a local max/min // and update the index array if (maxIndexB == bufferHead){ b = bufferB[0]; maxIndexB = 0; for (int m= 1; m< rangeX; m++){ b1 = bufferB[m]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = m; } } } // we can reuse the previous max/min value else { b = bufferB[maxIndexB]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = bufferHead; } } destPixels[dp++] = (a << 24) | r | g | b; bufferHead = (bufferHead+1)%rangeX; } // // w-radiusX <= j < w : The right margin of the row // // Head will be updated to indicate the current head // of the remaining buffer int head; // Tail is where the last element is final int tail = (bufferHead == 0)?rangeX-1:bufferHead -1; int count = rangeX-1; for (int j=w-radiusX; j<w; j++){ head = (bufferHead+1)%rangeX; // Dealing with Alpha Channel: if (maxIndexA == bufferHead){ a = bufferA[tail]; int hd = head; for(int m=1; m<count; m++) { a1 = bufferA[hd]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = hd; } hd = (hd+1)%rangeX; } } // Dealing with Red Channel: if (maxIndexR == bufferHead){ r = bufferR[tail]; int hd = head; for(int m=1; m<count; m++) { r1 = bufferR[hd]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = hd; } hd = (hd+1)%rangeX; } } // Dealing with Green Channel: if (maxIndexG == bufferHead){ g = bufferG[tail]; int hd = head; for(int m=1; m<count; m++) { g1 = bufferG[hd]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = hd; } hd = (hd+1)%rangeX; } } // Dealing with Blue Channel: if (maxIndexB == bufferHead){ b = bufferB[tail]; int hd = head; for(int m=1; m<count; m++) { b1 = bufferB[hd]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = hd; } hd = (hd+1)%rangeX; } } destPixels[dp++] = (a << 24) | r | g | b; bufferHead = (bufferHead+1)%rangeX; // we throw another element count--; }// end of the right margin of this row // return to the beginning of the next row } }// end of the first round! // // Second round: sort by column // the difference from the first round is that // now we are accessing the intermediate matrix // // When the image size is smaller than the // Kernel size if (h<=2*radiusY){ specialProcessColumn(src, dest); } // when the size is large enough, we can // use standard optimization method else { final int [] bufferA = new int [rangeY]; final int [] bufferR = new int [rangeY]; final int [] bufferG = new int [rangeY]; final int [] bufferB = new int [rangeY]; for (int j=0; j<w; j++){ // initialization of pointers, indice // at the head of each column dp = dstOff + j; cp = dstOff + j; bufferHead = 0; maxIndexA = 0; maxIndexR = 0; maxIndexG = 0; maxIndexB = 0; // i=0 : The first pixel pel = destPixels[cp]; cp += dstScanStride; a = pel>>>24; r = pel&0xff0000; g = pel&0xff00; b = pel&0xff; bufferA[0] = a; bufferR[0] = r; bufferG[0] = g; bufferB[0] = b; for (int k=1; k<=radiusY; k++){ currentPixel = destPixels[cp]; cp += dstScanStride; a1 = currentPixel>>>24; r1 = currentPixel&0xff0000; g1 = currentPixel&0xff00; b1 = currentPixel&0xff; bufferA[k] = a1; bufferR[k] = r1; bufferG[k] = g1; bufferB[k] = b1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = k; } if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = k; } if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = k; } if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = k; } } destPixels[dp] = (a << 24) | r | g | b; // go to the next element in the column. dp += dstScanStride; // 1 <= i <= radiusY : The upper margin of each row for (int i=1; i<=radiusY; i++){ int maxI = i+radiusY; // we can reuse the previous max/min value lastPixel = destPixels[cp]; cp += dstScanStride; // here is the Alpha channel a = bufferA[maxIndexA]; a1 = lastPixel>>>24; bufferA[maxI] = a1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = maxI; } // now we deal with the Red channel r = bufferR[maxIndexR]; r1 = lastPixel&0xff0000; bufferR[maxI] = r1; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = maxI; } // now we deal with the Green channel g = bufferG[maxIndexG]; g1 = lastPixel&0xff00; bufferG[maxI] = g1; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = maxI; } // now we deal with the Blue channel b = bufferB[maxIndexB]; b1 = lastPixel&0xff; bufferB[maxI] = b1; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = maxI; } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; } // // radiusY +1 <= i <= h-1-radiusY: // inner body of the column between upper and lower margins // for (int i=radiusY+1; i<=h-1-radiusY; i++){ lastPixel = destPixels[cp]; cp += dstScanStride; a1 = lastPixel>>>24; r1 = lastPixel&0xff0000; g1 = lastPixel&0xff00; b1 = lastPixel&0xff; bufferA[bufferHead] = a1; bufferR[bufferHead] = r1; bufferG[bufferHead] = g1; bufferB[bufferHead] = b1; // here we check if the previous max/min value can be // reused safely and, if possible, reuse the previous // maximum value // Alpha channel: // Recompute the local max/min if (maxIndexA == bufferHead){ a = bufferA[0]; maxIndexA = 0; for (int m= 1; m<= 2*radiusY; m++){ a1 = bufferA[m]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = m; } } } // we can reuse the previous max/min value else { a = bufferA[maxIndexA]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = bufferHead; } } // Red channel: if (maxIndexR == bufferHead){ r = bufferR[0]; maxIndexR = 0; for (int m= 1; m<= 2*radiusY; m++){ r1 = bufferR[m]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = m; } } } // we can reuse the previous max/min value else { r = bufferR[maxIndexR]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = bufferHead; } } // Green channel if (maxIndexG == bufferHead){ g = bufferG[0]; maxIndexG = 0; for (int m= 1; m<= 2*radiusY; m++){ g1 = bufferG[m]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = m; } } } // we can reuse the previous max/min value else { g = bufferG[maxIndexG]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = bufferHead; } } // Blue channel: if (maxIndexB == bufferHead){ b = bufferB[0]; maxIndexB = 0; for (int m= 1; m<= 2*radiusY; m++){ b1 = bufferB[m]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = m; } } } // we can reuse the previous max/min value else { b = bufferB[maxIndexB]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = bufferHead; } } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; bufferHead = (bufferHead+1)%rangeY; } // // h-radiusY <= i <= h-1 : The lower margin of the column // // head will be updated to indicate the current head // of the remaining buffer: int head; // tail is where the last element in the buffer is final int tail = (bufferHead == 0)?2*radiusY:bufferHead -1; int count = rangeY-1; for (int i= h-radiusY; i<h-1; i++){ head = (bufferHead +1)%rangeY; if (maxIndexA == bufferHead){ a = bufferA[tail]; int hd = head; for (int m=1; m<count; m++){ a1 = bufferA[hd]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = hd; } hd = (hd+1)%rangeY; } } if (maxIndexR == bufferHead){ r = bufferR[tail]; int hd = head; for (int m=1; m<count; m++){ r1 = bufferR[hd]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = hd; } hd = (hd+1)%rangeY; } } if (maxIndexG == bufferHead){ g = bufferG[tail]; int hd = head; for (int m=1; m<count; m++){ g1 = bufferG[hd]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = hd; } hd = (hd+1)%rangeY; } } if (maxIndexB == bufferHead){ b = bufferB[tail]; int hd = head; for (int m=1; m<count; m++){ b1 = bufferB[hd]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = hd; } hd = (hd+1)%rangeY; } } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; bufferHead = (bufferHead+1)%rangeY; // we throw out this useless element count--; } // return to the beginning of the next column } }// end of the second round! return dest; }
// in sources/org/apache/batik/ext/awt/image/rendered/CompositeRed.java
protected static ColorModel fixColorModel(CachableRed src) { ColorModel cm = src.getColorModel(); if (cm.hasAlpha()) { if (!cm.isAlphaPremultiplied()) cm = GraphicsUtil.coerceColorModel(cm, true); return cm; } int b = src.getSampleModel().getNumBands()+1; if (b > 4) throw new IllegalArgumentException ("CompositeRed can only handle up to three band images"); int [] masks = new int[4]; for (int i=0; i < b-1; i++) masks[i] = 0xFF0000 >> (8*i); masks[3] = 0xFF << (8*(b-1)); ColorSpace cs = cm.getColorSpace(); return new DirectColorModel(cs, 8*b, masks[0], masks[1], masks[2], masks[3], true, DataBuffer.TYPE_INT); }
// in sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
public static CachableRed construct(CachableRed src, ColorModel cm) { ColorModel srcCM = src.getColorModel(); if ((cm.hasAlpha() != srcCM.hasAlpha()) || (cm.isAlphaPremultiplied() != srcCM.isAlphaPremultiplied())) return new FormatRed(src, cm); if (cm.getNumComponents() != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible ColorModel given"); if ((srcCM instanceof ComponentColorModel) && (cm instanceof ComponentColorModel)) return src; if ((srcCM instanceof DirectColorModel) && (cm instanceof DirectColorModel)) return src; return new FormatRed(src, cm); }
// in sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
public static ColorModel makeColorModel(CachableRed cr, SampleModel sm) { ColorModel srcCM = cr.getColorModel(); ColorSpace cs = srcCM.getColorSpace(); int bands = sm.getNumBands(); int bits; int dt = sm.getDataType(); switch (dt) { case DataBuffer.TYPE_BYTE: bits=8; break; case DataBuffer.TYPE_SHORT: bits=16; break; case DataBuffer.TYPE_USHORT: bits=16; break; case DataBuffer.TYPE_INT: bits=32; break; default: throw new IllegalArgumentException ("Unsupported DataBuffer type: " + dt); } boolean hasAlpha = srcCM.hasAlpha(); if (hasAlpha){ // if Src has Alpha then our out bands must // either be one less than the source (no out alpha) // or equal (still has alpha) if (bands == srcCM.getNumComponents()-1) hasAlpha = false; else if (bands != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible number of bands in and out"); } else { if (bands == srcCM.getNumComponents()+1) hasAlpha = true; else if (bands != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible number of bands in and out"); } boolean preMult = srcCM.isAlphaPremultiplied(); if (!hasAlpha) preMult = false; if (sm instanceof ComponentSampleModel) { int [] bitsPer = new int[bands]; for (int i=0; i<bands; i++) bitsPer[i] = bits; return new ComponentColorModel (cs, bitsPer, hasAlpha, preMult, hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE, dt); } else if (sm instanceof SinglePixelPackedSampleModel) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)sm; int[] masks = sppsm.getBitMasks(); if (bands == 4) return new DirectColorModel (cs, bits, masks[0], masks[1], masks[2], masks[3], preMult, dt); else if (bands == 3) return new DirectColorModel (cs, bits, masks[0], masks[1], masks[2], 0x0, preMult, dt); else throw new IllegalArgumentException ("Incompatible number of bands out for ColorModel"); } throw new IllegalArgumentException ("Unsupported SampleModel Type"); }
// in sources/org/apache/batik/ext/awt/image/rendered/GaussianBlurRed8Bit.java
protected static ColorModel fixColorModel(CachableRed src) { ColorModel cm = src.getColorModel(); int b = src.getSampleModel().getNumBands(); int [] masks = new int[4]; switch (b) { case 1: masks[0] = 0xFF; break; case 2: masks[0] = 0x00FF; masks[3] = 0xFF00; break; case 3: masks[0] = 0xFF0000; masks[1] = 0x00FF00; masks[2] = 0x0000FF; break; case 4: masks[0] = 0x00FF0000; masks[1] = 0x0000FF00; masks[2] = 0x000000FF; masks[3] = 0xFF000000; break; default: throw new IllegalArgumentException ("GaussianBlurRed8Bit only supports one to four band images"); } ColorSpace cs = cm.getColorSpace(); return new DirectColorModel(cs, 8*b, masks[0], masks[1], masks[2], masks[3], true, DataBuffer.TYPE_INT); }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java
public void setFilterResolutionX(int filterResolutionX){ if(filterResolutionX < 0){ throw new IllegalArgumentException(); } touch(); this.filterResolutionX = filterResolutionX; }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setSources(List sources){ if(sources.size() != 2){ throw new IllegalArgumentException(); } init(sources, null); }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setXChannelSelector(ARGBChannel xChannelSelector){ if(xChannelSelector == null){ throw new IllegalArgumentException(); } touch(); this.xChannelSelector = xChannelSelector; }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setYChannelSelector(ARGBChannel yChannelSelector){ if(yChannelSelector == null){ throw new IllegalArgumentException(); } touch(); this.yChannelSelector = yChannelSelector; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
public void setStdDeviationX(double stdDeviationX){ if(stdDeviationX < 0){ throw new IllegalArgumentException(); } touch(); this.stdDeviationX = stdDeviationX; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
public void setStdDeviationY(double stdDeviationY){ if(stdDeviationY < 0){ throw new IllegalArgumentException(); } touch(); this.stdDeviationY = stdDeviationY; }
// in sources/org/apache/batik/ext/awt/image/renderable/FloodRable8Bit.java
public void setFloodRegion(Rectangle2D floodRegion){ if(floodRegion == null){ throw new IllegalArgumentException(); } touch(); this.floodRegion = floodRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/MorphologyRable8Bit.java
public void setRadiusX(double radiusX){ if(radiusX <= 0){ throw new IllegalArgumentException(); } touch(); this.radiusX = radiusX; }
// in sources/org/apache/batik/ext/awt/image/renderable/MorphologyRable8Bit.java
public void setRadiusY(double radiusY){ if(radiusY <= 0){ throw new IllegalArgumentException(); } touch(); this.radiusY = radiusY; }
// in sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable8Bit.java
public static ColorMatrixRable buildMatrix(float[][] matrix){ if(matrix == null){ throw new IllegalArgumentException(); } if(matrix.length != 4){ throw new IllegalArgumentException(); } float[][] newMatrix = new float[4][]; for(int i=0; i<4; i++){ float[] m = matrix[i]; if(m == null){ throw new IllegalArgumentException(); } if(m.length != 5){ throw new IllegalArgumentException(); } newMatrix[i] = new float[5]; for(int j=0; j<5; j++){ newMatrix[i][j] = m[j]; } } /*for(int i=0; i<4; i++){ for(int j=0; j<5; j++) System.out.print(newMatrix[i][j] + " "); System.out.println(); }*/ ColorMatrixRable8Bit filter = new ColorMatrixRable8Bit(); filter.type = TYPE_MATRIX; filter.matrix = newMatrix; return filter; }
// in sources/org/apache/batik/ext/awt/image/renderable/TileRable8Bit.java
public void setTileRegion(Rectangle2D tileRegion){ if(tileRegion == null){ throw new IllegalArgumentException(); } touch(); this.tileRegion = tileRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/TileRable8Bit.java
public void setTiledRegion(Rectangle2D tiledRegion){ if(tiledRegion == null){ throw new IllegalArgumentException(); } touch(); this.tiledRegion = tiledRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java
public RenderedImage createRendering(RenderContext rc) { // Just copy over the rendering hints. RenderingHints rh = rc.getRenderingHints(); if (rh == null) rh = new RenderingHints(null); // update the current affine transform AffineTransform at = rc.getTransform(); // This splits out the scale and applies it // prior to the Gaussian. Then after appying the gaussian // it applies the shear (rotation) and translation components. double sx = at.getScaleX(); double sy = at.getScaleY(); double shx = at.getShearX(); double shy = at.getShearY(); double tx = at.getTranslateX(); double ty = at.getTranslateY(); // The Scale is the "hypotonose" of the matrix vectors. This // represents the complete scaling value from user to an // intermediate space that is scaled similarly to device // space. double scaleX = Math.sqrt(sx*sx + shy*shy); double scaleY = Math.sqrt(sy*sy + shx*shx); // These values represent the scale factor to the intermediate // coordinate system where we will apply our convolution. if (kernelUnitLength != null) { if (kernelUnitLength[0] > 0.0) scaleX = 1/kernelUnitLength[0]; if (kernelUnitLength[1] > 0.0) scaleY = 1/kernelUnitLength[1]; } Shape aoi = rc.getAreaOfInterest(); if(aoi == null) aoi = getBounds2D(); Rectangle2D r = aoi.getBounds2D(); int kw = kernel.getWidth(); int kh = kernel.getHeight(); int kx = target.x; int ky = target.y; // Grow the region in usr space. { double rx0 = r.getX() -(kx/scaleX); double ry0 = r.getY() -(ky/scaleY); double rx1 = rx0 + r.getWidth() + (kw-1)/scaleX; double ry1 = ry0 + r.getHeight() + (kh-1)/scaleY; r = new Rectangle2D.Double(Math.floor(rx0), Math.floor(ry0), Math.ceil (rx1-Math.floor(rx0)), Math.ceil (ry1-Math.floor(ry0))); } // This will be the affine transform between our usr space and // an intermediate space which is scaled according to // kernelUnitLength and is axially aligned with our user // space. AffineTransform srcAt = AffineTransform.getScaleInstance(scaleX, scaleY); // This is the affine transform between our intermediate // coordinate space (where the convolution takes place) and // the real device space, or null (if we don't need an // intermediate space). // The shear/rotation simply divides out the // common scale factor in the matrix. AffineTransform resAt = new AffineTransform(sx/scaleX, shy/scaleX, shx/scaleY, sy/scaleY, tx, ty); RenderedImage ri; ri = getSource().createRendering(new RenderContext(srcAt, r, rh)); if (ri == null) return null; // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Padded Image", ri, // new Rectangle(ri.getMinX()+22,ri.getMinY()+38,5,5)); CachableRed cr = convertSourceCS(ri); Shape devShape = srcAt.createTransformedShape(aoi); Rectangle2D devRect = devShape.getBounds2D(); r = devRect; r = new Rectangle2D.Double(Math.floor(r.getX()-kx), Math.floor(r.getY()-ky), Math.ceil (r.getX()+r.getWidth())- Math.floor(r.getX())+(kw-1), Math.ceil (r.getY()+r.getHeight())- Math.floor(r.getY())+(kh-1)); if (!r.getBounds().equals(cr.getBounds())) { if (edgeMode == PadMode.WRAP) throw new IllegalArgumentException ("edgeMode=\"wrap\" is not supported by ConvolveMatrix."); cr = new PadRed(cr, r.getBounds(), edgeMode, rh); } // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Padded Image", cr, // new Rectangle(cr.getMinX()+23,cr.getMinY()+39,5,5)); if (bias != 0.0) throw new IllegalArgumentException ("Only bias equal to zero is supported in ConvolveMatrix."); BufferedImageOp op = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, rh); ColorModel cm = cr.getColorModel(); // OK this is a bit of a cheat. We Pull the DataBuffer out of // The read-only raster that getData gives us. And use it to // build a WritableRaster. This avoids a copy of the data. Raster rr = cr.getData(); WritableRaster wr = GraphicsUtil.makeRasterWritable(rr, 0, 0); // Here we update the translate to account for the phase shift // (if any) introduced by setting targetX, targetY in SVG. int phaseShiftX = target.x - kernel.getXOrigin(); int phaseShiftY = target.y - kernel.getYOrigin(); int destX = (int)(r.getX() + phaseShiftX); int destY = (int)(r.getY() + phaseShiftY); BufferedImage destBI; if (!preserveAlpha) { // Force the data to be premultiplied since often the JDK // code doesn't properly premultiply the values... cm = GraphicsUtil.coerceData(wr, cm, true); BufferedImage srcBI; srcBI = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null); // Easy case just apply the op... destBI = op.filter(srcBI, null); if (kernelHasNegValues) { // When the kernel has negative values it's possible // for the resultant image to have alpha values less // than the associated color values this will lead to // problems later when we try to display the image so // we fix this here. fixAlpha(destBI); } } else { BufferedImage srcBI; srcBI = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null); // Construct a linear sRGB cm without alpha... cm = new DirectColorModel(ColorSpace.getInstance (ColorSpace.CS_LINEAR_RGB), 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x0, false, DataBuffer.TYPE_INT); // Create an image with that color model BufferedImage tmpSrcBI = new BufferedImage (cm, cm.createCompatibleWritableRaster(wr.getWidth(), wr.getHeight()), cm.isAlphaPremultiplied(), null); // Copy the color data (no alpha) to that image // (dividing out alpha if needed). GraphicsUtil.copyData(srcBI, tmpSrcBI); // org.apache.batik.test.gvt.ImageDisplay.showImage // ("tmpSrcBI: ", tmpSrcBI); // Get a linear sRGB Premult ColorModel ColorModel dstCM = GraphicsUtil.Linear_sRGB_Unpre; // Construct out output image around that ColorModel destBI = new BufferedImage (dstCM, dstCM.createCompatibleWritableRaster(wr.getWidth(), wr.getHeight()), dstCM.isAlphaPremultiplied(), null); // Construct another image on the same data buffer but without // an alpha channel. // Create the Raster (note we are using 'cm' again). WritableRaster dstWR = Raster.createWritableRaster (cm.createCompatibleSampleModel(wr.getWidth(), wr.getHeight()), destBI.getRaster().getDataBuffer(), new Point(0,0)); // Create the BufferedImage. BufferedImage tmpDstBI = new BufferedImage (cm, dstWR, cm.isAlphaPremultiplied(), null); // Filter between the two image without alpha. tmpDstBI = op.filter(tmpSrcBI, tmpDstBI); // org.apache.batik.test.gvt.ImageDisplay.showImage // ("tmpDstBI: ", tmpDstBI); // Copy the alpha channel into the result (note the color // channels are still unpremult. Rectangle srcRect = wr.getBounds(); Rectangle dstRect = new Rectangle(srcRect.x-phaseShiftX, srcRect.y-phaseShiftY, srcRect.width, srcRect.height); GraphicsUtil.copyBand(wr, srcRect, wr.getNumBands()-1, destBI.getRaster(), dstRect, destBI.getRaster().getNumBands()-1); } // Wrap it as a CachableRed cr = new BufferedImageCachableRed(destBI, destX, destY); // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Cropped Image", cr, // new Rectangle(cr.getMinX()+22,cr.getMinY()+38,5,5)); // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Cropped sRGB", GraphicsUtil.convertTosRGB(cr), // new Rectangle(cr.getMinX()+22,cr.getMinY()+38,5,5)); // Make sure to crop junk from edges. cr = new PadRed(cr, devRect.getBounds(), PadMode.ZERO_PAD, rh); // If we need to scale/rotate/translate the result do so now... if (!resAt.isIdentity()) cr = new AffineRed(cr, resAt, null); // return the result. return cr; }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterChainRable8Bit.java
public void setFilterRegion(Rectangle2D filterRegion){ if(filterRegion == null){ throw new IllegalArgumentException(); } touch(); this.filterRegion = filterRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterChainRable8Bit.java
public void setSource(Filter chainSource) { if(chainSource == null){ throw new IllegalArgumentException("Null Source for Filter Chain"); } touch(); this.chainSource = chainSource; if(filterRes == null){ crop.setSource(chainSource); } else{ filterRes.setSource(chainSource); } }
// in sources/org/apache/batik/ext/awt/image/ConcreteComponentTransferFunction.java
public static ComponentTransferFunction getTableTransfer(float[] tableValues){ ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction(); f.type = TABLE; if(tableValues == null){ throw new IllegalArgumentException(); } if(tableValues.length < 2){ throw new IllegalArgumentException(); } f.tableValues = new float[tableValues.length]; System.arraycopy(tableValues, 0, f.tableValues, 0, tableValues.length); return f; }
// in sources/org/apache/batik/ext/awt/image/ConcreteComponentTransferFunction.java
public static ComponentTransferFunction getDiscreteTransfer(float[] tableValues){ ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction(); f.type = DISCRETE; if(tableValues == null){ throw new IllegalArgumentException(); } if(tableValues.length < 2){ throw new IllegalArgumentException(); } f.tableValues = new float[tableValues.length]; System.arraycopy(tableValues, 0, f.tableValues, 0, tableValues.length); return f; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public synchronized Raster getTile(int tileX, int tileY) { if ((tileX < 0) || (tileX >= tilesX) || (tileY < 0) || (tileY >= tilesY)) { throw new IllegalArgumentException("TIFFImage12"); } // System.out.println("Called TIFF getTile:" + tileX + "," + tileY); // Get the data array out of the DataBuffer byte[] bdata = null; short[] sdata = null; int[] idata = null; SampleModel sampleModel = getSampleModel(); WritableRaster tile = makeTile(tileX,tileY); DataBuffer buffer = tile.getDataBuffer(); int dataType = sampleModel.getDataType(); if (dataType == DataBuffer.TYPE_BYTE) { bdata = ((DataBufferByte)buffer).getData(); } else if (dataType == DataBuffer.TYPE_USHORT) { sdata = ((DataBufferUShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_SHORT) { sdata = ((DataBufferShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_INT) { idata = ((DataBufferInt)buffer).getData(); } // Variables used for swapping when converting from RGB to BGR byte bswap; short sswap; int iswap; // Save original file pointer position and seek to tile data location. long save_offset = 0; try { save_offset = stream.getFilePointer(); stream.seek(tileOffsets[tileY*tilesX + tileX]); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Number of bytes in this tile (strip) after compression. int byteCount = (int)tileByteCounts[tileY*tilesX + tileX]; // Find out the number of bytes in the current tile Rectangle newRect; if (!tiled) newRect = tile.getBounds(); else newRect = new Rectangle(tile.getMinX(), tile.getMinY(), tileWidth, tileHeight); int unitsInThisTile = newRect.width * newRect.height * numBands; // Allocate read buffer if needed. byte[] data = compression != COMP_NONE || imageType == TYPE_PALETTE ? new byte[byteCount] : null; // Read the data, uncompressing as needed. There are four cases: // bilevel, palette-RGB, 4-bit grayscale, and everything else. if(imageType == TYPE_BILEVEL) { // bilevel try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 8 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/8) * newRect.height; } else { bytesInThisTile = (newRect.width/8 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_FAX_G3_1D) { stream.readFully(data, 0, byteCount); decoder.decode1D(bdata, data, 0, newRect.height); } else if (compression == COMP_FAX_G3_2D) { stream.readFully(data, 0, byteCount); decoder.decode2D(bdata, data, 0, newRect.height, tiffT4Options); } else if (compression == COMP_FAX_G4_2D) { stream.readFully(data, 0, byteCount); decoder.decodeT6(bdata, data, 0, newRect.height, tiffT6Options); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else if(imageType == TYPE_PALETTE) { // palette-RGB if (sampleSize == 16) { if (decodePaletteAsShorts) { short[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Since unitsBeforeLookup is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply it by 2 in order to figure out // how many bytes we'll get after decompression. int entries = unitsBeforeLookup * 2; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; decodePackbits(data, entries, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_LZW) { // Read in all the compressed data for this tile stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; lzwDecoder.decode(data, byteArray, newRect.height); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; inflate(data, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_NONE) { // byteCount tells us how many bytes are there // in this tile, but we need to read in shorts, // which will take half the space, so while // allocating we divide byteCount by 2. tempData = new short[byteCount/2]; readShorts(byteCount/2, tempData); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } if (dataType == DataBuffer.TYPE_USHORT) { // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else if (dataType == DataBuffer.TYPE_SHORT) { // Expand the palette image into an rgb image with // short data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)cmapValue; // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)cmapValue; // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)cmapValue; } } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 8) { if (decodePaletteAsShorts) { byte[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; decodePackbits(data, unitsBeforeLookup, tempData); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); Raster tempTile = decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY()); int[] tempPixels = new int[unitsBeforeLookup]; tempTile.getPixels(tile.getMinX(), tile.getMinY(), tile.getWidth(), tile.getHeight(), tempPixels); tempData = new byte[unitsBeforeLookup]; for(int i = 0; i < unitsBeforeLookup; i++) { tempData[i] = (byte)tempPixels[i]; } } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = new byte[byteCount]; stream.readFully(tempData, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 4) { int padding = (newRect.width % 2 == 0) ? 0 : 1; int bytesPostDecoding = ((newRect.width/2 + padding) * newRect.height); // Output short images if (decodePaletteAsShorts) { byte[] tempData = null; try { stream.readFully(data, 0, byteCount); stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // If compressed, decode the data. if (compression == COMP_PACKBITS) { tempData = new byte[bytesPostDecoding]; decodePackbits(data, bytesPostDecoding, tempData); } else if (compression == COMP_LZW) { tempData = new byte[bytesPostDecoding]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_DEFLATE) { tempData = new byte[bytesPostDecoding]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = data; } int bytes = unitsInThisTile / 3; // Unpack the 2 pixels packed into each byte. data = new byte[bytes]; int srcCount = 0, dstCount = 0; for (int j=0; j<newRect.height; j++) { for (int i=0; i<newRect.width/2; i++) { data[dstCount++] = (byte)((tempData[srcCount] & 0xf0) >> 4); data[dstCount++] = (byte)(tempData[srcCount++] & 0x0f); } if (padding == 1) { data[dstCount++] = (byte)((tempData[srcCount++] & 0xf0) >> 4); } } int len = colormap.length/3; int len2 = len*2; int cmapValue, lookup; int count = 0; for (int i=0; i<bytes; i++) { lookup = data[i] & 0xff; cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // Output byte values, use IndexColorModel for unpacking try { // If compressed, decode the data. if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, bytesPostDecoding, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } } else if(imageType == TYPE_GRAY_4BIT) { // 4-bit gray try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 2 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/2) * newRect.height; } else { bytesInThisTile = (newRect.width/2 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else { // everything else try { if (sampleSize == 8) { if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } } else if (sampleSize == 16) { if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } } else if (sampleSize == 32 && dataType == DataBuffer.TYPE_INT) { // redundant if (compression == COMP_NONE) { readInts(byteCount/4, idata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 4]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 4; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 4]; inflate(data, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Modify the data for certain special cases. switch(imageType) { case TYPE_GRAY: case TYPE_GRAY_ALPHA: if(isWhiteZero) { // Since we are using a ComponentColorModel with this // image, we need to change the WhiteIsZero data to // BlackIsZero data so it will display properly. if (dataType == DataBuffer.TYPE_BYTE && !(getColorModel() instanceof IndexColorModel)) { for (int l = 0; l < bdata.length; l += numBands) { bdata[l] = (byte)(255 - bdata[l]); } } else if (dataType == DataBuffer.TYPE_USHORT) { int ushortMax = Short.MAX_VALUE - Short.MIN_VALUE; for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(ushortMax - sdata[l]); } } else if (dataType == DataBuffer.TYPE_SHORT) { for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(~sdata[l]); } } else if (dataType == DataBuffer.TYPE_INT) { long uintMax = ((long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE); for (int l = 0; l < idata.length; l += numBands) { idata[l] = (int)(uintMax - idata[l]); } } } break; case TYPE_RGB: // Change RGB to BGR order, as Java2D displays that faster. // Unnecessary for JPEG-in-TIFF as the decoder handles it. if (sampleSize == 8 && compression != COMP_JPEG_TTN2) { for (int i=0; i<unitsInThisTile; i+=3) { bswap = bdata[i]; bdata[i] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=3) { sswap = sdata[i]; sdata[i] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=3) { iswap = idata[i]; idata[i] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_RGB_ALPHA: // Convert from RGBA to ABGR for Java2D if (sampleSize == 8) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A bswap = bdata[i]; bdata[i] = bdata[i+3]; bdata[i+3] = bswap; // Swap G and B bswap = bdata[i+1]; bdata[i+1] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A sswap = sdata[i]; sdata[i] = sdata[i+3]; sdata[i+3] = sswap; // Swap G and B sswap = sdata[i+1]; sdata[i+1] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A iswap = idata[i]; idata[i] = idata[i+3]; idata[i+3] = iswap; // Swap G and B iswap = idata[i+1]; idata[i+1] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_YCBCR_SUB: // Post-processing for YCbCr with subsampled chrominance: // simply replicate the chroma channels for displayability. int pixelsPerDataUnit = chromaSubH*chromaSubV; int numH = newRect.width/chromaSubH; int numV = newRect.height/chromaSubV; byte[] tempData = new byte[numH*numV*(pixelsPerDataUnit + 2)]; System.arraycopy(bdata, 0, tempData, 0, tempData.length); int samplesPerDataUnit = pixelsPerDataUnit*3; int[] pixels = new int[samplesPerDataUnit]; int bOffset = 0; int offsetCb = pixelsPerDataUnit; int offsetCr = offsetCb + 1; int y = newRect.y; for(int j = 0; j < numV; j++) { int x = newRect.x; for(int i = 0; i < numH; i++) { int Cb = tempData[bOffset + offsetCb]; int Cr = tempData[bOffset + offsetCr]; int k = 0; while(k < samplesPerDataUnit) { pixels[k++] = tempData[bOffset++]; pixels[k++] = Cb; pixels[k++] = Cr; } bOffset += 2; tile.setPixels(x, y, chromaSubH, chromaSubV, pixels); x += chromaSubH; } y += chromaSubV; } break; } } return tile; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private ComponentColorModel createAlphaComponentColorModel (int dataType, int numBands, boolean isAlphaPremultiplied, int transparency) { ComponentColorModel ccm = null; int[] RGBBits = null; ColorSpace cs = null; switch(numBands) { case 2: // gray+alpha cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); break; case 4: // RGB+alpha cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); break; default: throw new IllegalArgumentException(); } int componentSize = 0; switch(dataType) { case DataBuffer.TYPE_BYTE: componentSize = 8; break; case DataBuffer.TYPE_USHORT: case DataBuffer.TYPE_SHORT: componentSize = 16; break; case DataBuffer.TYPE_INT: componentSize = 32; break; default: throw new IllegalArgumentException(); } RGBBits = new int[numBands]; for(int i = 0; i < numBands; i++) { RGBBits[i] = componentSize; } ccm = new ComponentColorModel(cs, RGBBits, true, isAlphaPremultiplied, transparency, dataType); return ccm; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public int compareTo(Object o) { if(o == null) { throw new IllegalArgumentException(); } int oTag = ((TIFFField)o).getTag(); if(tag < oTag) { return -1; } else if(tag > oTag) { return 1; } else { return 0; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
Override protected ImageWriteParam getDefaultWriteParam( ImageWriter iiowriter, RenderedImage image, ImageWriterParams params) { JPEGImageWriteParam param = new JPEGImageWriteParam(iiowriter.getLocale()); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(params.getJPEGQuality()); if (params.getCompressionMethod() != null && !"JPEG".equals(params.getCompressionMethod())) { throw new IllegalArgumentException( "No compression method other than JPEG is supported for JPEG output!"); } if (params.getJPEGForceBaseline()) { param.setProgressiveMode(JPEGImageWriteParam.MODE_DISABLED); } return param; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8) { throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam2")); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8 && bitDepth != 16) { throw new IllegalArgumentException(); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setChromaticity(float[] chromaticity) { if (chromaticity.length != 8) { throw new IllegalArgumentException(); } this.chromaticity = (float[])(chromaticity.clone()); chromaticitySet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { // Error -- bad tile requested String msg = PropertyUtil.getString("PNGImageDecoder17"); throw new IllegalArgumentException(msg); } return theTile; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { // Error -- bad tile requested String msg = PropertyUtil.getString("PNGImageDecoder17"); throw new IllegalArgumentException(msg); } return theTile; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGDecodeParam.java
public void setUserExponent(float userExponent) { if (userExponent <= 0.0F) { throw new IllegalArgumentException(PropertyUtil.getString("PNGDecodeParam0")); } this.userExponent = userExponent; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGDecodeParam.java
public void setDisplayExponent(float displayExponent) { if (displayExponent <= 0.0F) { throw new IllegalArgumentException(PropertyUtil.getString("PNGDecodeParam1")); } this.displayExponent = displayExponent; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SingleTileRenderedImage.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { throw new IllegalArgumentException(PropertyUtil.getString("SingleTileRenderedImage0")); } return ras; }
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToObjectBoundingBox(float value, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: // as is return value; case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: // If a percentage value is used, it is converted to a // 'bounding box' space coordinate by division by 100 return value / 100f; case SVGLength.SVG_LENGTHTYPE_PX: case SVGLength.SVG_LENGTHTYPE_MM: case SVGLength.SVG_LENGTHTYPE_CM: case SVGLength.SVG_LENGTHTYPE_IN: case SVGLength.SVG_LENGTHTYPE_PT: case SVGLength.SVG_LENGTHTYPE_PC: case SVGLength.SVG_LENGTHTYPE_EMS: case SVGLength.SVG_LENGTHTYPE_EXS: // <!> FIXME: resolve units in userSpace but consider them // in the objectBoundingBox coordinate system return svgToUserSpace(value, type, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToUserSpace(float v, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: case SVGLength.SVG_LENGTHTYPE_PX: return v; case SVGLength.SVG_LENGTHTYPE_MM: return (v / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_CM: return (v * 10f / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_IN: return (v * 25.4f / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_PT: return (v * 25.4f / (72f * ctx.getPixelUnitToMillimeter())); case SVGLength.SVG_LENGTHTYPE_PC: return (v * 25.4f / (6f * ctx.getPixelUnitToMillimeter())); case SVGLength.SVG_LENGTHTYPE_EMS: return emsToPixels(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_EXS: return exsToPixels(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: return percentagesToPixels(v, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float userSpaceToSVG(float v, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: case SVGLength.SVG_LENGTHTYPE_PX: return v; case SVGLength.SVG_LENGTHTYPE_MM: return (v * ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_CM: return (v * ctx.getPixelUnitToMillimeter() / 10f); case SVGLength.SVG_LENGTHTYPE_IN: return (v * ctx.getPixelUnitToMillimeter() / 25.4f); case SVGLength.SVG_LENGTHTYPE_PT: return (v * (72f * ctx.getPixelUnitToMillimeter()) / 25.4f); case SVGLength.SVG_LENGTHTYPE_PC: return (v * (6f * ctx.getPixelUnitToMillimeter()) / 25.4f); case SVGLength.SVG_LENGTHTYPE_EMS: return pixelsToEms(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_EXS: return pixelsToExs(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: return pixelsToPercentages(v, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
public void setRecordStore(WMFRecordStore currentStore){ if (currentStore == null){ throw new IllegalArgumentException(); } this.currentStore = currentStore; }
// in sources/org/apache/batik/transcoder/TranscodingHints.java
public Object put(Object key, Object value) { if (!((Key) key).isCompatibleValue(value)) { throw new IllegalArgumentException(value+ " incompatible with "+ key); } return super.put(key, value); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public float getLighterFontWeight(float f) { if (svgUserAgent != null) { return svgUserAgent.getLighterFontWeight(f); } // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public float getBolderFontWeight(float f) { if (svgUserAgent != null) { return svgUserAgent.getBolderFontWeight(f); } // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public float getLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public float getBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } if (shape instanceof ExtendedShape) { this.extShape = (ExtendedShape)shape; } else { this.extShape = new ShapeExtender(shape); } this.startMarkerProxy = null; this.middleMarkerProxies = null; this.endMarkerProxy = null; this.markerGroup = null; }
// in sources/org/apache/batik/gvt/filter/MaskRable8Bit.java
public void setFilterRegion(Rectangle2D filterRegion){ if(filterRegion == null){ throw new IllegalArgumentException(); } this.filterRegion = filterRegion; }
// in sources/org/apache/batik/gvt/filter/GraphicsNodeRable8Bit.java
public void setGraphicsNode(GraphicsNode node){ if(node == null){ throw new IllegalArgumentException(); } this.node = node; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
public void setGraphicsNode(GraphicsNode node){ if(node == null){ throw new IllegalArgumentException(); } this.node = node; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
public Filter getBackground(GraphicsNode gn, GraphicsNode child, Rectangle2D aoi) { if (gn == null) { throw new IllegalArgumentException ("BackgroundImage requested yet no parent has " + "'enable-background:new'"); } Rectangle2D r2d = null; if (gn instanceof CompositeGraphicsNode) { CompositeGraphicsNode cgn = (CompositeGraphicsNode)gn; r2d = cgn.getBackgroundEnable(); } List srcs = new ArrayList(); // this hides a member in a super-class!! if (r2d == null) { Rectangle2D paoi = aoi; AffineTransform at = gn.getTransform(); if (at != null) paoi = at.createTransformedShape(aoi).getBounds2D(); Filter f = getBackground(gn.getParent(), gn, paoi); // Don't add the nodes unless they will contribute. if ((f != null) && f.getBounds2D().intersects(aoi)) { srcs.add(f); } } if (child != null) { CompositeGraphicsNode cgn = (CompositeGraphicsNode)gn; List children = cgn.getChildren(); Iterator i = children.iterator(); while (i.hasNext()) { GraphicsNode childGN = (GraphicsNode)i.next(); // System.out.println("Parent: " + cgn + // "\n Child: " + child + // "\n ChildGN: " + childGN); if (childGN == child) break; Rectangle2D cbounds = childGN.getBounds(); if (cbounds == null) continue; // System.out.println("Child : " + childGN); // System.out.println("Bounds: " + cbounds); // System.out.println(" : " + aoi); AffineTransform at = childGN.getTransform(); if (at != null) cbounds = at.createTransformedShape(cbounds).getBounds2D(); if (aoi.intersects(cbounds)) { srcs.add(childGN.getEnableBackgroundGraphicsNodeRable (true)); } } } if (srcs.size() == 0) return null; Filter ret = null; if (srcs.size() == 1) ret = (Filter)srcs.get(0); else ret = new CompositeRable8Bit(srcs, CompositeRule.OVER, false); if (child != null) { // We are returning the filter to child so make // sure to map the filter from the parents user space // to the childs user space... AffineTransform at = child.getTransform(); if (at != null) { try { at = at.createInverse(); ret = new AffineRable8Bit(ret, at); } catch (NoninvertibleTransformException nte) { ret = null; } } } return ret; }
// in sources/org/apache/batik/gvt/FillShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object set(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } checkRange(index); GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Replace the node to the children list GraphicsNode oldNode = children[index]; children[index] = node; // Set the parents of the graphics nodes ((AbstractGraphicsNode) node).setParent(this); ((AbstractGraphicsNode) oldNode).setParent(null); // Set the root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); ((AbstractGraphicsNode) oldNode).setRoot(null); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch events // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_REMOVED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, oldNode)); // id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); return oldNode; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean add(Object o) { // Check for correct argument if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Add the graphics node to the children list ensureCapacity(count + 1); // Increments modCount!! children[count++] = node; // Set the parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set the root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); return true; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } if (index > count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Insert the node to the children list ensureCapacity(count+1); // Increments modCount!! System.arraycopy(children, index, children, index+1, count-index); children[index] = node; count++; // Set parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean remove(Object o) { // Check for correct argument if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } GraphicsNode node = (GraphicsNode) o; if (node.getParent() != this) { return false; } // Remove the node int index = 0; for (; node != children[index]; index++); // fires exception when node not found! remove(index); return true; }
// in sources/org/apache/batik/gvt/GVTTreeWalker.java
public void setCurrentGraphicsNode(GraphicsNode node) { if (node.getRoot() != gvtRoot) { throw new IllegalArgumentException ("The node "+node+" is not part of the document "+gvtRoot); } currentNode = node; }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
protected void processMouseEvent(GraphicsNodeMouseEvent evt) { if (glisteners != null) { GraphicsNodeMouseListener[] listeners = (GraphicsNodeMouseListener[]) getListeners(GraphicsNodeMouseListener.class); switch (evt.getID()) { case GraphicsNodeMouseEvent.MOUSE_MOVED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseMoved(evt); } break; case GraphicsNodeMouseEvent.MOUSE_DRAGGED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseDragged(evt); } break; case GraphicsNodeMouseEvent.MOUSE_ENTERED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseEntered(evt); } break; case GraphicsNodeMouseEvent.MOUSE_EXITED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseExited(evt); } break; case GraphicsNodeMouseEvent.MOUSE_CLICKED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseClicked(evt); } break; case GraphicsNodeMouseEvent.MOUSE_PRESSED: for (int i = 0; i < listeners.length; i++) { listeners[i].mousePressed(evt); } break; case GraphicsNodeMouseEvent.MOUSE_RELEASED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseReleased(evt); } break; default: throw new IllegalArgumentException("Unknown Mouse Event type: "+evt.getID()); } } }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
public void processKeyEvent(GraphicsNodeKeyEvent evt) { if ((glisteners != null)) { GraphicsNodeKeyListener[] listeners = (GraphicsNodeKeyListener[]) getListeners(GraphicsNodeKeyListener.class); switch (evt.getID()) { case GraphicsNodeKeyEvent.KEY_PRESSED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyPressed(evt); } break; case GraphicsNodeKeyEvent.KEY_RELEASED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyReleased(evt); } break; case GraphicsNodeKeyEvent.KEY_TYPED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyTyped(evt); } break; default: throw new IllegalArgumentException("Unknown Key Event type: "+evt.getID()); } } evt.consume(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn) { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length+1) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + '+' + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (positionReturn == null) { positionReturn = new float[numEntries*2]; } if ((beginGlyphIndex+numEntries) == glyphs.length+1) { numEntries--; positionReturn[numEntries*2] = (float)endPos.getX(); positionReturn[numEntries*2+1] = (float)endPos.getY(); } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { Point2D glyphPos; glyphPos = glyphs[i].getPosition(); positionReturn[(i-beginGlyphIndex)*2] = (float)glyphPos.getX(); positionReturn[(i-beginGlyphIndex)*2 + 1] = (float)glyphPos.getY(); } return positionReturn; }
// in sources/org/apache/batik/gvt/font/MultiGlyphVector.java
public GVTFont getFont() { throw new IllegalArgumentException("Can't be correctly Implemented"); }
// in sources/org/apache/batik/gvt/flow/FlowRegions.java
public boolean gotoY(double y) { if (y < currentY) throw new IllegalArgumentException ("New Y can not be lower than old Y\n" + "Old Y: " + currentY + " New Y: " + y); if (y == currentY) return false; sr = sl.split(y); sl = sr.getBelow(); sr = null; currentY = y; if (sl == null) return true; newLineHeight(lineHeight); return false; }
// in sources/org/apache/batik/gvt/StrokeShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; this.strokedShape = null; }
// in sources/org/apache/batik/gvt/CompositeShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } if (painters != null) { for (int i=0; i < count; ++i) { painters[i].setShape(shape); } } this.shape = shape; }
// in sources/org/apache/batik/bridge/URIResolver.java
public Element getElement(String uri, Element ref) throws MalformedURLException, IOException { Node n = getNode(uri, ref); if (n == null) { return null; } else if (n.getNodeType() == Node.DOCUMENT_NODE) { throw new IllegalArgumentException(); } else { return (Element)n; } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public static float getStandardLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public static float getStandardBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Paint convertPaint(Element paintedElement, GraphicsNode paintedNode, Value paintDef, float opacity, BridgeContext ctx) { if (paintDef.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { switch (paintDef.getPrimitiveType()) { case CSSPrimitiveValue.CSS_IDENT: return null; // none case CSSPrimitiveValue.CSS_RGBCOLOR: return convertColor(paintDef, opacity); case CSSPrimitiveValue.CSS_URI: return convertURIPaint(paintedElement, paintedNode, paintDef, opacity, ctx); default: throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } else { // List Value v = paintDef.item(0); switch (v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_RGBCOLOR: return convertRGBICCColor(paintedElement, v, (ICCColor)paintDef.item(1), opacity, ctx); case CSSPrimitiveValue.CSS_URI: { Paint result = silentConvertURIPaint(paintedElement, paintedNode, v, opacity, ctx); if (result != null) return result; v = paintDef.item(1); switch (v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_IDENT: return null; // none case CSSPrimitiveValue.CSS_RGBCOLOR: if (paintDef.getLength() == 2) { return convertColor(v, opacity); } else { return convertRGBICCColor(paintedElement, v, (ICCColor)paintDef.item(2), opacity, ctx); } default: throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } default: // can't be reached throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int convertStrokeLinecap(Value v) { String s = v.getStringValue(); switch (s.charAt(0)) { case 'b': return BasicStroke.CAP_BUTT; case 'r': return BasicStroke.CAP_ROUND; case 's': return BasicStroke.CAP_SQUARE; default: throw new IllegalArgumentException ("Linecap argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int convertStrokeLinejoin(Value v) { String s = v.getStringValue(); switch (s.charAt(0)) { case 'm': return BasicStroke.JOIN_MITER; case 'r': return BasicStroke.JOIN_ROUND; case 'b': return BasicStroke.JOIN_BEVEL; default: throw new IllegalArgumentException ("Linejoin argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int resolveColorComponent(Value v) { float f; switch(v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_PERCENTAGE: f = v.getFloatValue(); f = (f > 100f) ? 100f : (f < 0f) ? 0f : f; return Math.round(255f * f / 100f); case CSSPrimitiveValue.CSS_NUMBER: f = v.getFloatValue(); f = (f > 255f) ? 255f : (f < 0f) ? 0f : f; return Math.round(f); default: throw new IllegalArgumentException ("Color component argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Point2D convertPoint(String xStr, String xAttr, String yStr, String yAttr, short unitsType, UnitProcessor.Context uctx) { float x, y; switch (unitsType) { case OBJECT_BOUNDING_BOX: x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, xAttr, uctx); y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, yAttr, uctx); break; case USER_SPACE_ON_USE: x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, xAttr, uctx); y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, yAttr, uctx); break; default: throw new IllegalArgumentException("Invalid unit type"); } return new Point2D.Float(x, y); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float convertLength(String length, String attr, short unitsType, UnitProcessor.Context uctx) { switch (unitsType) { case OBJECT_BOUNDING_BOX: return UnitProcessor.svgOtherLengthToObjectBoundingBox (length, attr, uctx); case USER_SPACE_ON_USE: return UnitProcessor.svgOtherLengthToUserSpace(length, attr, uctx); default: throw new IllegalArgumentException("Invalid unit type"); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
protected static Rectangle2D extendRegion(String dxStr, String dyStr, String dwStr, String dhStr, short unitsType, GraphicsNode filteredNode, Rectangle2D region, UnitProcessor.Context uctx) { float dx,dy,dw,dh; switch (unitsType) { case USER_SPACE_ON_USE: dx = UnitProcessor.svgHorizontalCoordinateToUserSpace (dxStr, SVG12Constants.SVG_MX_ATRIBUTE, uctx); dy = UnitProcessor.svgVerticalCoordinateToUserSpace (dyStr, SVG12Constants.SVG_MY_ATRIBUTE, uctx); dw = UnitProcessor.svgHorizontalCoordinateToUserSpace (dwStr, SVG12Constants.SVG_MW_ATRIBUTE, uctx); dh = UnitProcessor.svgVerticalCoordinateToUserSpace (dhStr, SVG12Constants.SVG_MH_ATRIBUTE, uctx); break; case OBJECT_BOUNDING_BOX: Rectangle2D bounds = filteredNode.getGeometryBounds(); if (bounds == null) { dx = dy = dw = dh = 0; } else { dx = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (dxStr, SVG12Constants.SVG_MX_ATRIBUTE, uctx); dx *= bounds.getWidth(); dy = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (dyStr, SVG12Constants.SVG_MY_ATRIBUTE, uctx); dy *= bounds.getHeight(); dw = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (dwStr, SVG12Constants.SVG_MW_ATRIBUTE, uctx); dw *= bounds.getWidth(); dh = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (dhStr, SVG12Constants.SVG_MH_ATRIBUTE, uctx); dh *= bounds.getHeight(); } break; default: throw new IllegalArgumentException("Invalid unit type"); } region.setRect(region.getX() + dx, region.getY() + dy, region.getWidth() + dw, region.getHeight() + dh); return region; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLContext.java
public void setSyntaxForeground(Map syntaxForegroundMap) { if (syntaxForegroundMap == null) { throw new IllegalArgumentException("syntaxForegroundMap can not be null"); } this.syntaxForegroundMap = syntaxForegroundMap; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLContext.java
public void setSyntaxFont(Map syntaxFontMap) { if (syntaxFontMap == null) { throw new IllegalArgumentException("syntaxFontMap can not be null"); } this.syntaxFontMap = syntaxFontMap; }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setModificationHandler(ModificationHandler h) { if (!(h instanceof PaintModificationHandler)) { throw new IllegalArgumentException(); } super.setModificationHandler(h); }
5
              
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
3
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setQuality(float quality) throws IllegalArgumentException { if(quality >= 1){ throw new IllegalArgumentException(); } this.quality = quality; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setIndexed(int bits) throws IllegalArgumentException { this.indexed = bits; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
(Lib) DOMException 139
              
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
public CSSEngine createCSSEngine(AbstractStylableDocument doc, CSSContext ctx) { String pn = XMLResourceDescriptor.getCSSParserClassName(); Parser p; try { p = (Parser)Class.forName(pn).newInstance(); } catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); } catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); } catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); } ExtendedParser ep = ExtendedParserWrapper.wrap(p); ValueManager[] vms; if (customValueManagers == null) { vms = new ValueManager[0]; } else { vms = new ValueManager[customValueManagers.size()]; Iterator it = customValueManagers.iterator(); int i = 0; while (it.hasNext()) { vms[i++] = (ValueManager)it.next(); } } ShorthandManager[] sms; if (customShorthandManagers == null) { sms = new ShorthandManager[0]; } else { sms = new ShorthandManager[customShorthandManagers.size()]; Iterator it = customShorthandManagers.iterator(); int i = 0; while (it.hasNext()) { sms[i++] = (ShorthandManager)it.next(); } } CSSEngine result = createCSSEngine(doc, ctx, ep, vms, sms); doc.setCSSEngine(result); return result; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) { if (qualifiedName == null) { qualifiedName = ""; } int test = XMLUtilities.testXMLQName(qualifiedName); if ((test & XMLUtilities.IS_XML_10_NAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("xml.name", new Object[] { qualifiedName })); } if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("invalid.qname", new Object[] { qualifiedName })); } return new GenericDocumentType(qualifiedName, publicId, systemId); }
// in sources/org/apache/batik/dom/GenericDOMImplementation.java
public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) { if (qualifiedName == null) { qualifiedName = ""; } int test = XMLUtilities.testXMLQName(qualifiedName); if ((test & XMLUtilities.IS_XML_10_NAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("xml.name", new Object[] { qualifiedName })); } if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("invalid.qname", new Object[] { qualifiedName })); } return new GenericDocumentType(qualifiedName, publicId, systemId); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/events/DocumentEventSupport.java
public Event createEvent(String eventType) throws DOMException { EventFactory ef = (EventFactory)eventFactories.get(eventType.toLowerCase()); if (ef == null) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Bad event type: " + eventType); } return ef.createEvent(); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkType(Element elt, String str) { if (!"simple".equals(str) && !"extended".equals(str) && !"locator".equals(str) && !"arc".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:type='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "type", str); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkShow(Element elt, String str) { if (!"new".equals(str) && !"replace".equals(str) && !"embed".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:show='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "show", str); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkActuate(Element elt, String str) { if (!"onReplace".equals(str) && !"onLoad".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:actuate='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "actuate", str); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void parseStyleSheetPIData(String data, HashTable table) { // !!! Internationalization char c; int i = 0; // Skip leading whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } while (i < data.length()) { // Parse the pseudo attribute name c = data.charAt(i); int d = c / 32; int m = c % 32; if ((NAME_FIRST_CHARACTER[d] & (1 << m)) == 0) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, "Wrong name initial: " + c); } StringBuffer ident = new StringBuffer(); ident.append(c); while (++i < data.length()) { c = data.charAt(i); d = c / 32; m = c % 32; if ((NAME_CHARACTER[d] & (1 << m)) == 0) { break; } ident.append(c); } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // The next char must be '=' if (data.charAt(i) != '=') { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } i++; // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // The next char must be '\'' or '"' c = data.charAt(i); i++; StringBuffer value = new StringBuffer(); if (c == '\'') { while (i < data.length()) { c = data.charAt(i); if (c == '\'') { break; } value.append(c); i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } } else if (c == '"') { while (i < data.length()) { c = data.charAt(i); if (c == '"') { break; } value.append(c); i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } } else { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } table.put(ident.toString().intern(), value.toString()); i++; // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public short getColorType() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setUri(String uri) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { ((PaintModificationHandler)handler).uriChanged(uri); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setPaint(short paintType, String uri, String rgbColor, String iccColor) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { ((PaintModificationHandler)handler).paintChanged (paintType, uri, rgbColor, iccColor); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + text + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + text + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + text + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + text + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + text + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + text + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ")"; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0).getCssText() + ' ' + text; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0).getCssText() + ' ' + text + ' ' + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: textChanged(getValue().item(0).getCssText() + ' ' + rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_PAINTTYPE_CURRENTCOLOR: textChanged("currentcolor"); break; case SVG_PAINTTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorProfileChanged(String cp) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); sb.append(cp); iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsCleared() throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsInitialized(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorInsertedBefore(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorReplaced(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorRemoved(int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorAppend(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.floatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public static float convertFloatValue(short unitType, Value value) { switch (unitType) { case CSSPrimitiveValue.CSS_NUMBER: case CSSPrimitiveValue.CSS_PERCENTAGE: case CSSPrimitiveValue.CSS_EMS: case CSSPrimitiveValue.CSS_EXS: case CSSPrimitiveValue.CSS_DIMENSION: case CSSPrimitiveValue.CSS_PX: if (value.getPrimitiveType() == unitType) { return value.getFloatValue(); } break; case CSSPrimitiveValue.CSS_CM: return toCentimeters(value); case CSSPrimitiveValue.CSS_MM: return toMillimeters(value); case CSSPrimitiveValue.CSS_IN: return toInches(value); case CSSPrimitiveValue.CSS_PT: return toPoints(value); case CSSPrimitiveValue.CSS_PC: return toPicas(value); case CSSPrimitiveValue.CSS_DEG: return toDegrees(value); case CSSPrimitiveValue.CSS_RAD: return toRadians(value); case CSSPrimitiveValue.CSS_GRAD: return toGradians(value); case CSSPrimitiveValue.CSS_MS: return toMilliseconds(value); case CSSPrimitiveValue.CSS_S: return toSeconds(value); case CSSPrimitiveValue.CSS_HZ: return toHertz(value); case CSSPrimitiveValue.CSS_KHZ: return tokHertz(value); } throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toCentimeters(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return value.getFloatValue(); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() / 10); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 2.54f); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() * 2.54f / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 2.54f / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toInches(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() / 25.4f); case CSSPrimitiveValue.CSS_IN: return value.getFloatValue(); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toMillimeters(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 10); case CSSPrimitiveValue.CSS_MM: return value.getFloatValue(); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 25.4f); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() * 25.4f / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 25.4f / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toPoints(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 72 / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() * 72 / 25.4f); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 72); case CSSPrimitiveValue.CSS_PT: return value.getFloatValue(); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 12); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toPicas(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 6 / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() * 6 / 25.4f); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 6); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() / 12); case CSSPrimitiveValue.CSS_PC: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toDegrees(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return value.getFloatValue(); case CSSPrimitiveValue.CSS_RAD: return (float) Math.toDegrees( value.getFloatValue() ); case CSSPrimitiveValue.CSS_GRAD: return (value.getFloatValue() * 9 / 5); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toRadians(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return (value.getFloatValue() * 5 / 9); // todo ?? case CSSPrimitiveValue.CSS_RAD: return value.getFloatValue(); case CSSPrimitiveValue.CSS_GRAD: return (float)(value.getFloatValue() * 100 / Math.PI); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toGradians(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return (float)(value.getFloatValue() * Math.PI / 180); // todo ???? case CSSPrimitiveValue.CSS_RAD: return (float)(value.getFloatValue() * Math.PI / 100); case CSSPrimitiveValue.CSS_GRAD: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toMilliseconds(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_MS: return value.getFloatValue(); case CSSPrimitiveValue.CSS_S: return (value.getFloatValue() * 1000); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toSeconds(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_MS: return (value.getFloatValue() / 1000); case CSSPrimitiveValue.CSS_S: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toHertz(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_HZ: return value.getFloatValue(); case CSSPrimitiveValue.CSS_KHZ: return (value.getFloatValue() / 1000); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float tokHertz(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_HZ: return (value.getFloatValue() * 1000); case CSSPrimitiveValue.CSS_KHZ: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.stringValueChanged(stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public int getLength() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public CSSValue item(int index) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected Value getValue() { if (index >= valueProvider.getValue().getLength()) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } return valueProvider.getValue().item(index); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listTextChanged(index, cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listFloatValueChanged(index, unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listStringValueChanged(index, stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setCssText(String cssText) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public String removeProperty(String propertyName) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { values = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public String removeProperty(String propertyName) throws DOMException { String result = getPropertyValue(propertyName); if (result.length() > 0) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (values != null) { values.remove(propertyName); } handler.propertyRemoved(propertyName); } } return result; }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.propertyChanged(propertyName, value, prio); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (values == null || values.get(this) == null || StyleDeclarationValue.this.handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setRGBColor(String color) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.rgbColorChanged(color); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setRGBColorICCColor(String rgb, String icc) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.rgbColorICCColorChanged(rgb, icc); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColor(short type, String rgb, String icc) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorChanged(type, rgb, icc); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public String getColorProfile() { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } Value value = valueProvider.getValue(); return ((ICCColor)value.item(1)).getColorProfile(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColorProfile(String colorProfile) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorProfileChanged(colorProfile); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public int getNumberOfItems() { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } Value value = valueProvider.getValue(); return ((ICCColor)value.item(1)).getNumberOfColors(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void clear() throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorsCleared(); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { float f = newItem.getValue(); iccColors = new ArrayList(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorsInitialized(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber getItem(int index) throws DOMException { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } Value value = valueProvider.getValue().item(1); float f = ((ICCColor)value).getColor(index); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); return result; }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index > n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(index, result); handler.colorInsertedBefore(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); handler.colorReplaced(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber removeItem(int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } SVGNumber result = null; if (iccColors != null) { result = (ColorNumber)iccColors.get(index); } if (result == null) { Value value = valueProvider.getValue().item(1); result = new ColorNumber(((ICCColor)value).getColor(index)); } handler.colorRemoved(index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber appendItem (SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (iccColors == null) { int n = getNumberOfItems(); iccColors = new ArrayList(n); for (int i = 0; i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorAppend(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setValue(float f) { value = f; if (iccColors == null) { return; } int idx = iccColors.indexOf(this); if (idx == -1) { return; } if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorReplaced(f, idx); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append( value.getGreen().getCssText()); sb.append(','); sb.append( value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorChanged(String text) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_COLORTYPE_CURRENTCOLOR: textChanged(CSSConstants.CSS_CURRENTCOLOR_VALUE); break; case SVG_COLORTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorProfileChanged(String cp) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)value.item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsCleared() throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsInitialized(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorInsertedBefore(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorReplaced(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorRemoved(int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorAppend(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public int getLength() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public CSSValue item(int index) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/engine/value/FloatValue.java
public static String getCssText(short unit, float value) { if (unit < 0 || unit >= UNITS.length) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } String s = String.valueOf(value); if (s.endsWith(".0")) { s = s.substring(0, s.length() - 2); } return s + UNITS[unit - CSSPrimitiveValue.CSS_NUMBER]; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void setMedia(String str) { try { media = parser.parseMedia(str); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); } }
4
              
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
497
              
// in sources/org/apache/batik/dom/AbstractDocument.java
public Node importNode(Node importedNode, boolean deep) throws DOMException { return importNode(importedNode, deep, false); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Event createEvent(String eventType) throws DOMException { if (documentEventSupport == null) { documentEventSupport = ((AbstractDOMImplementation)implementation). createDocumentEventSupport(); } return documentEventSupport.createEvent(eventType); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public NodeIterator createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { if (traversalSupport == null) { traversalSupport = new TraversalSupport(); } return traversalSupport.createNodeIterator(this, root, whatToShow, filter, entityReferenceExpansion); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public TreeWalker createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { return TraversalSupport.createTreeWalker(this, root, whatToShow, filter, entityReferenceExpansion); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setXmlStandalone(boolean b) throws DOMException { xmlStandalone = b; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setXmlVersion(String v) throws DOMException { if (v == null || !v.equals(XMLConstants.XML_VERSION_10) && !v.equals(XMLConstants.XML_VERSION_11)) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "xml.version", new Object[] { v }); } xmlVersion = v; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Node adoptNode(Node n) throws DOMException { if (!(n instanceof AbstractNode)) { return null; } switch (n.getNodeType()) { case Node.DOCUMENT_NODE: throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document", new Object[] {}); case Node.DOCUMENT_TYPE_NODE: throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document.type", new Object[] {}); case Node.ENTITY_NODE: case Node.NOTATION_NODE: return null; } AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(an.getNodeType()), an.getNodeName() }); } Node parent = n.getParentNode(); if (parent != null) { parent.removeChild(n); } adoptNode1((AbstractNode) n); return n; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setTextContent(String s) throws DOMException { }
// in sources/org/apache/batik/dom/AbstractDocument.java
public XPathExpression createExpression(String expression, XPathNSResolver resolver) throws DOMException, XPathException { return new XPathExpr(expression, resolver); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Object evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) throws XPathException, DOMException { XPathExpression xpath = createExpression(expression, resolver); return xpath.evaluate(contextNode, type, result); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Object evaluate(Node contextNode, short type, Object res) throws XPathException, DOMException { if (contextNode.getNodeType() != DOCUMENT_NODE && contextNode.getOwnerDocument() != AbstractDocument.this || contextNode.getNodeType() == DOCUMENT_NODE && contextNode != AbstractDocument.this) { throw createDOMException (DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[] { new Integer(contextNode.getNodeType()), contextNode.getNodeName() }); } if (type < 0 || type > 9) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "xpath.invalid.result.type", new Object[] { new Integer(type) }); } switch (contextNode.getNodeType()) { case ENTITY_REFERENCE_NODE: case ENTITY_NODE: case DOCUMENT_TYPE_NODE: case DOCUMENT_FRAGMENT_NODE: case NOTATION_NODE: throw createDOMException (DOMException.NOT_SUPPORTED_ERR, "xpath.invalid.context.node", new Object[] { new Integer(contextNode.getNodeType()), contextNode.getNodeName() }); } context.reset(); XObject result = null; try { result = xpath.execute(context, contextNode, prefixResolver); } catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); } try { switch (type) { case XPathResult.ANY_UNORDERED_NODE_TYPE: case XPathResult.FIRST_ORDERED_NODE_TYPE: return convertSingleNode(result, type); case XPathResult.BOOLEAN_TYPE: return convertBoolean(result); case XPathResult.NUMBER_TYPE: return convertNumber(result); case XPathResult.ORDERED_NODE_ITERATOR_TYPE: case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE: case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE: return convertNodeIterator(result, type); case XPathResult.STRING_TYPE: return convertString(result); case XPathResult.ANY_TYPE: switch (result.getType()) { case XObject.CLASS_BOOLEAN: return convertBoolean(result); case XObject.CLASS_NUMBER: return convertNumber(result); case XObject.CLASS_STRING: return convertString(result); case XObject.CLASS_NODESET: return convertNodeIterator (result, XPathResult.UNORDERED_NODE_ITERATOR_TYPE); } } } catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); } return null; }
// in sources/org/apache/batik/dom/AbstractNotation.java
public void setTextContent(String s) throws DOMException { }
// in sources/org/apache/batik/dom/svg12/SVG12DOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { SVGOMDocument result = new SVG12OMDocument(doctype, this); result.setIsSVG12(true); // BUG 32108: return empty document if qualifiedName is null. if (qualifiedName != null) result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/svg12/XBLOMElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/dom/AbstractText.java
public Text splitText(int offset) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String v = getNodeValue(); if (offset < 0 || offset >= v.length()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } Node n = getParentNode(); if (n == null) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "need.parent", new Object[] {}); } String t1 = v.substring(offset); Text t = createTextNode(t1); Node ns = getNextSibling(); if (ns != null) { n.insertBefore(t, ns); } else { n.appendChild(t); } setNodeValue(v.substring(0, offset)); return t; }
// in sources/org/apache/batik/dom/AbstractText.java
public Text replaceWholeText(String s) throws DOMException { for (Node n = getPreviousLogicallyAdjacentTextNode(this); n != null; n = getPreviousLogicallyAdjacentTextNode(n)) { AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(n.getNodeType()), n.getNodeName() }); } } for (Node n = getNextLogicallyAdjacentTextNode(this); n != null; n = getNextLogicallyAdjacentTextNode(n)) { AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(n.getNodeType()), n.getNodeName() }); } } Node parent = getParentNode(); for (Node n = getPreviousLogicallyAdjacentTextNode(this); n != null; n = getPreviousLogicallyAdjacentTextNode(n)) { parent.removeChild(n); } for (Node n = getNextLogicallyAdjacentTextNode(this); n != null; n = getNextLogicallyAdjacentTextNode(n)) { parent.removeChild(n); } if (isReadonly()) { Text t = createTextNode(s); parent.replaceChild(t, this); return t; } setNodeValue(s); return this; }
// in sources/org/apache/batik/dom/AbstractNode.java
public String getNodeValue() throws DOMException { return null; }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setNodeValue(String nodeValue) throws DOMException { }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node insertBefore(Node newChild, Node refChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName()}); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node removeChild(Node oldChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node appendChild(Node newChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String uri = getNamespaceURI(); if (uri == null) { throw createDOMException(DOMException.NAMESPACE_ERR, "namespace", new Object[] { new Integer(getNodeType()), getNodeName() }); } String name = getLocalName(); if (prefix == null) { // prefix null is explicitly allowed by org.w3c.dom.Node#setPrefix(String) setNodeName(name); return; } // prefix is guaranteed to be non-null here... if (!prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } if (!DOMUtilities.isValidPrefix(prefix)) { throw createDOMException(DOMException.NAMESPACE_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } if ((prefix.equals("xml") && !XMLSupport.XML_NAMESPACE_URI.equals(uri)) || (prefix.equals("xmlns") && !XMLSupport.XMLNS_NAMESPACE_URI.equals(uri))) { throw createDOMException(DOMException.NAMESPACE_ERR, "namespace.uri", new Object[] { new Integer(getNodeType()), getNodeName(), uri }); } setNodeName(prefix + ':' + name); }
// in sources/org/apache/batik/dom/AbstractNode.java
public short compareDocumentPosition(Node other) throws DOMException { if (this == other) { return 0; } ArrayList a1 = new ArrayList(10); ArrayList a2 = new ArrayList(10); int c1 = 0; int c2 = 0; Node n; if (getNodeType() == ATTRIBUTE_NODE) { a1.add(this); c1++; n = ((Attr) this).getOwnerElement(); if (other.getNodeType() == ATTRIBUTE_NODE) { Attr otherAttr = (Attr) other; if (n == otherAttr.getOwnerElement()) { if (hashCode() < ((Attr) other).hashCode()) { return DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; } else { return DOCUMENT_POSITION_FOLLOWING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; } } } } else { n = this; } while (n != null) { if (n == other) { return DOCUMENT_POSITION_CONTAINED_BY | DOCUMENT_POSITION_FOLLOWING; } a1.add(n); c1++; n = n.getParentNode(); } if (other.getNodeType() == ATTRIBUTE_NODE) { a2.add(other); c2++; n = ((Attr) other).getOwnerElement(); } else { n = other; } while (n != null) { if (n == this) { return DOCUMENT_POSITION_CONTAINS | DOCUMENT_POSITION_PRECEDING; } a2.add(n); c2++; n = n.getParentNode(); } int i1 = c1 - 1; int i2 = c2 - 1; if (a1.get(i1) != a2.get(i2)) { if (hashCode() < other.hashCode()) { return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_PRECEDING; } else { return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING; } } Object n1 = a1.get(i1); Object n2 = a2.get(i2); while (n1 == n2) { n = (Node) n1; n1 = a1.get(--i1); n2 = a2.get(--i2); } for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n == n1) { return DOCUMENT_POSITION_PRECEDING; } else if (n == n2) { return DOCUMENT_POSITION_FOLLOWING; } } return DOCUMENT_POSITION_DISCONNECTED; }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setTextContent(String s) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (getNodeType() != DOCUMENT_TYPE_NODE) { while (getFirstChild() != null) { removeChild(getFirstChild()); } appendChild(getOwnerDocument().createTextNode(s)); } }
// in sources/org/apache/batik/dom/GenericDOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { Document result = new GenericDocument(doctype, this); result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/AbstractAttr.java
public String getNodeValue() throws DOMException { Node first = getFirstChild(); if (first == null) { return ""; } Node n = first.getNextSibling(); if (n == null) { return first.getNodeValue(); } StringBuffer result = new StringBuffer(first.getNodeValue()); do { result.append(n.getNodeValue()); n = n.getNextSibling(); } while (n != null); return result.toString(); }
// in sources/org/apache/batik/dom/AbstractAttr.java
public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String s = getNodeValue(); // Remove all the children Node n; while ((n = getFirstChild()) != null) { removeChild(n); } String val = (nodeValue == null) ? "" : nodeValue; // Create and append a new child. n = getOwnerDocument().createTextNode(val); appendChild(n); if (ownerElement != null) { ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION); } }
// in sources/org/apache/batik/dom/AbstractAttr.java
public void setValue(String value) throws DOMException { setNodeValue(value); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public String getNodeValue() throws DOMException { return getData(); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public void setNodeValue(String nodeValue) throws DOMException { setData(nodeValue); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public void setData(String data) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String val = this.data; this.data = data; // Mutation event fireDOMCharacterDataModifiedEvent(val, this.data); if (getParentNode() != null) { ((AbstractParentNode)getParentNode()). fireDOMSubtreeModifiedEvent(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValue(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValueInSpecifiedUnits(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValueAsString(String value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public float getSimpleDuration() throws DOMException { float dur = ((SVGAnimationContext) getSVGContext()).getSimpleDuration(); if (dur == TimedElement.INDEFINITE) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "animation.dur.indefinite", null); } return dur; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean beginElement() throws DOMException { return ((SVGAnimationContext) getSVGContext()).beginElement(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean beginElementAt(float offset) throws DOMException { return ((SVGAnimationContext) getSVGContext()).beginElementAt(offset); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean endElement() throws DOMException { return ((SVGAnimationContext) getSVGContext()).endElement(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean endElementAt(float offset) throws DOMException { return ((SVGAnimationContext) getSVGContext()).endElementAt(offset); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException, SVGException { return (SVGNumber)initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber getItem(int index) throws DOMException { return (SVGNumber)getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException, SVGException { return (SVGNumber)insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException, SVGException { return (SVGNumber)replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber removeItem(int index) throws DOMException { return (SVGNumber)removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber appendItem(SVGNumber newItem) throws DOMException, SVGException { return (SVGNumber)appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValue(float value) throws DOMException { revalidate(); this.unitType = SVG_ANGLETYPE_DEG; this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValueInSpecifiedUnits(float value) throws DOMException { revalidate(); this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValueAsString(String value) throws DOMException { parse(value); reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValue(float value) throws DOMException { this.value = UnitProcessor.userSpaceToSVG(value, unitType, direction, context); reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValueInSpecifiedUnits(float value) throws DOMException { revalidate(); this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValueAsString(String value) throws DOMException { parse(value); reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
public void setBaseVal(short baseVal) throws DOMException { if (baseVal >= 0 && baseVal < values.length) { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, values[baseVal]); } finally { changing = false; } } }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { declaration = cssEngine.parseStyleDeclaration (SVGStylableElement.this, text); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyRemoved(String name) throws DOMException { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; return; } } }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyChanged(String name, String value, String prio) throws DOMException { boolean important = prio != null && prio.length() > 0; cssEngine.setMainProperties(SVGStylableElement.this, this, name, value, important); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStyleTextChanged (SVGStylableElement.this, text); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyRemoved(String name) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStylePropertyRemoved (SVGStylableElement.this, name); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyChanged(String name, String value, String prio) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStylePropertyChanged (SVGStylableElement.this, name, value, prio); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
protected void setValueAsString(String value) throws DOMException { PreserveAspectRatioParserHandler ph; ph = new PreserveAspectRatioParserHandler(); try { PreserveAspectRatioParser p = new PreserveAspectRatioParser(); p.setPreserveAspectRatioHandler(ph); p.parse(value); align = ph.getAlign(); meetOrSlice = ph.getMeetOrSlice(); } catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); } }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setXMLspace(String space) throws DOMException { setAttributeNS(XML_NAMESPACE_URI, XML_SPACE_QNAME, space); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setType(String type) throws DOMException { setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setMedia(String media) throws DOMException { setAttribute(SVG_MEDIA_ATTRIBUTE, media); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setTitle(String title) throws DOMException { setAttribute(SVG_TITLE_ATTRIBUTE, title); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGRect getExtentOfChar(Element elt, final int charnum ) { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGRect() { public float getX() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getX(); } public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getY() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getY(); } public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getWidth() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getWidth(); } public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getHeight() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getHeight(); } public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGPoint getStartPositionOfChar (Element elt, final int charnum) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGTextPoint(svgelt){ public float getX(){ return (float)SVGTextContentSupport.getStartPos (this.svgelt, context, charnum).getX(); } public float getY(){ return (float)SVGTextContentSupport.getStartPos (this.svgelt, context, charnum).getY(); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGPoint getEndPositionOfChar (Element elt,final int charnum) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGTextPoint(svgelt){ public float getX(){ return (float)SVGTextContentSupport.getEndPos (this.svgelt, context, charnum).getX(); } public float getY(){ return (float)SVGTextContentSupport.getEndPos (this.svgelt, context, charnum).getY(); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static int getCharNumAtPosition(Element elt, final float x, final float y) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return context.getCharNumAtPosition(x,y); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setX(float x) throws DOMException { this.x = x; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setY(float y) throws DOMException { this.y = y; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setWidth(float width) throws DOMException { this.w = width; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setHeight(float height) throws DOMException { this.h = height; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setX(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setY(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setWidth(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setHeight(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGZoomAndPanSupport.java
public static void setZoomAndPan(Element elt, short val) throws DOMException { switch (val) { case SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE: elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, SVG_DISABLE_VALUE); break; case SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY: elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, SVG_MAGNIFY_VALUE); break; default: throw ((AbstractNode)elt).createDOMException (DOMException.INVALID_MODIFICATION_ERR, "zoom.and.pan", new Object[] { new Integer(val) }); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setA(float a) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(a, at.getShearY(), at.getShearX(), at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setB(float b) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), b, at.getShearX(), at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setC(float c) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), c, at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setD(float d) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), d, at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setE(float e) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), at.getScaleY(), e, at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setF(float f) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), at.getScaleY(), at.getTranslateX(), f); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setLocal(String local) throws DOMException { setAttributeNS(null, SVG_LOCAL_ATTRIBUTE, local); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setName(String name) throws DOMException { setAttributeNS(null, SVG_NAME_ATTRIBUTE, name); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setRenderingIntent(short renderingIntent) throws DOMException { switch (renderingIntent) { case RENDERING_INTENT_AUTO: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_AUTO_VALUE); break; case RENDERING_INTENT_PERCEPTUAL: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_PERCEPTUAL_VALUE); break; case RENDERING_INTENT_RELATIVE_COLORIMETRIC: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_RELATIVE_COLORIMETRIC_VALUE); break; case RENDERING_INTENT_SATURATION: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_SATURATE_VALUE); break; case RENDERING_INTENT_ABSOLUTE_COLORIMETRIC: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_ABSOLUTE_COLORIMETRIC_VALUE); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg initialize ( SVGPathSeg newItem ) throws DOMException, SVGException { return (SVGPathSeg)initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg getItem ( int index ) throws DOMException { return (SVGPathSeg)getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg insertItemBefore ( SVGPathSeg newItem, int index ) throws DOMException, SVGException { return (SVGPathSeg)insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg replaceItem ( SVGPathSeg newItem, int index ) throws DOMException, SVGException { return (SVGPathSeg)replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg removeItem ( int index ) throws DOMException { return (SVGPathSeg)removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg appendItem ( SVGPathSeg newItem ) throws DOMException, SVGException { return (SVGPathSeg) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedInteger.java
public void setBaseVal(int baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedBoolean.java
public void setBaseVal(boolean baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength initialize(SVGLength newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength insertItemBefore(SVGLength newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength replaceItem(SVGLength newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength appendItem(SVGLength newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumber.java
public void setBaseVal(float baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setUseCurrentView(boolean useCurrentView) throws DOMException { throw new UnsupportedOperationException ("SVGSVGElement.setUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setCurrentScale(float currentScale) throws DOMException { SVGContext context = getSVGContext(); AffineTransform scrnTrans = context.getScreenTransform(); float scale = 1; if (scrnTrans != null) { scale = (float)Math.sqrt(scrnTrans.getDeterminant()); } float delta = currentScale/scale; // The way currentScale, currentTranslate are defined // changing scale has no effect on translate. scrnTrans = new AffineTransform (scrnTrans.getScaleX()*delta, scrnTrans.getShearY()*delta, scrnTrans.getShearX()*delta, scrnTrans.getScaleY()*delta, scrnTrans.getTranslateX(), scrnTrans.getTranslateY()); context.setScreenTransform(scrnTrans); }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void unsuspendRedraw(int suspend_handle_id) throws DOMException { SVGSVGContext ctx = (SVGSVGContext)getSVGContext(); if (!ctx.unsuspendRedraw(suspend_handle_id)) { throw createDOMException (DOMException.NOT_FOUND_ERR, "invalid.suspend.handle", new Object[] { new Integer(suspend_handle_id) }); } }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public Event createEvent(String eventType) throws DOMException { return ((DocumentEvent)getOwnerDocument()).createEvent(eventType); }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public boolean canDispatch(String namespaceURI, String type) throws DOMException { AbstractDocument doc = (AbstractDocument) getOwnerDocument(); return doc.canDispatch(namespaceURI, type); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setGlyphRef(String glyphRef) throws DOMException { setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setFormat(String format) throws DOMException { setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setX(float x) throws DOMException { setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf(x)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setY(float y) throws DOMException { setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf(y)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setDx(float dx) throws DOMException { setAttributeNS(null, SVG_DX_ATTRIBUTE, String.valueOf(dx)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setDy(float dy) throws DOMException { setAttributeNS(null, SVG_DY_ATTRIBUTE, String.valueOf(dy)); }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public static SVGPoint getPointAtLength(final SVGOMPathElement path, final float distance) { final SVGPathContext pathCtx = (SVGPathContext)path.getSVGContext(); if (pathCtx == null) return null; return new SVGPoint() { public float getX() { Point2D pt = pathCtx.getPointAtLength(distance); return (float)pt.getX(); } public float getY() { Point2D pt = pathCtx.getPointAtLength(distance); return (float)pt.getY(); } public void setX(float x) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } public void setY(float y) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } public SVGPoint matrixTransform ( SVGMatrix matrix ) { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public void setX(float x) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public void setY(float y) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAltGlyphElement.java
public void setGlyphRef(String glyphRef) throws DOMException { setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef); }
// in sources/org/apache/batik/dom/svg/SVGOMAltGlyphElement.java
public void setFormat(String format) throws DOMException { setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format); }
// in sources/org/apache/batik/dom/svg/SVGOMScriptElement.java
public void setType(String type) throws DOMException { setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform initialize(SVGTransform newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform insertItemBefore(SVGTransform newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform replaceItem(SVGTransform newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform appendItem(SVGTransform newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
public void setXMLbase(String xmlbase) throws DOMException { setAttributeNS(XML_NAMESPACE_URI, XML_BASE_QNAME, xmlbase); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/dom/svg/SVGStyleSheetProcessingInstruction.java
public void setData(String data) throws DOMException { super.setData(data); styleSheet = null; }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Element createElement(String tagName) throws DOMException { return new GenericElement(tagName.intern(), this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public CDATASection createCDATASection(String data) throws DOMException { return new GenericCDATASection(data, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { if ("xml-stylesheet".equals(target)) { return new SVGStyleSheetProcessingInstruction (data, this, (StyleSheetFactory)getImplementation()); } return new GenericProcessingInstruction(target, data, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Attr createAttribute(String name) throws DOMException { return new GenericAttr(name.intern(), this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public EntityReference createEntityReference(String name) throws DOMException { return new GenericEntityReference(name, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI == null) { return new GenericAttr(qualifiedName.intern(), this); } else { return new GenericAttrNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { SVGDOMImplementation impl = (SVGDOMImplementation)implementation; return impl.createElementNS(this, namespaceURI, qualifiedName); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint initialize(SVGPoint newItem) throws DOMException, SVGException { return (SVGPoint) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint getItem(int index) throws DOMException { return (SVGPoint) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint insertItemBefore(SVGPoint newItem, int index) throws DOMException, SVGException { return (SVGPoint) insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint replaceItem(SVGPoint newItem, int index) throws DOMException, SVGException { return (SVGPoint) replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint removeItem(int index) throws DOMException { return (SVGPoint) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint appendItem(SVGPoint newItem) throws DOMException, SVGException { return (SVGPoint) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getPoints().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint initialize(SVGPoint newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint insertItemBefore(SVGPoint newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint replaceItem(SVGPoint newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint appendItem(SVGPoint newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getPathSegList().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg initialize(SVGPathSeg newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg insertItemBefore(SVGPathSeg newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg replaceItem(SVGPathSeg newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg appendItem(SVGPathSeg newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform initialize(SVGTransform newItem) throws DOMException, SVGException { return (SVGTransform) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform getItem(int index) throws DOMException { return (SVGTransform) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform insertItemBefore(SVGTransform newItem, int index) throws DOMException, SVGException { return (SVGTransform) insertItemBeforeImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform replaceItem(SVGTransform newItem, int index) throws DOMException, SVGException { return (SVGTransform) replaceItemImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform removeItem(int index) throws DOMException { return (SVGTransform) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform appendItem(SVGTransform newItem) throws DOMException, SVGException { return (SVGTransform) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
protected SVGMatrix createMatrix() { return new AbstractSVGMatrix() { protected AffineTransform getAffineTransform() { return SVGTransformItem.this.affineTransform; } public void setA(float a) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setA(a); SVGTransformItem.this.resetAttribute(); } public void setB(float b) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setB(b); SVGTransformItem.this.resetAttribute(); } public void setC(float c) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setC(c); SVGTransformItem.this.resetAttribute(); } public void setD(float d) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setD(d); SVGTransformItem.this.resetAttribute(); } public void setE(float e) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setE(e); SVGTransformItem.this.resetAttribute(); } public void setF(float f) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setF(f); SVGTransformItem.this.resetAttribute(); } }; }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setA(float a) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setA(a); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setB(float b) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setB(b); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setC(float c) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setC(c); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setD(float d) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setD(d); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setE(float e) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setE(e); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setF(float f) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setF(f); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setX(float x) throws DOMException { this.x = x; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setY(float y) throws DOMException { this.y = y; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setWidth(float width) throws DOMException { this.w = width; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setHeight(float height) throws DOMException { this.h = height; }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public static SVGRect getBBox(Element elt) { final SVGOMElement svgelt = (SVGOMElement)elt; SVGContext svgctx = svgelt.getSVGContext(); if (svgctx == null) return null; if (svgctx.getBBox() == null) return null; return new SVGRect() { public float getX() { return (float)svgelt.getSVGContext().getBBox().getX(); } public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getY() { return (float)svgelt.getSVGContext().getBBox().getY(); } public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getWidth() { return (float)svgelt.getSVGContext().getBBox().getWidth(); } public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getHeight() { return (float)svgelt.getSVGContext().getBBox().getHeight(); } public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedString.java
public void setBaseVal(String baseVal) throws DOMException { element.setAttributeNS(namespaceURI, localName, baseVal); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber appendItem(SVGNumber newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public float getSubStringLength(int charnum, int nchars) throws DOMException { return SVGTextContentSupport.getSubStringLength(this, charnum, nchars); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGPoint getStartPositionOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getStartPositionOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGPoint getEndPositionOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getEndPositionOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGRect getExtentOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getExtentOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public float getRotationOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getRotationOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public void selectSubString(int charnum, int nchars) throws DOMException { SVGTextContentSupport.selectSubString(this, charnum, nchars); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
protected SVGMatrix createMatrix() { return new AbstractSVGMatrix() { protected AffineTransform getAffineTransform() { return SVGOMTransform.this.affineTransform; } public void setA(float a) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setA(a); } public void setB(float b) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setB(b); } public void setC(float c) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setC(c); } public void setD(float d) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setD(d); } public void setE(float e) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setE(e); } public void setF(float f) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setF(f); } }; }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setA(float a) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setA(a); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setB(float b) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setB(b); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setC(float c) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setC(c); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setD(float d) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setD(d); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setE(float e) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setE(e); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setF(float f) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setF(f); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
protected void setAttributeValue(String value) throws DOMException { try { changing = true; element.setAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, value); malformed = false; } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
protected void setAttributeValue(String value) throws DOMException { }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { Document result = new SVGOMDocument(doctype, this); // BUG 32108: return empty document if qualifiedName is null. if (qualifiedName != null) result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValue(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValueInSpecifiedUnits(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValueAsString(String value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setBaseVal(short baseVal) throws DOMException { if (baseVal == SVGMarkerElement.SVG_MARKER_ORIENT_AUTO) { baseEnumerationVal = baseVal; if (baseAngleVal == null) { baseAngleVal = new BaseSVGAngle(); } baseAngleVal.unitType = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; baseAngleVal.value = 0; baseAngleVal.reset(); } else if (baseVal == SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE) { baseEnumerationVal = baseVal; if (baseAngleVal == null) { baseAngleVal = new BaseSVGAngle(); } baseAngleVal.reset(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength initialize(SVGLength newItem) throws DOMException, SVGException { return (SVGLength) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength getItem(int index) throws DOMException { return (SVGLength) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength insertItemBefore(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) insertItemBeforeImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength replaceItem(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength removeItem(int index) throws DOMException { return (SVGLength) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength appendItem(SVGLength newItem) throws DOMException, SVGException { return (SVGLength) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractElement.java
public Node removeNamedItemNS( String namespaceURI, String localName ) throws DOMException { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( localName == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{""} ); } AbstractAttr n = (AbstractAttr)remove( namespaceURI, localName ); if ( n == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{localName} ); } n.setOwnerElement( null ); String prefix = n.getPrefix(); // Reset the attribute to its default value if ( !resetAttribute( namespaceURI, prefix, localName ) ) { // Mutation event fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); } return n; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
public void clear() throws DOMException { revalidate(); if (itemList != null) { // Remove all the items. clear(itemList); // Set the DOM attribute. resetAttribute(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem initializeImpl(Object newItem) throws DOMException, SVGException { checkItemType(newItem); // Clear the list, creating it if it doesn't exist yet. if (itemList == null) { itemList = new ArrayList(1); } else { clear(itemList); } SVGItem item = removeIfNeeded(newItem); // Add the item. itemList.add(item); // Set the item's parent. item.setParent(this); // Update the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem getItemImpl(int index) throws DOMException { revalidate(); if (index < 0 || itemList == null || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } return (SVGItem)itemList.get(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem insertItemBeforeImpl(Object newItem, int index) throws DOMException, SVGException { checkItemType(newItem); revalidate(); if (index < 0) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } if (index > itemList.size()) { index = itemList.size(); } SVGItem item = removeIfNeeded(newItem); // Insert the item at its position. itemList.add(index, item); // Set the item's parent. item.setParent(this); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem replaceItemImpl(Object newItem, int index) throws DOMException, SVGException { checkItemType(newItem); revalidate(); if (index < 0 || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } SVGItem item = removeIfNeeded(newItem); // Replace the item in the list. itemList.set(index, item); // Set the item's parent. item.setParent(this); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem removeItemImpl(int index) throws DOMException { revalidate(); if (index < 0 || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } SVGItem item = (SVGItem)itemList.remove(index); // Set the item to have no parent list. item.setParent(null); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem appendItemImpl(Object newItem) throws DOMException, SVGException { checkItemType(newItem); revalidate(); SVGItem item = removeIfNeeded(newItem); itemList.add(item); // Set the item's parent. item.setParent(this); if (itemList.size() <= 1) { resetAttribute(); } else { resetAttribute(item); } return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected void setValueAsString(List value) throws DOMException { String finalValue = null; Iterator it = value.iterator(); if (it.hasNext()) { SVGItem item = (SVGItem) it.next(); StringBuffer buf = new StringBuffer( value.size() * 8 ); buf.append( item.getValueAsString() ); while (it.hasNext()) { item = (SVGItem) it.next(); buf.append(getItemSeparator()); buf.append(item.getValueAsString()); } finalValue = buf.toString(); } setAttributeValue(finalValue); valid = true; }
// in sources/org/apache/batik/dom/svg/SVGOMPoint.java
public void setX(float x) throws DOMException { this.x = x; }
// in sources/org/apache/batik/dom/svg/SVGOMPoint.java
public void setY(float y) throws DOMException { this.y = y; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node insertBefore(Node newChild, Node refChild) throws DOMException { if ((refChild != null) && ((childNodes == null) || (refChild.getParentNode() != this))) throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(refChild.getNodeType()), refChild.getNodeName() }); checkAndRemove(newChild, false); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getFirstChild(); while (n != null) { Node ns = n.getNextSibling(); insertBefore(n, refChild); n = ns; } return newChild; } else { // Node modification if (childNodes == null) { childNodes = new ChildNodes(); } ExtendedNode n = childNodes.insert((ExtendedNode)newChild, (ExtendedNode)refChild); n.setParentNode(this); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; } }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if ((childNodes == null) || (oldChild.getParentNode() != this) ) throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(oldChild.getNodeType()), oldChild.getNodeName() }); checkAndRemove(newChild, true); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getLastChild(); if (n == null) return newChild; Node ps = n.getPreviousSibling(); replaceChild(n, oldChild); Node ns = n; n = ps; while (n != null) { ps = n.getPreviousSibling(); insertBefore(n, ns); ns = n; n = ps; } return newChild; } // Mutation event fireDOMNodeRemovedEvent(oldChild); getCurrentDocument().nodeToBeRemoved(oldChild); nodeToBeRemoved(oldChild); // Node modification ExtendedNode n = (ExtendedNode)newChild; ExtendedNode o = childNodes.replace(n, (ExtendedNode)oldChild); n.setParentNode(this); o.setParentNode(null); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node removeChild(Node oldChild) throws DOMException { if (childNodes == null || oldChild.getParentNode() != this) { throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(oldChild.getNodeType()), oldChild.getNodeName() }); } if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } // Mutation event fireDOMNodeRemovedEvent(oldChild); getCurrentDocument().nodeToBeRemoved(oldChild); nodeToBeRemoved(oldChild); // Node modification ExtendedNode result = childNodes.remove((ExtendedNode)oldChild); result.setParentNode(null); // Mutation event fireDOMSubtreeModifiedEvent(); return result; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node appendChild(Node newChild) throws DOMException { checkAndRemove(newChild, false); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getFirstChild(); while (n != null) { Node ns = n.getNextSibling(); appendChild(n); n = ns; } return newChild; } else { if (childNodes == null) childNodes = new ChildNodes(); // Node modification ExtendedNode n = childNodes.append((ExtendedNode)newChild); n.setParentNode(this); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; } }
// in sources/org/apache/batik/dom/traversal/TraversalSupport.java
public NodeIterator createNodeIterator(AbstractDocument doc, Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { if (root == null) { throw doc.createDOMException (DOMException.NOT_SUPPORTED_ERR, "null.root", null); } NodeIterator result = new DOMNodeIterator(doc, root, whatToShow, filter, entityReferenceExpansion); if (iterators == null) { iterators = new LinkedList(); } iterators.add(result); return result; }
// in sources/org/apache/batik/dom/events/DocumentEventSupport.java
public Event createEvent(String eventType) throws DOMException { EventFactory ef = (EventFactory)eventFactories.get(eventType.toLowerCase()); if (ef == null) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Bad event type: " + eventType); } return ef.createEvent(); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Element createElement(String tagName) throws DOMException { return new GenericElement(tagName.intern(), this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public CDATASection createCDATASection(String data) throws DOMException { return new GenericCDATASection(data, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { return new GenericProcessingInstruction(target, data, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Attr createAttribute(String name) throws DOMException { return new GenericAttr(name.intern(), this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public EntityReference createEntityReference(String name) throws DOMException { return new GenericEntityReference(name, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (namespaceURI == null) { return new GenericElement(qualifiedName.intern(), this); } else { return new GenericElementNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/GenericDocument.java
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (namespaceURI == null) { return new GenericAttr(qualifiedName.intern(), this); } else { return new GenericAttrNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String getNodeValue() throws DOMException { return nodeValue; }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } // Node modification String val = this.nodeValue; this.nodeValue = (nodeValue == null) ? "" : nodeValue; // Mutation event fireDOMCharacterDataModifiedEvent(val, this.nodeValue); if (getParentNode() != null) { ((AbstractParentNode)getParentNode()). fireDOMSubtreeModifiedEvent(); } }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String getData() throws DOMException { return getNodeValue(); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void setData(String data) throws DOMException { setNodeValue(data); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String substringData(int offset, int count) throws DOMException { checkOffsetCount(offset, count); String v = getNodeValue(); return v.substring(offset, Math.min(v.length(), offset + count)); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void appendData(String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } setNodeValue(getNodeValue() + ((arg == null) ? "" : arg)); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void insertData(int offset, String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (offset < 0 || offset > getLength()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } String v = getNodeValue(); setNodeValue(v.substring(0, offset) + arg + v.substring(offset, v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void deleteData(int offset, int count) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } checkOffsetCount(offset, count); String v = getNodeValue(); setNodeValue(v.substring(0, offset) + v.substring(Math.min(v.length(), offset + count), v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void replaceData(int offset, int count, String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } checkOffsetCount(offset, count); String v = getNodeValue(); setNodeValue(v.substring(0, offset) + arg + v.substring(Math.min(v.length(), offset + count), v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
protected void checkOffsetCount(int offset, int count) throws DOMException { if (offset < 0 || offset >= getLength()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } if (count < 0) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "negative.count", new Object[] { new Integer(count) }); } }
// in sources/org/apache/batik/dom/StyleSheetProcessingInstruction.java
public void setData(String data) throws DOMException { super.setData(data); sheet = null; pseudoAttributes = null; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setAttribute(String name, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } Attr attr = getAttributeNode(name); if (attr == null) { attr = getOwnerDocument().createAttribute(name); attr.setValue(value); attributes.setNamedItem(attr); } else { attr.setValue(value); } }
// in sources/org/apache/batik/dom/AbstractElement.java
public void removeAttribute(String name) throws DOMException { if (!hasAttribute(name)) { return; } attributes.removeNamedItem(name); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr setAttributeNode(Attr newAttr) throws DOMException { if (newAttr == null) { return null; } if (attributes == null) { attributes = createAttributes(); } return (Attr)attributes.setNamedItemNS(newAttr); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } if (attributes == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { oldAttr.getName() }); } String nsURI = oldAttr.getNamespaceURI(); return (Attr)attributes.removeNamedItemNS(nsURI, (nsURI==null ? oldAttr.getNodeName() : oldAttr.getLocalName())); }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName); if (attr == null) { attr = getOwnerDocument().createAttributeNS(namespaceURI, qualifiedName); attr.setValue(value); attributes.setNamedItemNS(attr); } else { attr.setValue(value); } }
// in sources/org/apache/batik/dom/AbstractElement.java
public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (!hasAttributeNS(namespaceURI, localName)) { return; } attributes.removeNamedItemNS(namespaceURI, localName); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { if (newAttr == null) { return null; } if (attributes == null) { attributes = createAttributes(); } return (Attr)attributes.setNamedItemNS(newAttr); }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttribute(String name, boolean isId) throws DOMException { AbstractAttr a = (AbstractAttr) getAttributeNode(name); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { name }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { name }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttributeNS( String ns, String ln, boolean isId ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } AbstractAttr a = (AbstractAttr)getAttributeNodeNS( ns, ln ); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { ns, ln }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttributeNode( Attr attr, boolean isId ) throws DOMException { AbstractAttr a = (AbstractAttr)attr; if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItem( Node arg ) throws DOMException { if ( arg == null ) { return null; } checkNode( arg ); return setNamedItem( null, arg.getNodeName(), arg ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node removeNamedItem( String name ) throws DOMException { return removeNamedItemNS( null, name ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItemNS( Node arg ) throws DOMException { if ( arg == null ) { return null; } String nsURI = arg.getNamespaceURI(); return setNamedItem( nsURI, ( nsURI == null ) ? arg.getNodeName() : arg.getLocalName(), arg ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node removeNamedItemNS( String namespaceURI, String localName ) throws DOMException { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( localName == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{""} ); } if ( namespaceURI != null && namespaceURI.length() == 0 ) { namespaceURI = null; } AbstractAttr n = (AbstractAttr)remove( namespaceURI, localName ); if ( n == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{localName} ); } n.setOwnerElement( null ); // Mutation event fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n; }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItem( String ns, String name, Node arg ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } ( (AbstractAttr)arg ).setOwnerElement( AbstractElement.this ); AbstractAttr result = (AbstractAttr)put( ns, name, arg ); if ( result != null ) { result.setOwnerElement( null ); fireDOMAttrModifiedEvent( name, result, result.getNodeValue(), "", MutationEvent.REMOVAL ); } fireDOMAttrModifiedEvent( name, (Attr)arg, "", arg.getNodeValue(), MutationEvent.ADDITION ); return result; }
// in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException (DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean beginElement() throws DOMException { timedElement.beginElement(); return timedElement.canBegin(); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean beginElementAt(float offset) throws DOMException { timedElement.beginElement(offset); // XXX Not right, but who knows if it is possible to begin // at some arbitrary point in the future. return true; }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean endElement() throws DOMException { timedElement.endElement(); return timedElement.canEnd(); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean endElementAt(float offset) throws DOMException { timedElement.endElement(offset); // XXX Not right, but who knows if it is possible to begin // at some arbitrary point in the future. return true; }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + text + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + text + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + text + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + text + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + text + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + text + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ")"; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0).getCssText() + ' ' + text; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0).getCssText() + ' ' + text + ' ' + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: textChanged(getValue().item(0).getCssText() + ' ' + rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_PAINTTYPE_CURRENTCOLOR: textChanged("currentcolor"); break; case SVG_PAINTTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorProfileChanged(String cp) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); sb.append(cp); iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsCleared() throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsInitialized(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorInsertedBefore(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorReplaced(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorRemoved(int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorAppend(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.floatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public float getFloatValue(short unitType) throws DOMException { return convertFloatValue(unitType, valueProvider.getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.stringValueChanged(stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void floatValueChanged(short unit, float value) throws DOMException { textChanged(FloatValue.getCssText(unit, value)); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void stringValueChanged(short type, String value) throws DOMException { textChanged(StringValue.getCssText(type, value)); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void leftTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + text + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void leftFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void topTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + text + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void topFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + FloatValue.getCssText(unit, value) + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void rightTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + text + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void rightFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void bottomTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + text + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void bottomFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void redTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + text + ", " + val.getGreen().getCssText() + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void redFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + val.getGreen().getCssText() + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void greenTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + val.getRed().getCssText() + ", " + text + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + val.getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void blueTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + val.getRed().getCssText() + ", " + val.getGreen().getCssText() + ", " + text + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + val.getRed().getCssText() + ", " + val.getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listTextChanged(int idx, String text) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(text); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } text = sb.toString(); textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listFloatValueChanged(int idx, short unit, float value) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(FloatValue.getCssText(unit, value)); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listStringValueChanged(int idx, short unit, String value) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(StringValue.getCssText(unit, value)); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public float getFloatValue(short unitType) throws DOMException { return convertFloatValue(unitType, getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listTextChanged(index, cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listFloatValueChanged(index, unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listStringValueChanged(index, stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setCssText(String cssText) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public String removeProperty(String propertyName) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { values = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public String removeProperty(String propertyName) throws DOMException { String result = getPropertyValue(propertyName); if (result.length() > 0) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (values != null) { values.remove(propertyName); } handler.propertyRemoved(propertyName); } } return result; }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.propertyChanged(propertyName, value, prio); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (values == null || values.get(this) == null || StyleDeclarationValue.this.handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColorProfile(String colorProfile) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorProfileChanged(colorProfile); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void clear() throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorsCleared(); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { float f = newItem.getValue(); iccColors = new ArrayList(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorsInitialized(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber getItem(int index) throws DOMException { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } Value value = valueProvider.getValue().item(1); float f = ((ICCColor)value).getColor(index); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); return result; }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index > n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(index, result); handler.colorInsertedBefore(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); handler.colorReplaced(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber removeItem(int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } SVGNumber result = null; if (iccColors != null) { result = (ColorNumber)iccColors.get(index); } if (result == null) { Value value = valueProvider.getValue().item(1); result = new ColorNumber(((ICCColor)value).getColor(index)); } handler.colorRemoved(index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber appendItem (SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (iccColors == null) { int n = getNumberOfItems(); iccColors = new ArrayList(n); for (int i = 0; i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorAppend(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append( value.getGreen().getCssText()); sb.append(','); sb.append( value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorChanged(String text) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_COLORTYPE_CURRENTCOLOR: textChanged(CSSConstants.CSS_CURRENTCOLOR_VALUE); break; case SVG_COLORTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorProfileChanged(String cp) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)value.item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsCleared() throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsInitialized(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorInsertedBefore(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorReplaced(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorRemoved(int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorAppend(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public float getFloatValue(short unitType) throws DOMException { return CSSOMValue.convertFloatValue(unitType, getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/svg12/MarginShorthandManager.java
public void setValues(CSSEngine eng, ShorthandManager.PropertyHandler ph, LexicalUnit lu, boolean imp) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) return; LexicalUnit []lus = new LexicalUnit[4]; int cnt=0; while (lu != null) { if (cnt == 4) throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); lus[cnt++] = lu; lu = lu.getNextLexicalUnit(); } switch (cnt) { case 1: lus[3] = lus[2] = lus[1] = lus[0]; break; case 2: lus[2] = lus[0]; lus[3] = lus[1]; break; case 3: lus[3] = lus[1]; break; default: } ph.property(SVG12CSSConstants.CSS_MARGIN_TOP_PROPERTY, lus[0], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_RIGHT_PROPERTY, lus[1], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_BOTTOM_PROPERTY, lus[2], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_LEFT_PROPERTY, lus[3], imp); }
// in sources/org/apache/batik/css/engine/value/svg12/LineHeightManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVG12ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: { String s = lu.getStringValue().toLowerCase(); if (SVG12CSSConstants.CSS_NORMAL_VALUE.equals(s)) return SVG12ValueConstants.NORMAL_VALUE; throw createInvalidIdentifierDOMException(lu.getStringValue()); } default: return super.createValue(lu, engine); } }
// in sources/org/apache/batik/css/engine/value/svg12/MarginLengthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/LengthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_EM: return new FloatValue(CSSPrimitiveValue.CSS_EMS, lu.getFloatValue()); case LexicalUnit.SAC_EX: return new FloatValue(CSSPrimitiveValue.CSS_EXS, lu.getFloatValue()); case LexicalUnit.SAC_PIXEL: return new FloatValue(CSSPrimitiveValue.CSS_PX, lu.getFloatValue()); case LexicalUnit.SAC_CENTIMETER: return new FloatValue(CSSPrimitiveValue.CSS_CM, lu.getFloatValue()); case LexicalUnit.SAC_MILLIMETER: return new FloatValue(CSSPrimitiveValue.CSS_MM, lu.getFloatValue()); case LexicalUnit.SAC_INCH: return new FloatValue(CSSPrimitiveValue.CSS_IN, lu.getFloatValue()); case LexicalUnit.SAC_POINT: return new FloatValue(CSSPrimitiveValue.CSS_PT, lu.getFloatValue()); case LexicalUnit.SAC_PICA: return new FloatValue(CSSPrimitiveValue.CSS_PC, lu.getFloatValue()); case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/LengthManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_PERCENTAGE: case CSSPrimitiveValue.CSS_EMS: case CSSPrimitiveValue.CSS_EXS: case CSSPrimitiveValue.CSS_PX: case CSSPrimitiveValue.CSS_CM: case CSSPrimitiveValue.CSS_MM: case CSSPrimitiveValue.CSS_IN: case CSSPrimitiveValue.CSS_PT: case CSSPrimitiveValue.CSS_PC: case CSSPrimitiveValue.CSS_NUMBER: return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getTop() throws DOMException { return top; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getRight() throws DOMException { return right; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getBottom() throws DOMException { return bottom; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getLeft() throws DOMException { return left; }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return InheritValue.INSTANCE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return ValueConstants.AUTO_VALUE; } } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (!value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { throw createInvalidIdentifierDOMException(value); } return ValueConstants.AUTO_VALUE; }
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } ListValue lv = new ListValue(' '); do { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { String s = lu.getStringValue().toLowerCase().intern(); Object obj = values.get(s); if (obj == null) { throw createInvalidIdentifierDOMException (lu.getStringValue()); } lv.append((Value)obj); lu = lu.getNextLexicalUnit(); } else { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } } while (lu != null); return lv; } throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (!value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { throw createInvalidIdentifierDOMException(value); } return ValueConstants.NONE_VALUE; }
// in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: case LexicalUnit.SAC_STRING_VALUE: } ListValue result = new ListValue(); for (;;) { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_STRING_VALUE: result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, lu.getStringValue())); lu = lu.getNextLexicalUnit(); break; case LexicalUnit.SAC_IDENT: StringBuffer sb = new StringBuffer(lu.getStringValue()); lu = lu.getNextLexicalUnit(); if (lu != null && isIdentOrNumber(lu)) { do { sb.append(' '); switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: sb.append(lu.getStringValue()); break; case LexicalUnit.SAC_INTEGER: //Some font names contain integer values but are not quoted! //Example: "Univers 45 Light" sb.append(Integer.toString(lu.getIntegerValue())); } lu = lu.getNextLexicalUnit(); } while (lu != null && isIdentOrNumber(lu)); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); Value v = (Value)values.get(s); result.append((v != null) ? v : new StringValue (CSSPrimitiveValue.CSS_STRING, id)); } } if (lu == null) return result; if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); lu = lu.getNextLexicalUnit(); if (lu == null) throw createMalformedLexicalUnitDOMException(); } }
// in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: case LexicalUnit.SAC_STRING_VALUE: case LexicalUnit.SAC_URI: } ListValue result = new ListValue(); for (;;) { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_STRING_VALUE: result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, lu.getStringValue())); lu = lu.getNextLexicalUnit(); break; case LexicalUnit.SAC_URI: String uri = resolveURI(engine.getCSSBaseURI(), lu.getStringValue()); result.append(new URIValue(lu.getStringValue(), uri)); lu = lu.getNextLexicalUnit(); if ((lu != null) && (lu.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION)) { if (!lu.getFunctionName().equalsIgnoreCase("format")) { break; } // Format really does us no good so just ignore it. // TODO: Should probably turn this into a ListValue // and append the format function CSS Value. lu = lu.getNextLexicalUnit(); } break; case LexicalUnit.SAC_IDENT: StringBuffer sb = new StringBuffer(lu.getStringValue()); lu = lu.getNextLexicalUnit(); if (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { do { sb.append(' '); sb.append(lu.getStringValue()); lu = lu.getNextLexicalUnit(); } while (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); Value v = (Value)values.get(s); result.append((v != null) ? v : new StringValue (CSSPrimitiveValue.CSS_STRING, id)); } break; } if (lu == null) { return result; } if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } } }
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { ListValue result = new ListValue(); switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: do { result.append(new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue()))); lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } } while (lu.getLexicalUnitType() == LexicalUnit.SAC_URI); if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } // Fall through... case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } result.append((Value)v); lu = lu.getNextLexicalUnit(); } if (lu != null) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } return result; }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s); } return (Value)v; default: break; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INTEGER) { int i = lu.getIntegerValue(); switch (i) { case 100: return ValueConstants.NUMBER_100; case 200: return ValueConstants.NUMBER_200; case 300: return ValueConstants.NUMBER_300; case 400: return ValueConstants.NUMBER_400; case 500: return ValueConstants.NUMBER_500; case 600: return ValueConstants.NUMBER_600; case 700: return ValueConstants.NUMBER_700; case 800: return ValueConstants.NUMBER_800; case 900: return ValueConstants.NUMBER_900; } throw createInvalidFloatValueDOMException(i); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { int i = (int)floatValue; if (floatValue == i) { switch (i) { case 100: return ValueConstants.NUMBER_100; case 200: return ValueConstants.NUMBER_200; case 300: return ValueConstants.NUMBER_300; case 400: return ValueConstants.NUMBER_400; case 500: return ValueConstants.NUMBER_500; case 600: return ValueConstants.NUMBER_600; case 700: return ValueConstants.NUMBER_700; case 800: return ValueConstants.NUMBER_800; case 900: return ValueConstants.NUMBER_900; } } } throw createInvalidFloatValueDOMException(floatValue); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR) { lu = lu.getParameters(); Value red = createColorComponent(lu); lu = lu.getNextLexicalUnit().getNextLexicalUnit(); Value green = createColorComponent(lu); lu = lu.getNextLexicalUnit().getNextLexicalUnit(); Value blue = createColorComponent(lu); return createRGBColor(red, green, blue); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
protected Value createColorComponent(LexicalUnit lu) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createInvalidRGBComponentUnitDOMException (lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getRed() throws DOMException { return red; }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getGreen() throws DOMException { return green; }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getBlue() throws DOMException { return blue; }
// in sources/org/apache/batik/css/engine/value/StringValue.java
public String getStringValue() throws DOMException { return value; }
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } }
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { if (unitType == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(unitType, floatValue); } throw createInvalidFloatTypeDOMException(unitType); }
// in sources/org/apache/batik/css/engine/value/svg/StrokeWidthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); default: ListValue lv = new ListValue(' '); do { Value v = super.createValue(lu, engine); lv.append(v); lu = lu.getNextLexicalUnit(); if (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA) { lu = lu.getNextLexicalUnit(); } } while (lu != null); return lv; } }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: String id = lu.getStringValue().toLowerCase().intern(); if (id == CSSConstants.CSS_ACCUMULATE_VALUE) { return SVGValueConstants.ACCUMULATE_VALUE; } if (id != CSSConstants.CSS_NEW_VALUE) { throw createInvalidIdentifierDOMException(id); } ListValue result = new ListValue(' '); result.append(SVGValueConstants.NEW_VALUE); lu = lu.getNextLexicalUnit(); if (lu == null) { return result; } result.append(super.createValue(lu, engine)); for (int i = 1; i < 4; i++) { lu = lu.getNextLexicalUnit(); if (lu == null){ throw createMalformedLexicalUnitDOMException(); } result.append(super.createValue(lu, engine)); } return result; } }
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type == CSSPrimitiveValue.CSS_IDENT) { if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); } if (type == CSSPrimitiveValue.CSS_URI) { return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: Object v = values.get(lu.getStringValue().toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } return (Value)v; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_CURRENTCOLOR_VALUE)) { return SVGValueConstants.CURRENTCOLOR_VALUE; } } Value v = super.createValue(lu, engine); lu = lu.getNextLexicalUnit(); if (lu == null) { return v; } if (lu.getLexicalUnitType() != LexicalUnit.SAC_FUNCTION || !lu.getFunctionName().equalsIgnoreCase("icc-color")) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getParameters(); if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } ListValue result = new ListValue(' '); result.append(v); ICCColor icc = new ICCColor(lu.getStringValue()); result.append(icc); lu = lu.getNextLexicalUnit(); while (lu != null) { if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createInvalidLexicalUnitDOMException((short)-1); } icc.append(getColorValue(lu)); lu = lu.getNextLexicalUnit(); } return result; }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDashoffsetManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/SVGPaintManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } // Fall through default: return super.createValue(lu, engine); case LexicalUnit.SAC_URI: } String value = lu.getStringValue(); String uri = resolveURI(engine.getCSSBaseURI(), value); lu = lu.getNextLexicalUnit(); if (lu == null) { return new URIValue(value, uri); } ListValue result = new ListValue(' '); result.append(new URIValue(value, uri)); if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { result.append(SVGValueConstants.NONE_VALUE); return result; } } Value v = super.createValue(lu, engine); if (v.getCssValueType() == CSSValue.CSS_CUSTOM) { ListValue lv = (ListValue)v; for (int i = 0; i < lv.getLength(); i++) { result.append(lv.item(i)); } } else { result.append(v); } return result; }
// in sources/org/apache/batik/css/engine/value/svg/MarkerShorthandManager.java
public void setValues(CSSEngine eng, ShorthandManager.PropertyHandler ph, LexicalUnit lu, boolean imp) throws DOMException { ph.property(CSSConstants.CSS_MARKER_END_PROPERTY, lu, imp); ph.property(CSSConstants.CSS_MARKER_MID_PROPERTY, lu, imp); ph.property(CSSConstants.CSS_MARKER_START_PROPERTY, lu, imp); }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public String getColorProfile() throws DOMException { return colorProfile; }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public int getNumberOfColors() throws DOMException { return count; }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public float getColor(int i) throws DOMException { return colors[i]; }
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase(); if (s.equals(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } if (s.equals(CSSConstants.CSS_SRGB_VALUE)) { return SVGValueConstants.SRGB_VALUE; } return new StringValue(CSSPrimitiveValue.CSS_IDENT, s); case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: String s = value.toLowerCase(); if (s.equals(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } if (s.equals(CSSConstants.CSS_SRGB_VALUE)) { return SVGValueConstants.SRGB_VALUE; } return new StringValue(CSSPrimitiveValue.CSS_IDENT, s); case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NORMAL_VALUE)) { return SVGValueConstants.NORMAL_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NORMAL_VALUE)) { return SVGValueConstants.NORMAL_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_DEGREE: return new FloatValue(CSSPrimitiveValue.CSS_DEG, lu.getFloatValue()); case LexicalUnit.SAC_GRADIAN: return new FloatValue(CSSPrimitiveValue.CSS_GRAD, lu.getFloatValue()); case LexicalUnit.SAC_RADIAN: return new FloatValue(CSSPrimitiveValue.CSS_RAD, lu.getFloatValue()); // For SVG angle properties unit defaults to 'deg'. case LexicalUnit.SAC_INTEGER: { int n = lu.getIntegerValue(); return new FloatValue(CSSPrimitiveValue.CSS_DEG, n); } case LexicalUnit.SAC_REAL: { float n = lu.getFloatValue(); return new FloatValue(CSSPrimitiveValue.CSS_DEG, n); } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_DEG: case CSSPrimitiveValue.CSS_GRAD: case CSSPrimitiveValue.CSS_RAD: return new FloatValue(type, floatValue); } throw createInvalidFloatValueDOMException(floatValue); }
// in sources/org/apache/batik/css/engine/value/ListValue.java
public int getLength() throws DOMException { return length; }
// in sources/org/apache/batik/css/engine/value/ListValue.java
public Value item(int index) throws DOMException { return items[index]; }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public float getFloatValue() throws DOMException { return computedValue.getFloatValue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getStringValue() throws DOMException { return computedValue.getStringValue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getRed() throws DOMException { return computedValue.getRed(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getGreen() throws DOMException { return computedValue.getGreen(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getBlue() throws DOMException { return computedValue.getBlue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public int getLength() throws DOMException { return computedValue.getLength(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value item(int index) throws DOMException { return computedValue.item(index); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getTop() throws DOMException { return computedValue.getTop(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getRight() throws DOMException { return computedValue.getRight(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getBottom() throws DOMException { return computedValue.getBottom(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getLeft() throws DOMException { return computedValue.getLeft(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getIdentifier() throws DOMException { return computedValue.getIdentifier(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getListStyle() throws DOMException { return computedValue.getListStyle(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getSeparator() throws DOMException { return computedValue.getSeparator(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public float getFloatValue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getStringValue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getRed() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getGreen() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getBlue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public int getLength() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value item(int index) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getTop() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getRight() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getBottom() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getLeft() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getIdentifier() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getListStyle() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getSeparator() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/RectManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_FUNCTION: if (!lu.getFunctionName().equalsIgnoreCase("rect")) { break; } case LexicalUnit.SAC_RECT_FUNCTION: lu = lu.getParameters(); Value top = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value right = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value bottom = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value left = createRectComponent(lu); return new RectValue(top, right, bottom, left); } throw createMalformedRectDOMException(); }
// in sources/org/apache/batik/css/engine/value/RectManager.java
private Value createRectComponent(LexicalUnit lu) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return ValueConstants.AUTO_VALUE; } break; case LexicalUnit.SAC_EM: return new FloatValue(CSSPrimitiveValue.CSS_EMS, lu.getFloatValue()); case LexicalUnit.SAC_EX: return new FloatValue(CSSPrimitiveValue.CSS_EXS, lu.getFloatValue()); case LexicalUnit.SAC_PIXEL: return new FloatValue(CSSPrimitiveValue.CSS_PX, lu.getFloatValue()); case LexicalUnit.SAC_CENTIMETER: return new FloatValue(CSSPrimitiveValue.CSS_CM, lu.getFloatValue()); case LexicalUnit.SAC_MILLIMETER: return new FloatValue(CSSPrimitiveValue.CSS_MM, lu.getFloatValue()); case LexicalUnit.SAC_INCH: return new FloatValue(CSSPrimitiveValue.CSS_IN, lu.getFloatValue()); case LexicalUnit.SAC_POINT: return new FloatValue(CSSPrimitiveValue.CSS_PT, lu.getFloatValue()); case LexicalUnit.SAC_PICA: return new FloatValue(CSSPrimitiveValue.CSS_PC, lu.getFloatValue()); case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createMalformedRectDOMException(); }
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = getIdentifiers().get(s); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } return (Value)v; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } }
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = getIdentifiers().get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, uri); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(InputSource is, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); parseStyleSheet(ss, is, uri); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void parseStyleSheet(StyleSheet ss, ParsedURL uri) throws DOMException { if (uri == null) { String s = Messages.formatMessage ("syntax.error.at", new Object[] { "Null Document reference", "" }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return; } try { // Check that access to the uri is allowed cssContext.checkLoadExternalResource(uri, documentURI); parseStyleSheet(ss, new InputSource(uri.toString()), uri); } catch (SecurityException e) { throw e; } catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(String rules, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, rules, uri); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void parseStyleSheet(StyleSheet ss, String rules, ParsedURL uri) throws DOMException { try { parseStyleSheet(ss, new InputSource(new StringReader(rules)), uri); } catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } }
(Lib) RuntimeException 114
              
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected JFrame getDebugFrame() { try { return (JFrame) debuggerMethods[GET_DEBUG_FRAME_METHOD].invoke (debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected void setExitAction(Runnable r) { try { debuggerMethods[SET_EXIT_ACTION_METHOD].invoke (debuggerInstance, new Object[] { r }); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void attachTo(Object contextFactory) { try { debuggerMethods[ATTACH_TO_METHOD].invoke (debuggerInstance, new Object[] { contextFactory }); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void detach() { try { debuggerMethods[DETACH_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void go() { try { debuggerMethods[GO_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void clearAllBreakpoints() { try { debuggerMethods[CLEAR_ALL_BREAKPOINTS_METHOD].invoke (debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void dispose() { try { debuggerMethods[DISPOSE_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected Object getContextFactory(Object rhinoInterpreter) { try { return getContextFactoryMethod.invoke(rhinoInterpreter, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private static final Raster decodeJPEG(byte[] data, JPEGDecodeParam decodeParam, boolean colorConvert, int minX, int minY) { // Create an InputStream from the compressed data array. ByteArrayInputStream jpegStream = new ByteArrayInputStream(data); // Create a decoder. JPEGImageDecoder decoder = decodeParam == null ? JPEGCodec.createJPEGDecoder(jpegStream) : JPEGCodec.createJPEGDecoder(jpegStream, decodeParam); // Decode the compressed data into a Raster. Raster jpegRaster; try { jpegRaster = colorConvert ? decoder.decodeAsBufferedImage().getWritableTile(0, 0) : decoder.decodeAsRaster(); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Translate the decoded Raster to the specified location and return. return jpegRaster.createTranslatedChild(minX, minY); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private final void inflate(byte[] deflated, byte[] inflated) { inflater.setInput(deflated); try { inflater.inflate(inflated); } catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); } inflater.reset(); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private long[] getFieldAsLongs(TIFFField field) { long[] value = null; if(field.getType() == TIFFField.TIFF_SHORT) { char[] charValue = field.getAsChars(); value = new long[charValue.length]; for(int i = 0; i < charValue.length; i++) { value[i] = charValue[i] & 0xffff; } } else if(field.getType() == TIFFField.TIFF_LONG) { value = field.getAsLongs(); } else { throw new RuntimeException(); } return value; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public synchronized Raster getTile(int tileX, int tileY) { if ((tileX < 0) || (tileX >= tilesX) || (tileY < 0) || (tileY >= tilesY)) { throw new IllegalArgumentException("TIFFImage12"); } // System.out.println("Called TIFF getTile:" + tileX + "," + tileY); // Get the data array out of the DataBuffer byte[] bdata = null; short[] sdata = null; int[] idata = null; SampleModel sampleModel = getSampleModel(); WritableRaster tile = makeTile(tileX,tileY); DataBuffer buffer = tile.getDataBuffer(); int dataType = sampleModel.getDataType(); if (dataType == DataBuffer.TYPE_BYTE) { bdata = ((DataBufferByte)buffer).getData(); } else if (dataType == DataBuffer.TYPE_USHORT) { sdata = ((DataBufferUShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_SHORT) { sdata = ((DataBufferShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_INT) { idata = ((DataBufferInt)buffer).getData(); } // Variables used for swapping when converting from RGB to BGR byte bswap; short sswap; int iswap; // Save original file pointer position and seek to tile data location. long save_offset = 0; try { save_offset = stream.getFilePointer(); stream.seek(tileOffsets[tileY*tilesX + tileX]); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Number of bytes in this tile (strip) after compression. int byteCount = (int)tileByteCounts[tileY*tilesX + tileX]; // Find out the number of bytes in the current tile Rectangle newRect; if (!tiled) newRect = tile.getBounds(); else newRect = new Rectangle(tile.getMinX(), tile.getMinY(), tileWidth, tileHeight); int unitsInThisTile = newRect.width * newRect.height * numBands; // Allocate read buffer if needed. byte[] data = compression != COMP_NONE || imageType == TYPE_PALETTE ? new byte[byteCount] : null; // Read the data, uncompressing as needed. There are four cases: // bilevel, palette-RGB, 4-bit grayscale, and everything else. if(imageType == TYPE_BILEVEL) { // bilevel try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 8 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/8) * newRect.height; } else { bytesInThisTile = (newRect.width/8 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_FAX_G3_1D) { stream.readFully(data, 0, byteCount); decoder.decode1D(bdata, data, 0, newRect.height); } else if (compression == COMP_FAX_G3_2D) { stream.readFully(data, 0, byteCount); decoder.decode2D(bdata, data, 0, newRect.height, tiffT4Options); } else if (compression == COMP_FAX_G4_2D) { stream.readFully(data, 0, byteCount); decoder.decodeT6(bdata, data, 0, newRect.height, tiffT6Options); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else if(imageType == TYPE_PALETTE) { // palette-RGB if (sampleSize == 16) { if (decodePaletteAsShorts) { short[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Since unitsBeforeLookup is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply it by 2 in order to figure out // how many bytes we'll get after decompression. int entries = unitsBeforeLookup * 2; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; decodePackbits(data, entries, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_LZW) { // Read in all the compressed data for this tile stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; lzwDecoder.decode(data, byteArray, newRect.height); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; inflate(data, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_NONE) { // byteCount tells us how many bytes are there // in this tile, but we need to read in shorts, // which will take half the space, so while // allocating we divide byteCount by 2. tempData = new short[byteCount/2]; readShorts(byteCount/2, tempData); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } if (dataType == DataBuffer.TYPE_USHORT) { // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else if (dataType == DataBuffer.TYPE_SHORT) { // Expand the palette image into an rgb image with // short data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)cmapValue; // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)cmapValue; // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)cmapValue; } } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 8) { if (decodePaletteAsShorts) { byte[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; decodePackbits(data, unitsBeforeLookup, tempData); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); Raster tempTile = decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY()); int[] tempPixels = new int[unitsBeforeLookup]; tempTile.getPixels(tile.getMinX(), tile.getMinY(), tile.getWidth(), tile.getHeight(), tempPixels); tempData = new byte[unitsBeforeLookup]; for(int i = 0; i < unitsBeforeLookup; i++) { tempData[i] = (byte)tempPixels[i]; } } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = new byte[byteCount]; stream.readFully(tempData, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 4) { int padding = (newRect.width % 2 == 0) ? 0 : 1; int bytesPostDecoding = ((newRect.width/2 + padding) * newRect.height); // Output short images if (decodePaletteAsShorts) { byte[] tempData = null; try { stream.readFully(data, 0, byteCount); stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // If compressed, decode the data. if (compression == COMP_PACKBITS) { tempData = new byte[bytesPostDecoding]; decodePackbits(data, bytesPostDecoding, tempData); } else if (compression == COMP_LZW) { tempData = new byte[bytesPostDecoding]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_DEFLATE) { tempData = new byte[bytesPostDecoding]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = data; } int bytes = unitsInThisTile / 3; // Unpack the 2 pixels packed into each byte. data = new byte[bytes]; int srcCount = 0, dstCount = 0; for (int j=0; j<newRect.height; j++) { for (int i=0; i<newRect.width/2; i++) { data[dstCount++] = (byte)((tempData[srcCount] & 0xf0) >> 4); data[dstCount++] = (byte)(tempData[srcCount++] & 0x0f); } if (padding == 1) { data[dstCount++] = (byte)((tempData[srcCount++] & 0xf0) >> 4); } } int len = colormap.length/3; int len2 = len*2; int cmapValue, lookup; int count = 0; for (int i=0; i<bytes; i++) { lookup = data[i] & 0xff; cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // Output byte values, use IndexColorModel for unpacking try { // If compressed, decode the data. if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, bytesPostDecoding, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } } else if(imageType == TYPE_GRAY_4BIT) { // 4-bit gray try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 2 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/2) * newRect.height; } else { bytesInThisTile = (newRect.width/2 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else { // everything else try { if (sampleSize == 8) { if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } } else if (sampleSize == 16) { if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } } else if (sampleSize == 32 && dataType == DataBuffer.TYPE_INT) { // redundant if (compression == COMP_NONE) { readInts(byteCount/4, idata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 4]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 4; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 4]; inflate(data, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Modify the data for certain special cases. switch(imageType) { case TYPE_GRAY: case TYPE_GRAY_ALPHA: if(isWhiteZero) { // Since we are using a ComponentColorModel with this // image, we need to change the WhiteIsZero data to // BlackIsZero data so it will display properly. if (dataType == DataBuffer.TYPE_BYTE && !(getColorModel() instanceof IndexColorModel)) { for (int l = 0; l < bdata.length; l += numBands) { bdata[l] = (byte)(255 - bdata[l]); } } else if (dataType == DataBuffer.TYPE_USHORT) { int ushortMax = Short.MAX_VALUE - Short.MIN_VALUE; for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(ushortMax - sdata[l]); } } else if (dataType == DataBuffer.TYPE_SHORT) { for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(~sdata[l]); } } else if (dataType == DataBuffer.TYPE_INT) { long uintMax = ((long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE); for (int l = 0; l < idata.length; l += numBands) { idata[l] = (int)(uintMax - idata[l]); } } } break; case TYPE_RGB: // Change RGB to BGR order, as Java2D displays that faster. // Unnecessary for JPEG-in-TIFF as the decoder handles it. if (sampleSize == 8 && compression != COMP_JPEG_TTN2) { for (int i=0; i<unitsInThisTile; i+=3) { bswap = bdata[i]; bdata[i] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=3) { sswap = sdata[i]; sdata[i] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=3) { iswap = idata[i]; idata[i] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_RGB_ALPHA: // Convert from RGBA to ABGR for Java2D if (sampleSize == 8) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A bswap = bdata[i]; bdata[i] = bdata[i+3]; bdata[i+3] = bswap; // Swap G and B bswap = bdata[i+1]; bdata[i+1] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A sswap = sdata[i]; sdata[i] = sdata[i+3]; sdata[i+3] = sswap; // Swap G and B sswap = sdata[i+1]; sdata[i+1] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A iswap = idata[i]; idata[i] = idata[i+3]; idata[i+3] = iswap; // Swap G and B iswap = idata[i+1]; idata[i+1] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_YCBCR_SUB: // Post-processing for YCbCr with subsampled chrominance: // simply replicate the chroma channels for displayability. int pixelsPerDataUnit = chromaSubH*chromaSubV; int numH = newRect.width/chromaSubH; int numV = newRect.height/chromaSubV; byte[] tempData = new byte[numH*numV*(pixelsPerDataUnit + 2)]; System.arraycopy(bdata, 0, tempData, 0, tempData.length); int samplesPerDataUnit = pixelsPerDataUnit*3; int[] pixels = new int[samplesPerDataUnit]; int bOffset = 0; int offsetCb = pixelsPerDataUnit; int offsetCr = offsetCb + 1; int y = newRect.y; for(int j = 0; j < numV; j++) { int x = newRect.x; for(int i = 0; i < numH; i++) { int Cb = tempData[bOffset + offsetCb]; int Cr = tempData[bOffset + offsetCr]; int k = 0; while(k < samplesPerDataUnit) { pixels[k++] = tempData[bOffset++]; pixels[k++] = Cb; pixels[k++] = Cr; } bOffset += 2; tile.setPixels(x, y, chromaSubH, chromaSubV, pixels); x += chromaSubH; } y += chromaSubV; } break; } } return tile; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private void readShorts(int shortCount, short[] shortArray) { // Since each short consists of 2 bytes, we need a // byte array of double size int byteCount = 2 * shortCount; byte[] byteArray = new byte[byteCount]; try { stream.readFully(byteArray, 0, byteCount); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } interpretBytesAsShorts(byteArray, shortArray, shortCount); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private void readInts(int intCount, int[] intArray) { // Since each int consists of 4 bytes, we need a // byte array of quadruple size int byteCount = 4 * intCount; byte[] byteArray = new byte[byteCount]; try { stream.readFully(byteArray, 0, byteCount); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } interpretBytesAsInts(byteArray, intArray, intCount); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private byte[] decodePackbits(byte[] data, int arraySize, byte[] dst) { if (dst == null) { dst = new byte[arraySize]; } int srcCount = 0, dstCount = 0; byte repeat, b; try { while (dstCount < arraySize) { b = data[srcCount++]; if (b >= 0 && b <= 127) { // literal run packet for (int i=0; i<(b + 1); i++) { dst[dstCount++] = data[srcCount++]; } } else if (b <= -1 && b >= -127) { // 2 byte encoded run packet repeat = data[srcCount++]; for (int i=0; i<(-b + 1); i++) { dst[dstCount++] = repeat; } } else { // no-op packet. Do nothing srcCount++; } } } catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); } return dst; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) { final String stdmeta = "javax_imageio_1.0"; if (meta.isStandardMetadataFormatSupported()) { IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(stdmeta); IIOMetadataNode dim = getChildNode(root, "Dimension"); IIOMetadataNode child; if (params.getResolution() != null) { child = getChildNode(dim, "HorizontalPixelSize"); if (child == null) { child = new IIOMetadataNode("HorizontalPixelSize"); dim.appendChild(child); } child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4)); child = getChildNode(dim, "VerticalPixelSize"); if (child == null) { child = new IIOMetadataNode("VerticalPixelSize"); dim.appendChild(child); } child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4)); } try { meta.mergeTree(stdmeta, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); } } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
Override protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) { //ImageIODebugUtil.dumpMetadata(meta); if (JPEG_NATIVE_FORMAT.equals(meta.getNativeMetadataFormatName())) { meta = addAdobeTransform(meta); IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(JPEG_NATIVE_FORMAT); IIOMetadataNode jv = getChildNode(root, "JPEGvariety"); if (jv == null) { jv = new IIOMetadataNode("JPEGvariety"); root.appendChild(jv); } IIOMetadataNode child; if (params.getResolution() != null) { child = getChildNode(jv, "app0JFIF"); if (child == null) { child = new IIOMetadataNode("app0JFIF"); jv.appendChild(child); } //JPEG gets special treatment because there seems to be a bug in //the JPEG codec in ImageIO converting the pixel size incorrectly //(or not at all) when using standard metadata format. child.setAttribute("majorVersion", null); child.setAttribute("minorVersion", null); child.setAttribute("resUnits", "1"); //dots per inch child.setAttribute("Xdensity", params.getResolution().toString()); child.setAttribute("Ydensity", params.getResolution().toString()); child.setAttribute("thumbWidth", null); child.setAttribute("thumbHeight", null); } try { meta.setFromTree(JPEG_NATIVE_FORMAT, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); } //ImageIODebugUtil.dumpMetadata(meta); } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
private static IIOMetadata addAdobeTransform(IIOMetadata meta) { // add the adobe transformation (transform 1 -> to YCbCr) IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(JPEG_NATIVE_FORMAT); IIOMetadataNode markerSequence = getChildNode(root, "markerSequence"); if (markerSequence == null) { throw new RuntimeException("Invalid metadata!"); } IIOMetadataNode adobeTransform = getChildNode(markerSequence, "app14Adobe"); if (adobeTransform == null) { adobeTransform = new IIOMetadataNode("app14Adobe"); adobeTransform.setAttribute("transform" , "1"); // convert RGB to YCbCr adobeTransform.setAttribute("version", "101"); adobeTransform.setAttribute("flags0", "0"); adobeTransform.setAttribute("flags1", "0"); markerSequence.appendChild(adobeTransform); } else { adobeTransform.setAttribute("transform" , "1"); } try { meta.setFromTree(JPEG_NATIVE_FORMAT, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void encode(RenderedImage im) throws IOException { this.image = im; this.width = image.getWidth(); this.height = image.getHeight(); SampleModel sampleModel = image.getSampleModel(); int[] sampleSize = sampleModel.getSampleSize(); // Set bitDepth to a sentinel value this.bitDepth = -1; this.bitShift = 0; // Allow user to override the bit depth of gray images if (param instanceof PNGEncodeParam.Gray) { PNGEncodeParam.Gray paramg = (PNGEncodeParam.Gray)param; if (paramg.isBitDepthSet()) { this.bitDepth = paramg.getBitDepth(); } if (paramg.isBitShiftSet()) { this.bitShift = paramg.getBitShift(); } } // Get bit depth from image if not set in param if (this.bitDepth == -1) { // Get bit depth from channel 0 of the image this.bitDepth = sampleSize[0]; // Ensure all channels have the same bit depth for (int i = 1; i < sampleSize.length; i++) { if (sampleSize[i] != bitDepth) { throw new RuntimeException(); } } // Round bit depth up to a power of 2 if (bitDepth > 2 && bitDepth < 4) { bitDepth = 4; } else if (bitDepth > 4 && bitDepth < 8) { bitDepth = 8; } else if (bitDepth > 8 && bitDepth < 16) { bitDepth = 16; } else if (bitDepth > 16) { throw new RuntimeException(); } } this.numBands = sampleModel.getNumBands(); this.bpp = numBands*((bitDepth == 16) ? 2 : 1); ColorModel colorModel = image.getColorModel(); if (colorModel instanceof IndexColorModel) { if (bitDepth < 1 || bitDepth > 8) { throw new RuntimeException(); } if (sampleModel.getNumBands() != 1) { throw new RuntimeException(); } IndexColorModel icm = (IndexColorModel)colorModel; int size = icm.getMapSize(); redPalette = new byte[size]; greenPalette = new byte[size]; bluePalette = new byte[size]; alphaPalette = new byte[size]; icm.getReds(redPalette); icm.getGreens(greenPalette); icm.getBlues(bluePalette); icm.getAlphas(alphaPalette); this.bpp = 1; if (param == null) { param = createGrayParam(redPalette, greenPalette, bluePalette, alphaPalette); } // If param is still null, it can't be expressed as gray if (param == null) { param = new PNGEncodeParam.Palette(); } if (param instanceof PNGEncodeParam.Palette) { // If palette not set in param, create one from the ColorModel. PNGEncodeParam.Palette parami = (PNGEncodeParam.Palette)param; if (parami.isPaletteSet()) { int[] palette = parami.getPalette(); size = palette.length/3; int index = 0; for (int i = 0; i < size; i++) { redPalette[i] = (byte)palette[index++]; greenPalette[i] = (byte)palette[index++]; bluePalette[i] = (byte)palette[index++]; alphaPalette[i] = (byte)255; } } this.colorType = PNG_COLOR_PALETTE; } else if (param instanceof PNGEncodeParam.Gray) { redPalette = greenPalette = bluePalette = alphaPalette = null; this.colorType = PNG_COLOR_GRAY; } else { throw new RuntimeException(); } } else if (numBands == 1) { if (param == null) { param = new PNGEncodeParam.Gray(); } this.colorType = PNG_COLOR_GRAY; } else if (numBands == 2) { if (param == null) { param = new PNGEncodeParam.Gray(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 1; if ((sampleSize[0] == 8) && (bitDepth < 8)) { compressGray = true; } bpp = (bitDepth == 16) ? 2 : 1; this.colorType = PNG_COLOR_GRAY; } else { if (this.bitDepth < 8) { this.bitDepth = 8; } this.colorType = PNG_COLOR_GRAY_ALPHA; } } else if (numBands == 3) { if (param == null) { param = new PNGEncodeParam.RGB(); } this.colorType = PNG_COLOR_RGB; } else if (numBands == 4) { if (param == null) { param = new PNGEncodeParam.RGB(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 3; bpp = (bitDepth == 16) ? 6 : 3; this.colorType = PNG_COLOR_RGB; } else { this.colorType = PNG_COLOR_RGB_ALPHA; } } interlace = param.getInterlacing(); writeMagic(); writeIHDR(); writeCHRM(); writeGAMA(); writeICCP(); writeSBIT(); writeSRGB(); writePLTE(); writeHIST(); writeTRNS(); writeBKGD(); writePHYS(); writeSPLT(); writeTIME(); writeTEXT(); writeZTXT(); writePrivateChunks(); writeIDAT(); writeIEND(); dataOutput.flush(); dataOutput.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitShift(int bitShift) { if (bitShift < 0) { throw new RuntimeException(); } this.bitShift = bitShift; bitShiftSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 8 && bitDepth != 16) { throw new RuntimeException(); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBackgroundRGB(int[] rgb) { if (rgb.length != 3) { throw new RuntimeException(); } backgroundRGB = rgb; backgroundSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void unsetBackground() { throw new RuntimeException(PropertyUtil.getString("PNGEncodeParam23")); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public boolean isBackgroundSet() { throw new RuntimeException(PropertyUtil.getString("PNGEncodeParam24")); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_IHDR_chunk(PNGChunk chunk) { tileWidth = width = chunk.getInt4(0); tileHeight = height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); if ((bitDepth != 1) && (bitDepth != 2) && (bitDepth != 4) && (bitDepth != 8) && (bitDepth != 16)) { // Error -- bad bit depth String msg = PropertyUtil.getString("PNGImageDecoder3"); throw new RuntimeException(msg); } maxOpacity = (1 << bitDepth) - 1; colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && (colorType != PNG_COLOR_PALETTE) && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { System.out.println(PropertyUtil.getString("PNGImageDecoder4")); } if ((colorType == PNG_COLOR_RGB) && (bitDepth < 8)) { // Error -- RGB images must have 8 or 16 bits String msg = PropertyUtil.getString("PNGImageDecoder5"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_PALETTE) && (bitDepth == 16)) { // Error -- palette images must have < 16 bits String msg = PropertyUtil.getString("PNGImageDecoder6"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_GRAY_ALPHA) && (bitDepth < 8)) { // Error -- gray/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder7"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_RGB_ALPHA) && (bitDepth < 8)) { // Error -- RGB/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder8"); throw new RuntimeException(msg); } if (emitProperties) { properties.put("color_type", colorTypeNames[colorType]); } if (generateEncodeParam) { if (colorType == PNG_COLOR_PALETTE) { encodeParam = new PNGEncodeParam.Palette(); } else if (colorType == PNG_COLOR_GRAY || colorType == PNG_COLOR_GRAY_ALPHA) { encodeParam = new PNGEncodeParam.Gray(); } else { encodeParam = new PNGEncodeParam.RGB(); } decodeParam.setEncodeParam(encodeParam); } if (encodeParam != null) { encodeParam.setBitDepth(bitDepth); } if (emitProperties) { properties.put("bit_depth", new Integer(bitDepth)); } if (performGammaCorrection) { // Assume file gamma is 1/2.2 unless we get a gAMA chunk float gamma = (1.0F/2.2F)*(displayExponent/userExponent); if (encodeParam != null) { encodeParam.setGamma(gamma); } if (emitProperties) { properties.put("gamma", new Float(gamma)); } } compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { // Error -- only know about compression method 0 String msg = PropertyUtil.getString("PNGImageDecoder9"); throw new RuntimeException(msg); } filterMethod = chunk.getInt1(11); if (filterMethod != 0) { // Error -- only know about filter method 0 String msg = PropertyUtil.getString("PNGImageDecoder10"); throw new RuntimeException(msg); } interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) { encodeParam.setInterlacing(false); } if (emitProperties) { properties.put("interlace_method", "None"); } } else if (interlaceMethod == 1) { if (encodeParam != null) { encodeParam.setInterlacing(true); } if (emitProperties) { properties.put("interlace_method", "Adam7"); } } else { // Error -- only know about Adam7 interlacing String msg = PropertyUtil.getString("PNGImageDecoder11"); throw new RuntimeException(msg); } bytesPerPixel = (bitDepth == 16) ? 2 : 1; switch (colorType) { case PNG_COLOR_GRAY: inputBands = 1; outputBands = 1; if (output8BitGray && (bitDepth < 8)) { postProcess = POST_GRAY_LUT; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_RGB: inputBands = 3; bytesPerPixel *= 3; outputBands = 3; if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_PALETTE: inputBands = 1; bytesPerPixel = 1; outputBands = expandPalette ? 3 : 1; if (expandPalette) { postProcess = POST_PALETTE_TO_RGB; } else { postProcess = POST_NONE; } break; case PNG_COLOR_GRAY_ALPHA: inputBands = 2; bytesPerPixel *= 2; if (suppressAlpha) { outputBands = 1; postProcess = POST_REMOVE_GRAY_TRANS; } else { if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } if (expandGrayAlpha) { postProcess |= POST_EXP_MASK; outputBands = 4; } else { outputBands = 2; } } break; case PNG_COLOR_RGB_ALPHA: inputBands = 4; bytesPerPixel *= 4; outputBands = (!suppressAlpha) ? 4 : 3; if (suppressAlpha) { postProcess = POST_REMOVE_RGB_TRANS; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_hIST_chunk(PNGChunk chunk) { if (redPalette == null) { String msg = PropertyUtil.getString("PNGImageDecoder18"); throw new RuntimeException(msg); } int length = redPalette.length; int[] hist = new int[length]; for (int i = 0; i < length; i++) { hist[i] = chunk.getInt2(2*i); } if (encodeParam != null) { encodeParam.setPaletteHistogram(hist); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_pHYs_chunk(PNGChunk chunk) { int xPixelsPerUnit = chunk.getInt4(0); int yPixelsPerUnit = chunk.getInt4(4); int unitSpecifier = chunk.getInt1(8); if (encodeParam != null) { encodeParam.setPhysicalDimension(xPixelsPerUnit, yPixelsPerUnit, unitSpecifier); } if (emitProperties) { properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit)); properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit)); properties.put("pixel_aspect_ratio", new Float((float)xPixelsPerUnit/yPixelsPerUnit)); if (unitSpecifier == 1) { properties.put("pixel_units", "Meters"); } else if (unitSpecifier != 0) { // Error -- unit specifier must be 0 or 1 String msg = PropertyUtil.getString("PNGImageDecoder12"); throw new RuntimeException(msg); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_sBIT_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { significantBits = new int[3]; } else { significantBits = new int[inputBands]; } for (int i = 0; i < significantBits.length; i++) { int bits = chunk.getByte(i); int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth; if (bits <= 0 || bits > depth) { // Error -- significant bits must be between 0 and // image bit depth. String msg = PropertyUtil.getString("PNGImageDecoder13"); throw new RuntimeException(msg); } significantBits[i] = bits; } if (encodeParam != null) { encodeParam.setSignificantBits(significantBits); } if (emitProperties) { properties.put("significant_bits", significantBits); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { // Error -- mustn't have more alpha than RGB palette entries String msg = PropertyUtil.getString("PNGImageDecoder14"); throw new RuntimeException(msg); } // Load beginning of palette from the chunk alphaPalette = new byte[paletteEntries]; for (int i = 0; i < entries; i++) { alphaPalette[i] = chunk.getByte(i); } // Fill rest of palette with 255 for (int i = entries; i < paletteEntries; i++) { alphaPalette[i] = (byte)255; } if (!suppressAlpha) { if (expandPalette) { postProcess = POST_PALETTE_TO_RGBA; outputBands = 4; } else { outputHasAlphaPalette = true; } } } else if (colorType == PNG_COLOR_GRAY) { grayTransparentAlpha = chunk.getInt2(0); if (!suppressAlpha) { if (bitDepth < 8) { output8BitGray = true; maxOpacity = 255; postProcess = POST_GRAY_LUT_ADD_TRANS; } else { postProcess = POST_ADD_GRAY_TRANS; } if (expandGrayAlpha) { outputBands = 4; postProcess |= POST_EXP_MASK; } else { outputBands = 2; } if (encodeParam != null) { ((PNGEncodeParam.Gray)encodeParam). setTransparentGray(grayTransparentAlpha); } } } else if (colorType == PNG_COLOR_RGB) { redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4); if (!suppressAlpha) { outputBands = 4; postProcess = POST_ADD_RGB_TRANS; if (encodeParam != null) { int[] rgbTrans = new int[3]; rgbTrans[0] = redTransparentAlpha; rgbTrans[1] = greenTransparentAlpha; rgbTrans[2] = blueTransparentAlpha; ((PNGEncodeParam.RGB)encodeParam). setTransparentRGB(rgbTrans); } } } else if (colorType == PNG_COLOR_GRAY_ALPHA || colorType == PNG_COLOR_RGB_ALPHA) { // Error -- GA or RGBA image can't have a tRNS chunk. String msg = PropertyUtil.getString("PNGImageDecoder15"); throw new RuntimeException(msg); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void decodePass(WritableRaster imRas, int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) { if ((passWidth == 0) || (passHeight == 0)) { return; } int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; byte[] curr = new byte[bytesPerRow]; byte[] prior = new byte[bytesPerRow]; // Create a 1-row tall Raster to hold the data WritableRaster passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, bitDepth); DataBuffer dataBuffer = passRow.getDataBuffer(); int type = dataBuffer.getDataType(); byte[] byteData = null; short[] shortData = null; if (type == DataBuffer.TYPE_BYTE) { byteData = ((DataBufferByte)dataBuffer).getData(); } else { shortData = ((DataBufferUShort)dataBuffer).getData(); } // Decode the (sub)image row-by-row int srcY, dstY; for (srcY = 0, dstY = yOffset; srcY < passHeight; srcY++, dstY += yStep) { // Read the filter type byte and a row of data int filter = 0; try { filter = dataStream.read(); dataStream.readFully(curr, 0, bytesPerRow); } catch (Exception e) { e.printStackTrace(); } switch (filter) { case PNG_FILTER_NONE: break; case PNG_FILTER_SUB: decodeSubFilter(curr, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_UP: decodeUpFilter(curr, prior, bytesPerRow); break; case PNG_FILTER_AVERAGE: decodeAverageFilter(curr, prior, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_PAETH: decodePaethFilter(curr, prior, bytesPerRow, bytesPerPixel); break; default: // Error -- uknown filter type String msg = PropertyUtil.getString("PNGImageDecoder16"); throw new RuntimeException(msg); } // Copy data into passRow byte by byte if (bitDepth < 16) { System.arraycopy(curr, 0, byteData, 0, bytesPerRow); } else { int idx = 0; for (int j = 0; j < eltsPerRow; j++) { shortData[j] = (short)((curr[idx] << 8) | (curr[idx + 1] & 0xff)); idx += 2; } } processPixels(postProcess, passRow, imRas, xOffset, xStep, dstY, passWidth); // Swap curr and prior byte[] tmp = prior; prior = curr; curr = tmp; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bounds = new Rectangle(0, 0, width, height); bitDepth = chunk.getInt1(8); int validMask = (1 << 1) | ( 1 << 2 ) | ( 1 << 4 ) | ( 1 << 8 ) | ( 1 << 16 ); if (( ( 1 << bitDepth ) & validMask ) == 0 ) { // bitDepth is not one of { 1, 2, 4, 8, 16 }: Error -- bad bit depth String msg = PropertyUtil.getString("PNGImageDecoder3"); throw new RuntimeException(msg); } maxOpacity = (1 << bitDepth) - 1; colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && (colorType != PNG_COLOR_PALETTE) && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { System.out.println(PropertyUtil.getString("PNGImageDecoder4")); } if ((colorType == PNG_COLOR_RGB) && (bitDepth < 8)) { // Error -- RGB images must have 8 or 16 bits String msg = PropertyUtil.getString("PNGImageDecoder5"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_PALETTE) && (bitDepth == 16)) { // Error -- palette images must have < 16 bits String msg = PropertyUtil.getString("PNGImageDecoder6"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_GRAY_ALPHA) && (bitDepth < 8)) { // Error -- gray/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder7"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_RGB_ALPHA) && (bitDepth < 8)) { // Error -- RGB/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder8"); throw new RuntimeException(msg); } if (emitProperties) { properties.put("color_type", colorTypeNames[colorType]); } if (generateEncodeParam) { if (colorType == PNG_COLOR_PALETTE) { encodeParam = new PNGEncodeParam.Palette(); } else if (colorType == PNG_COLOR_GRAY || colorType == PNG_COLOR_GRAY_ALPHA) { encodeParam = new PNGEncodeParam.Gray(); } else { encodeParam = new PNGEncodeParam.RGB(); } decodeParam.setEncodeParam(encodeParam); } if (encodeParam != null) { encodeParam.setBitDepth(bitDepth); } if (emitProperties) { properties.put("bit_depth", new Integer(bitDepth)); } if (performGammaCorrection) { // Assume file gamma is 1/2.2 unless we get a gAMA chunk float gamma = (1.0F/2.2F)*(displayExponent/userExponent); if (encodeParam != null) { encodeParam.setGamma(gamma); } if (emitProperties) { properties.put("gamma", new Float(gamma)); } } compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { // Error -- only know about compression method 0 String msg = PropertyUtil.getString("PNGImageDecoder9"); throw new RuntimeException(msg); } filterMethod = chunk.getInt1(11); if (filterMethod != 0) { // Error -- only know about filter method 0 String msg = PropertyUtil.getString("PNGImageDecoder10"); throw new RuntimeException(msg); } interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) { encodeParam.setInterlacing(false); } if (emitProperties) { properties.put("interlace_method", "None"); } } else if (interlaceMethod == 1) { if (encodeParam != null) { encodeParam.setInterlacing(true); } if (emitProperties) { properties.put("interlace_method", "Adam7"); } } else { // Error -- only know about Adam7 interlacing String msg = PropertyUtil.getString("PNGImageDecoder11"); throw new RuntimeException(msg); } bytesPerPixel = (bitDepth == 16) ? 2 : 1; switch (colorType) { case PNG_COLOR_GRAY: inputBands = 1; outputBands = 1; if (output8BitGray && (bitDepth < 8)) { postProcess = POST_GRAY_LUT; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_RGB: inputBands = 3; bytesPerPixel *= 3; outputBands = 3; if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_PALETTE: inputBands = 1; bytesPerPixel = 1; outputBands = expandPalette ? 3 : 1; if (expandPalette) { postProcess = POST_PALETTE_TO_RGB; } else { postProcess = POST_NONE; } break; case PNG_COLOR_GRAY_ALPHA: inputBands = 2; bytesPerPixel *= 2; if (suppressAlpha) { outputBands = 1; postProcess = POST_REMOVE_GRAY_TRANS; } else { if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } if (expandGrayAlpha) { postProcess |= POST_EXP_MASK; outputBands = 4; } else { outputBands = 2; } } break; case PNG_COLOR_RGB_ALPHA: inputBands = 4; bytesPerPixel *= 4; outputBands = (!suppressAlpha) ? 4 : 3; if (suppressAlpha) { postProcess = POST_REMOVE_RGB_TRANS; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_hIST_chunk(PNGChunk chunk) { if (redPalette == null) { String msg = PropertyUtil.getString("PNGImageDecoder18"); throw new RuntimeException(msg); } int length = redPalette.length; int[] hist = new int[length]; for (int i = 0; i < length; i++) { hist[i] = chunk.getInt2(2*i); } if (encodeParam != null) { encodeParam.setPaletteHistogram(hist); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_pHYs_chunk(PNGChunk chunk) { int xPixelsPerUnit = chunk.getInt4(0); int yPixelsPerUnit = chunk.getInt4(4); int unitSpecifier = chunk.getInt1(8); if (encodeParam != null) { encodeParam.setPhysicalDimension(xPixelsPerUnit, yPixelsPerUnit, unitSpecifier); } if (emitProperties) { properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit)); properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit)); properties.put("pixel_aspect_ratio", new Float((float)xPixelsPerUnit/yPixelsPerUnit)); if (unitSpecifier == 1) { properties.put("pixel_units", "Meters"); } else if (unitSpecifier != 0) { // Error -- unit specifier must be 0 or 1 String msg = PropertyUtil.getString("PNGImageDecoder12"); throw new RuntimeException(msg); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_sBIT_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { significantBits = new int[3]; } else { significantBits = new int[inputBands]; } for (int i = 0; i < significantBits.length; i++) { int bits = chunk.getByte(i); int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth; if (bits <= 0 || bits > depth) { // Error -- significant bits must be between 0 and // image bit depth. String msg = PropertyUtil.getString("PNGImageDecoder13"); throw new RuntimeException(msg); } significantBits[i] = bits; } if (encodeParam != null) { encodeParam.setSignificantBits(significantBits); } if (emitProperties) { properties.put("significant_bits", significantBits); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { // Error -- mustn't have more alpha than RGB palette entries String msg = PropertyUtil.getString("PNGImageDecoder14"); throw new RuntimeException(msg); } // Load beginning of palette from the chunk alphaPalette = new byte[paletteEntries]; for (int i = 0; i < entries; i++) { alphaPalette[i] = chunk.getByte(i); } // Fill rest of palette with 255 for (int i = entries; i < paletteEntries; i++) { alphaPalette[i] = (byte)255; } if (!suppressAlpha) { if (expandPalette) { postProcess = POST_PALETTE_TO_RGBA; outputBands = 4; } else { outputHasAlphaPalette = true; } } } else if (colorType == PNG_COLOR_GRAY) { grayTransparentAlpha = chunk.getInt2(0); if (!suppressAlpha) { if (bitDepth < 8) { output8BitGray = true; maxOpacity = 255; postProcess = POST_GRAY_LUT_ADD_TRANS; } else { postProcess = POST_ADD_GRAY_TRANS; } if (expandGrayAlpha) { outputBands = 4; postProcess |= POST_EXP_MASK; } else { outputBands = 2; } if (encodeParam != null) { ((PNGEncodeParam.Gray)encodeParam). setTransparentGray(grayTransparentAlpha); } } } else if (colorType == PNG_COLOR_RGB) { redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4); if (!suppressAlpha) { outputBands = 4; postProcess = POST_ADD_RGB_TRANS; if (encodeParam != null) { int[] rgbTrans = new int[3]; rgbTrans[0] = redTransparentAlpha; rgbTrans[1] = greenTransparentAlpha; rgbTrans[2] = blueTransparentAlpha; ((PNGEncodeParam.RGB)encodeParam). setTransparentRGB(rgbTrans); } } } else if (colorType == PNG_COLOR_GRAY_ALPHA || colorType == PNG_COLOR_RGB_ALPHA) { // Error -- GA or RGBA image can't have a tRNS chunk. String msg = PropertyUtil.getString("PNGImageDecoder15"); throw new RuntimeException(msg); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void decodePass(WritableRaster imRas, int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) { if ((passWidth == 0) || (passHeight == 0)) { return; } int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; byte[] curr = new byte[bytesPerRow]; byte[] prior = new byte[bytesPerRow]; // Create a 1-row tall Raster to hold the data WritableRaster passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, bitDepth); DataBuffer dataBuffer = passRow.getDataBuffer(); int type = dataBuffer.getDataType(); byte[] byteData = null; short[] shortData = null; if (type == DataBuffer.TYPE_BYTE) { byteData = ((DataBufferByte)dataBuffer).getData(); } else { shortData = ((DataBufferUShort)dataBuffer).getData(); } // Decode the (sub)image row-by-row int srcY, dstY; for (srcY = 0, dstY = yOffset; srcY < passHeight; srcY++, dstY += yStep) { // Read the filter type byte and a row of data int filter = 0; try { filter = dataStream.read(); dataStream.readFully(curr, 0, bytesPerRow); } catch (Exception e) { e.printStackTrace(); } switch (filter) { case PNG_FILTER_NONE: break; case PNG_FILTER_SUB: decodeSubFilter(curr, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_UP: decodeUpFilter(curr, prior, bytesPerRow); break; case PNG_FILTER_AVERAGE: decodeAverageFilter(curr, prior, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_PAETH: decodePaethFilter(curr, prior, bytesPerRow, bytesPerPixel); break; default: // Error -- unknown filter type String msg = PropertyUtil.getString("PNGImageDecoder16"); throw new RuntimeException(msg); } // Copy data into passRow byte by byte if (bitDepth < 16) { System.arraycopy(curr, 0, byteData, 0, bytesPerRow); } else { int idx = 0; for (int j = 0; j < eltsPerRow; j++) { shortData[j] = (short)((curr[idx] << 8) | (curr[idx + 1] & 0xff)); idx += 2; } } processPixels(postProcess, passRow, imRas, xOffset, xStep, dstY, passWidth); // Swap curr and prior byte[] tmp = prior; prior = curr; curr = tmp; } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayError(String message) { try { SVGAbstractTranscoder.this.handler.error (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayError(Exception e) { try { e.printStackTrace(); SVGAbstractTranscoder.this.handler.error (new TranscoderException(e)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayMessage(String message) { try { SVGAbstractTranscoder.this.handler.warning (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/dom/AbstractStylableDocument.java
public StyleSheetList getStyleSheets() { throw new RuntimeException(" !!! Not implemented"); }
// in sources/org/apache/batik/dom/AbstractStylableDocument.java
public CSSStyleDeclaration getOverrideStyle(Element elt, String pseudoElt) { throw new RuntimeException(" !!! Not implemented"); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, is); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, r); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public DOMImplementation getDOMImplementation(String ver) { if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
public String printNode(Node n) { try { Writer writer = new StringWriter(); DOMUtilities.writeNode(n, writer); writer.close(); return writer.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }
// in sources/org/apache/batik/bridge/svg12/AbstractContentSelector.java
public static AbstractContentSelector createSelector (String selectorLanguage, ContentManager cm, XBLOMContentElement content, Element bound, String selector) { ContentSelectorFactory f = (ContentSelectorFactory) selectorFactories.get(selectorLanguage); if (f == null) { throw new RuntimeException ("Invalid XBL content selector language '" + selectorLanguage + "'"); } return f.createSelector(cm, content, bound, selector); }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Interpreter getInterpreter(String language) { if (document == null) { throw new RuntimeException("Unknown document"); } Interpreter interpreter = (Interpreter)interpreterMap.get(language); if (interpreter == null) { try { interpreter = interpreterPool.createInterpreter(document, language, null); String[] mimeTypes = interpreter.getMimeTypes(); for (int i = 0; i < mimeTypes.length; i++) { interpreterMap.put(mimeTypes[i], interpreter); } } catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); return null; } } } if (interpreter == null) { if (userAgent != null) { userAgent.displayError(new Exception("Unknown language: " + language)); } } return interpreter; }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
45
              
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
0
(Lib) Error 70
              
// in sources/org/apache/batik/apps/rasterizer/DestinationType.java
public Object readResolve(){ switch(code){ case PNG_CODE: return PNG; case JPEG_CODE: return JPEG; case TIFF_CODE: return TIFF; case PDF_CODE: return PDF; default: throw new Error("unknown code:" + code ); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
public String getURI(){ try{ String uri = file.toURL().toString(); if (ref != null && !"".equals(ref)){ uri += '#' + ref; } return uri; } catch(MalformedURLException e){ throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/svggen/SVGTransform.java
final String convertTransform(TransformStackElement transformElement){ StringBuffer transformString = new StringBuffer(); double[] transformParameters = transformElement.getTransformParameters(); switch(transformElement.getType().toInt()){ case TransformType.TRANSFORM_TRANSLATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_TRANSLATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_ROTATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_ROTATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(radiansToDegrees*transformParameters[0])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SCALE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_SCALE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SHEAR: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(1); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(1); transformString.append(COMMA); transformString.append(0); transformString.append(COMMA); transformString.append(0); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_GENERAL: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[2])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[3])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[4])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[5])); transformString.append(CLOSE_PARENTHESIS); } break; default: // This should never happen. If it does, there is a // serious error. throw new Error(); } return transformString.toString(); }
// in sources/org/apache/batik/svggen/SVGAlphaComposite.java
private Element compositeToSVG(AlphaComposite composite) { // operator is equivalent to rule String operator = null; // input1 is equivalent to Src String input1 = null; // input2 is equivalent to Dst String input2 = null; // k2 is used only for arithmetic // to obtain the equivalent of SRC String k2 = "0"; // ID used to identify the composite String id = null; switch(composite.getRule()){ case AlphaComposite.CLEAR: operator = SVG_ARITHMETIC_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_CLEAR; break; case AlphaComposite.SRC: operator = SVG_ARITHMETIC_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC; k2 = SVG_DIGIT_ONE_VALUE; break; case AlphaComposite.SRC_IN: operator = SVG_IN_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC_IN; break; case AlphaComposite.SRC_OUT: operator = SVG_OUT_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC_OUT; break; case AlphaComposite.DST_IN: operator = SVG_IN_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_IN; break; case AlphaComposite.DST_OUT: operator = SVG_OUT_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_OUT; break; case AlphaComposite.DST_OVER: operator = SVG_OVER_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_OVER; break; default: throw new Error("invalid rule:" + composite.getRule() ); } Element compositeFilter = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FILTER_TAG); compositeFilter.setAttributeNS(null, SVG_ID_ATTRIBUTE, id); compositeFilter.setAttributeNS(null, SVG_FILTER_UNITS_ATTRIBUTE, SVG_OBJECT_BOUNDING_BOX_VALUE); compositeFilter.setAttributeNS(null, SVG_X_ATTRIBUTE, SVG_ZERO_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_Y_ATTRIBUTE, SVG_ZERO_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, SVG_HUNDRED_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, SVG_HUNDRED_PERCENT_VALUE); Element feComposite = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_COMPOSITE_TAG); feComposite.setAttributeNS(null, SVG_OPERATOR_ATTRIBUTE, operator); feComposite.setAttributeNS(null, SVG_IN_ATTRIBUTE, input1); feComposite.setAttributeNS(null, SVG_IN2_ATTRIBUTE, input2); feComposite.setAttributeNS(null, SVG_K2_ATTRIBUTE, k2); feComposite.setAttributeNS(null, SVG_RESULT_ATTRIBUTE, SVG_COMPOSITE_VALUE); Element feFlood = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FLOOD_TAG); feFlood.setAttributeNS(null, SVG_FLOOD_COLOR_ATTRIBUTE, "white"); feFlood.setAttributeNS(null, SVG_FLOOD_OPACITY_ATTRIBUTE, "1"); feFlood.setAttributeNS(null, SVG_RESULT_ATTRIBUTE, SVG_FLOOD_VALUE); Element feMerge = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_TAG); Element feMergeNodeFlood = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_NODE_TAG); feMergeNodeFlood.setAttributeNS(null, SVG_IN_ATTRIBUTE, SVG_FLOOD_VALUE); Element feMergeNodeComposite = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_NODE_TAG); feMergeNodeComposite.setAttributeNS(null, SVG_IN_ATTRIBUTE, SVG_COMPOSITE_VALUE); feMerge.appendChild(feMergeNodeFlood); feMerge.appendChild(feMergeNodeComposite); compositeFilter.appendChild(feFlood); compositeFilter.appendChild(feComposite); compositeFilter.appendChild(feMerge); return compositeFilter; }
// in sources/org/apache/batik/svggen/SVGPath.java
public static String toSVGPathData(Shape path, SVGGeneratorContext gc) { StringBuffer d = new StringBuffer( 40 ); PathIterator pi = path.getPathIterator(null); float[] seg = new float[6]; int segType = 0; while (!pi.isDone()) { segType = pi.currentSegment(seg); switch(segType) { case PathIterator.SEG_MOVETO: d.append(PATH_MOVE); appendPoint(d, seg[0], seg[1], gc); break; case PathIterator.SEG_LINETO: d.append(PATH_LINE_TO); appendPoint(d, seg[0], seg[1], gc); break; case PathIterator.SEG_CLOSE: d.append(PATH_CLOSE); break; case PathIterator.SEG_QUADTO: d.append(PATH_QUAD_TO); appendPoint(d, seg[0], seg[1], gc); appendPoint(d, seg[2], seg[3], gc); break; case PathIterator.SEG_CUBICTO: d.append(PATH_CUBIC_TO); appendPoint(d, seg[0], seg[1], gc); appendPoint(d, seg[2], seg[3], gc); appendPoint(d, seg[4], seg[5], gc); break; default: throw new Error("invalid segmentType:" + segType ); } pi.next(); } // while !isDone if (d.length() > 0) return d.toString().trim(); else { // This is a degenerate case: there was no initial moveTo // in the path and no data at all. However, this happens // in the Java 2D API (e.g., when clipping to a rectangle // with negative height/width, the clip will be a GeneralPath // with no data, which causes everything to be clipped) // It is the responsibility of the users of SVGPath to detect // instances where the converted element (see #toSVG above) // returns null, which only happens for degenerate cases. return ""; } }
// in sources/org/apache/batik/svggen/SVGPolygon.java
public Element toSVG(Polygon polygon) { Element svgPolygon = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_POLYGON_TAG); StringBuffer points = new StringBuffer(" "); PathIterator pi = polygon.getPathIterator(null); float[] seg = new float[6]; while(!pi.isDone()){ int segType = pi.currentSegment(seg); switch(segType){ case PathIterator.SEG_MOVETO: appendPoint(points, seg[0], seg[1]); break; case PathIterator.SEG_LINETO: appendPoint(points, seg[0], seg[1]); break; case PathIterator.SEG_CLOSE: break; case PathIterator.SEG_QUADTO: case PathIterator.SEG_CUBICTO: default: throw new Error("invalid segmentType:" + segType ); } pi.next(); } // while !isDone svgPolygon.setAttributeNS(null, SVG_POINTS_ATTRIBUTE, points.substring(0, points.length() - 1)); return svgPolygon; }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object run() { try { return cx.compileReader (new StringReader(scriptStr), SOURCE_NAME_SVG, 1, rhinoClassLoader); } catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); } }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs){ boolean retVal = true; if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); } gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.transform(inverseTransform); } else{ AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.setTransform(savTransform); } return retVal; }
// in sources/org/apache/batik/ext/awt/g2d/TransformType.java
public Object readResolve() { switch(val){ case TRANSFORM_TRANSLATE: return TransformType.TRANSLATE; case TRANSFORM_ROTATE: return TransformType.ROTATE; case TRANSFORM_SCALE: return TransformType.SCALE; case TRANSFORM_SHEAR: return TransformType.SHEAR; case TRANSFORM_GENERAL: return TransformType.GENERAL; default: throw new Error("Unknown TransformType value:" + val ); } }
// in sources/org/apache/batik/ext/awt/color/ICCColorSpaceExt.java
public float[] intendedToRGB(float[] values){ switch(intent){ case ABSOLUTE_COLORIMETRIC: return absoluteColorimetricToRGB(values); case PERCEPTUAL: case AUTO: return perceptualToRGB(values); case RELATIVE_COLORIMETRIC: return relativeColorimetricToRGB(values); case SATURATION: return saturationToRGB(values); default: throw new Error("invalid intent:" + intent ); } }
// in sources/org/apache/batik/ext/awt/image/CompositeRule.java
private Object readResolve() throws java.io.ObjectStreamException { switch(rule){ case RULE_OVER: return OVER; case RULE_IN: return IN; case RULE_OUT: return OUT; case RULE_ATOP: return ATOP; case RULE_XOR: return XOR; case RULE_ARITHMETIC: return this; case RULE_MULTIPLY: return MULTIPLY; case RULE_SCREEN: return SCREEN; case RULE_DARKEN: return DARKEN; case RULE_LIGHTEN: return LIGHTEN; default: throw new Error("Unknown Composite Rule type"); } }
// in sources/org/apache/batik/ext/awt/image/CompositeRule.java
public String toString() { switch(rule){ case RULE_OVER: return "[CompositeRule: OVER]"; case RULE_IN: return "[CompositeRule: IN]"; case RULE_OUT: return "[CompositeRule: OUT]"; case RULE_ATOP: return "[CompositeRule: ATOP]"; case RULE_XOR: return "[CompositeRule: XOR]"; case RULE_ARITHMETIC: return ("[CompositeRule: ARITHMATIC k1:" + k1 + " k2: " + k2 + " k3: " + k3 + " k4: " + k4 + ']' ); case RULE_MULTIPLY: return "[CompositeRule: MULTIPLY]"; case RULE_SCREEN: return "[CompositeRule: SCREEN]"; case RULE_DARKEN: return "[CompositeRule: DARKEN]"; case RULE_LIGHTEN: return "[CompositeRule: LIGHTEN]"; default: throw new Error("Unknown Composite Rule type"); } }
// in sources/org/apache/batik/ext/awt/image/ARGBChannel.java
public Object readResolve() { switch(val){ case CHANNEL_R: return R; case CHANNEL_G: return G; case CHANNEL_B: return B; case CHANNEL_A: return A; default: throw new Error("Unknown ARGBChannel value"); } }
// in sources/org/apache/batik/ext/awt/image/PadMode.java
private Object readResolve() throws java.io.ObjectStreamException { switch(mode){ case MODE_ZERO_PAD: return ZERO_PAD; case MODE_REPLICATE: return REPLICATE; case MODE_WRAP: return WRAP; default: throw new Error("Unknown Pad Mode type"); } }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
public WritableRaster copyData(WritableRaster argbWR){ try{ RenderedImage img = getSource(); /** * Check that the number of color components match in the input * image and in the replacing profile. */ ColorModel imgCM = img.getColorModel(); ColorSpace imgCS = imgCM.getColorSpace(); int nImageComponents = imgCS.getNumComponents(); int nProfileComponents = colorSpace.getNumComponents(); if(nImageComponents != nProfileComponents){ // Should we go in error???? Here we simply trace an error // and return null System.err.println("Input image and associated color profile have" + " mismatching number of color components: conversion is not possible"); return argbWR; } /** * Get the data from the source for the requested region */ int w = argbWR.getWidth(); int h = argbWR.getHeight(); int minX = argbWR.getMinX(); int minY = argbWR.getMinY(); WritableRaster srcWR = imgCM.createCompatibleWritableRaster(w, h); srcWR = srcWR.createWritableTranslatedChild(minX, minY); img.copyData(srcWR); /** * If the source data is not a ComponentColorModel using a * BandedSampleModel, do the conversion now. */ if(!(imgCM instanceof ComponentColorModel) || !(img.getSampleModel() instanceof BandedSampleModel) || (imgCM.hasAlpha() && imgCM.isAlphaPremultiplied() )) { ComponentColorModel imgCompCM = new ComponentColorModel (imgCS, // Same ColorSpace as img imgCM.getComponentSize(), // Number of bits/comp imgCM.hasAlpha(), // Same alpha as img false, // unpremult alpha (so we can remove it next). imgCM.getTransparency(), // Same trans as img DataBuffer.TYPE_BYTE); // 8 bit/component. WritableRaster wr = Raster.createBandedRaster (DataBuffer.TYPE_BYTE, argbWR.getWidth(), argbWR.getHeight(), imgCompCM.getNumComponents(), new Point(0, 0)); BufferedImage imgComp = new BufferedImage (imgCompCM, wr, imgCompCM.isAlphaPremultiplied(), null); BufferedImage srcImg = new BufferedImage (imgCM, srcWR.createWritableTranslatedChild(0, 0), imgCM.isAlphaPremultiplied(), null); Graphics2D g = imgComp.createGraphics(); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g.drawImage(srcImg, 0, 0, null); img = imgComp; imgCM = imgCompCM; srcWR = wr.createWritableTranslatedChild(minX, minY); } /** * Now, the input image is using a component color * model. We can therefore create an image with the new * profile, using a ComponentColorModel as well, because * we know the number of components match (this was * checked at the begining of this routine). */ ComponentColorModel newCM = new ComponentColorModel (colorSpace, // **** New ColorSpace **** imgCM.getComponentSize(), // Array of number of bits per components false, // No alpa false, // Not premultiplied Transparency.OPAQUE, // No transparency DataBuffer.TYPE_BYTE); // 8 Bits // Build a raster with bands 0, 1 and 2 of img's raster DataBufferByte data = (DataBufferByte)srcWR.getDataBuffer(); srcWR = Raster.createBandedRaster (data, argbWR.getWidth(), argbWR.getHeight(), argbWR.getWidth(), new int[]{0, 1, 2}, new int[]{0, 0, 0}, new Point(0, 0)); BufferedImage newImg = new BufferedImage (newCM, srcWR, newCM.isAlphaPremultiplied(), null); /** * Now, convert the image to sRGB */ ComponentColorModel sRGBCompCM = new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{8, 8, 8}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster wr = Raster.createBandedRaster (DataBuffer.TYPE_BYTE, argbWR.getWidth(), argbWR.getHeight(), sRGBCompCM.getNumComponents(), new Point(0, 0)); BufferedImage sRGBImage = new BufferedImage (sRGBCompCM, wr, false, null); ColorConvertOp colorConvertOp = new ColorConvertOp(null); colorConvertOp.filter(newImg, sRGBImage); /** * Integrate alpha back into the image if there is any */ if (imgCM.hasAlpha()){ DataBufferByte rgbData = (DataBufferByte)wr.getDataBuffer(); byte[][] imgBanks = data.getBankData(); byte[][] rgbBanks = rgbData.getBankData(); byte[][] argbBanks = {rgbBanks[0], rgbBanks[1], rgbBanks[2], imgBanks[3]}; DataBufferByte argbData = new DataBufferByte(argbBanks, imgBanks[0].length); srcWR = Raster.createBandedRaster (argbData, argbWR.getWidth(), argbWR.getHeight(), argbWR.getWidth(), new int[]{0, 1, 2, 3}, new int[]{0, 0, 0, 0}, new Point(0, 0)); sRGBCompCM = new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{8, 8, 8, 8}, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); sRGBImage = new BufferedImage(sRGBCompCM, srcWR, false, null); } /*BufferedImage result = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);*/ BufferedImage result = new BufferedImage(sRGBCM, argbWR.createWritableTranslatedChild(0, 0), false, null); /////////////////////////////////////////////// // BUG IN ColorConvertOp: The following breaks: // colorConvertOp.filter(sRGBImage, result); // // Using Graphics2D instead.... /////////////////////////////////////////////// Graphics2D g = result.createGraphics(); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g.drawImage(sRGBImage, 0, 0, null); g.dispose(); return argbWR; }catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable8Bit.java
private static TransferFunction getTransferFunction (ComponentTransferFunction function){ TransferFunction txfFunc = null; if(function == null){ txfFunc = new IdentityTransfer(); } else{ switch(function.getType()){ case ComponentTransferFunction.IDENTITY: txfFunc = new IdentityTransfer(); break; case ComponentTransferFunction.TABLE: txfFunc = new TableTransfer(tableFloatToInt(function.getTableValues())); break; case ComponentTransferFunction.DISCRETE: txfFunc = new DiscreteTransfer(tableFloatToInt(function.getTableValues())); break; case ComponentTransferFunction.LINEAR: txfFunc = new LinearTransfer(function.getSlope(), function.getIntercept()); break; case ComponentTransferFunction.GAMMA: txfFunc = new GammaTransfer(function.getAmplitude(), function.getExponent(), function.getOffset()); break; default: // Should never happen throw new Error(); } } return txfFunc; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFEncodeParam.java
public void setCompression(int compression) { switch(compression) { case COMPRESSION_NONE: case COMPRESSION_PACKBITS: case COMPRESSION_JPEG_TTN2: case COMPRESSION_DEFLATE: // Do nothing. break; default: throw new Error("TIFFEncodeParam0"); } this.compression = compression; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFEncodeParam.java
public void setDeflateLevel(int deflateLevel) { if(deflateLevel < 1 && deflateLevel > 9 && deflateLevel != Deflater.DEFAULT_COMPRESSION) { throw new Error("TIFFEncodeParam1"); } this.deflateLevel = deflateLevel; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public void decodeNextScanline(byte[] buffer, int lineOffset, int bitOffset) { int bits = 0, code = 0, isT = 0; int current, entry, twoBits; boolean isWhite = true; // Initialize starting of the changing elements array changingElemSize = 0; // While scanline not complete while (bitOffset < w) { while (isWhite) { // White run current = nextNBits(10); entry = white[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits == 12) { // Additional Make up code // Get the next 2 bits twoBits = nextLesserThan8Bits(2); // Consolidate the 2 new bits and last 2 bits into 4 bits current = ((current << 2) & 0x000c) | twoBits; entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits bitOffset += code; // Skip white run updatePointer(4 - bits); } else if (bits == 0) { // ERROR throw new Error("TIFFFaxDecoder0"); } else if (bits == 15) { // EOL throw new Error("TIFFFaxDecoder1"); } else { // 11 bits - 0000 0111 1111 1111 = 0x07ff code = (entry >>> 5) & 0x07ff; bitOffset += code; updatePointer(10 - bits); if (isT == 0) { isWhite = false; currChangingElems[changingElemSize++] = bitOffset; } } } // Check whether this run completed one width, if so // advance to next byte boundary for compression = 2. if (bitOffset == w) { if (compression == 2) { advancePointer(); } break; } while ( ! isWhite ) { // Black run current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code == 100) { current = nextNBits(9); entry = black[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits == 12) { // Additional makeup codes updatePointer(5); current = nextLesserThan8Bits(4); entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(4 - bits); } else if (bits == 15) { // EOL code throw new Error("TIFFFaxDecoder2"); } else { setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(9 - bits); if (isT == 0) { isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); entry = twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; bits = (entry >>> 1) & 0x0f; setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(2 - bits); isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } else { // Is a Terminating code setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(4 - bits); isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } } // Check whether this run completed one width if (bitOffset == w) { if (compression == 2) { advancePointer(); } break; } } currChangingElems[changingElemSize++] = bitOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public void decode2D(byte[] buffer, byte[] compData, int startX, int height, long tiffT4Options) { this.data = compData; compression = 3; bitPointer = 0; bytePointer = 0; int scanlineStride = (w + 7)/8; int a0, a1, b1, b2; int[] b = new int[2]; int entry, code, bits; boolean isWhite; int currIndex = 0; int[] temp; // fillBits - dealt with this in readEOL // 1D/2D encoding - dealt with this in readEOL // uncompressedMode - haven't dealt with this yet. oneD = (int)(tiffT4Options & 0x01); uncompressedMode = (int)((tiffT4Options & 0x02) >> 1); fillBits = (int)((tiffT4Options & 0x04) >> 2); // The data must start with an EOL code if (readEOL() != 1) { throw new Error("TIFFFaxDecoder3"); } int lineOffset = 0; int bitOffset; // Then the 1D encoded scanline data will occur, changing elements // array gets set. decodeNextScanline(buffer, lineOffset, startX); lineOffset += scanlineStride; for (int lines = 1; lines < height; lines++) { // Every line must begin with an EOL followed by a bit which // indicates whether the following scanline is 1D or 2D encoded. if (readEOL() == 0) { // 2D encoded scanline follows // Initialize previous scanlines changing elements, and // initialize current scanline's changing elements array temp = prevChangingElems; prevChangingElems = currChangingElems; currChangingElems = temp; currIndex = 0; // a0 has to be set just before the start of this scanline. a0 = -1; isWhite = true; bitOffset = startX; lastChangingElement = 0; while (bitOffset < w) { // Get the next changing element getNextChangingElement(a0, isWhite, b); b1 = b[0]; b2 = b[1]; // Get the next seven bits entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table entry = (int)(twoDCodes[entry] & 0xff); // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code == 0) { if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, b2 - bitOffset); } bitOffset = a0 = b2; // Set pointer to consume the correct number of bits. updatePointer(7 - bits); } else if (code == 1) { // Horizontal updatePointer(7 - bits); // identify the next 2 codes. int number; if (isWhite) { number = decodeWhiteCodeWord(); bitOffset += number; currChangingElems[currIndex++] = bitOffset; number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; currChangingElems[currIndex++] = bitOffset; } else { number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; currChangingElems[currIndex++] = bitOffset; number = decodeWhiteCodeWord(); bitOffset += number; currChangingElems[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { // Vertical a1 = b1 + (code - 5); currChangingElems[currIndex++] = a1; // We write the current color till a1 - 1 pos, // since a1 is where the next color starts if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, a1 - bitOffset); } bitOffset = a0 = a1; isWhite = !isWhite; updatePointer(7 - bits); } else { throw new Error("TIFFFaxDecoder4"); } } // Add the changing element beyond the current scanline for the // other color too currChangingElems[currIndex++] = bitOffset; changingElemSize = currIndex; } else { // 1D encoded scanline follows decodeNextScanline(buffer, lineOffset, startX); } lineOffset += scanlineStride; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public synchronized void decodeT6(byte[] buffer, byte[] compData, int startX, int height, long tiffT6Options) { this.data = compData; compression = 4; bitPointer = 0; bytePointer = 0; int scanlineStride = (w + 7)/8; int a0, a1, b1, b2; int entry, code, bits; boolean isWhite; int currIndex; int[] temp; // Return values from getNextChangingElement int[] b = new int[2]; // uncompressedMode - have written some code for this, but this // has not been tested due to lack of test images using this optional uncompressedMode = (int)((tiffT6Options & 0x02) >> 1); // Local cached reference int[] cce = currChangingElems; // Assume invisible preceding row of all white pixels and insert // both black and white changing elements beyond the end of this // imaginary scanline. changingElemSize = 0; cce[changingElemSize++] = w; cce[changingElemSize++] = w; int lineOffset = 0; int bitOffset; for (int lines = 0; lines < height; lines++) { // a0 has to be set just before the start of the scanline. a0 = -1; isWhite = true; // Assign the changing elements of the previous scanline to // prevChangingElems and start putting this new scanline's // changing elements into the currChangingElems. temp = prevChangingElems; prevChangingElems = currChangingElems; cce = currChangingElems = temp; currIndex = 0; // Start decoding the scanline at startX in the raster bitOffset = startX; // Reset search start position for getNextChangingElement lastChangingElement = 0; // Till one whole scanline is decoded while (bitOffset < w) { // Get the next changing element getNextChangingElement(a0, isWhite, b); b1 = b[0]; b2 = b[1]; // Get the next seven bits entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table entry = (int)(twoDCodes[entry] & 0xff); // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code == 0) { // Pass // We always assume WhiteIsZero format for fax. if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, b2 - bitOffset); } bitOffset = a0 = b2; // Set pointer to only consume the correct number of bits. updatePointer(7 - bits); } else if (code == 1) { // Horizontal // Set pointer to only consume the correct number of bits. updatePointer(7 - bits); // identify the next 2 alternating color codes. int number; if (isWhite) { // Following are white and black runs number = decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; } else { // First a black run and then a white run follows number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; number = decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { // Vertical a1 = b1 + (code - 5); cce[currIndex++] = a1; // We write the current color till a1 - 1 pos, // since a1 is where the next color starts if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, a1 - bitOffset); } bitOffset = a0 = a1; isWhite = !isWhite; updatePointer(7 - bits); } else if (code == 11) { if (nextLesserThan8Bits(3) != 7) { throw new Error("TIFFFaxDecoder5"); } int zeros = 0; boolean exit = false; while (!exit) { while (nextLesserThan8Bits(1) != 1) { zeros++; } if (zeros > 5) { // Exit code // Zeros before exit code zeros = zeros - 6; if (!isWhite && (zeros > 0)) { cce[currIndex++] = bitOffset; } // Zeros before the exit code bitOffset += zeros; if (zeros > 0) { // Some zeros have been written isWhite = true; } // Read in the bit which specifies the color of // the following run if (nextLesserThan8Bits(1) == 0) { if (!isWhite) { cce[currIndex++] = bitOffset; } isWhite = true; } else { if (isWhite) { cce[currIndex++] = bitOffset; } isWhite = false; } exit = true; } if (zeros == 5) { if (!isWhite) { cce[currIndex++] = bitOffset; } bitOffset += zeros; // Last thing written was white isWhite = true; } else { bitOffset += zeros; cce[currIndex++] = bitOffset; setToBlack(buffer, lineOffset, bitOffset, 1); ++bitOffset; // Last thing written was black isWhite = false; } } } else { throw new Error("TIFFFaxDecoder5"); } } // Add the changing element beyond the current scanline for the // other color too cce[currIndex++] = bitOffset; // Number of changing elements in this scanline. changingElemSize = currIndex; lineOffset += scanlineStride; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int decodeWhiteCodeWord() { int current, entry, bits, isT, twoBits, code = -1; int runLength = 0; boolean isWhite = true; while (isWhite) { current = nextNBits(10); entry = white[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits == 12) { // Additional Make up code // Get the next 2 bits twoBits = nextLesserThan8Bits(2); // Consolidate the 2 new bits and last 2 bits into 4 bits current = ((current << 2) & 0x000c) | twoBits; entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits runLength += code; updatePointer(4 - bits); } else if (bits == 0) { // ERROR throw new Error("TIFFFaxDecoder0"); } else if (bits == 15) { // EOL throw new Error("TIFFFaxDecoder1"); } else { // 11 bits - 0000 0111 1111 1111 = 0x07ff code = (entry >>> 5) & 0x07ff; runLength += code; updatePointer(10 - bits); if (isT == 0) { isWhite = false; } } } return runLength; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int decodeBlackCodeWord() { int current, entry, bits, isT, code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code == 100) { current = nextNBits(9); entry = black[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits == 12) { // Additional makeup codes updatePointer(5); current = nextLesserThan8Bits(4); entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits runLength += code; updatePointer(4 - bits); } else if (bits == 15) { // EOL code throw new Error("TIFFFaxDecoder2"); } else { runLength += code; updatePointer(9 - bits); if (isT == 0) { isWhite = true; } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); entry = twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; runLength += code; bits = (entry >>> 1) & 0x0f; updatePointer(2 - bits); isWhite = true; } else { // Is a Terminating code runLength += code; updatePointer(4 - bits); isWhite = true; } } return runLength; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int readEOL() { if (fillBits == 0) { if (nextNBits(12) != 1) { throw new Error("TIFFFaxDecoder6"); } } else if (fillBits == 1) { // First EOL code word xxxx 0000 0000 0001 will occur // As many fill bits will be present as required to make // the EOL code of 12 bits end on a byte boundary. int bitsLeft = 8 - bitPointer; if (nextNBits(bitsLeft) != 0) { throw new Error("TIFFFaxDecoder8"); } // If the number of bitsLeft is less than 8, then to have a 12 // bit EOL sequence, two more bytes are certainly going to be // required. The first of them has to be all zeros, so ensure // that. if (bitsLeft < 4) { if (nextNBits(8) != 0) { throw new Error("TIFFFaxDecoder8"); } } // There might be a random number of fill bytes with 0s, so // loop till the EOL of 0000 0001 is found, as long as all // the bytes preceding it are 0's. int n; while ((n = nextNBits(8)) != 1) { // If not all zeros if (n != 0) { throw new Error("TIFFFaxDecoder8"); } } } // If one dimensional encoding mode, then always return 1 if (oneD == 0) { return 1; } else { // Otherwise for 2D encoding mode, // The next one bit signifies 1D/2D encoding of next line. return nextLesserThan8Bits(1); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int nextNBits(int bitsToGet) { byte b, next, next2next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = data[bp + 1]; next2next = 0x00; } else { next = data[bp + 1]; next2next = data[bp + 2]; } } else if (fillOrder == 2) { b = flipTable[data[bp] & 0xff]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = flipTable[data[bp + 1] & 0xff]; next2next = 0x00; } else { next = flipTable[data[bp + 1] & 0xff]; next2next = flipTable[data[bp + 2] & 0xff]; } } else { throw new Error("TIFFFaxDecoder7"); } int bitsLeft = 8 - bitPointer; int bitsFromNextByte = bitsToGet - bitsLeft; int bitsFromNext2NextByte = 0; if (bitsFromNextByte > 8) { bitsFromNext2NextByte = bitsFromNextByte - 8; bitsFromNextByte = 8; } bytePointer++; int i1 = (b & table1[bitsLeft]) << (bitsToGet - bitsLeft); int i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); int i3 = 0; if (bitsFromNext2NextByte != 0) { i2 <<= bitsFromNext2NextByte; i3 = (next2next & table2[bitsFromNext2NextByte]) >>> (8 - bitsFromNext2NextByte); i2 |= i3; bytePointer++; bitPointer = bitsFromNext2NextByte; } else { if (bitsFromNextByte == 8) { bitPointer = 0; bytePointer++; } else { bitPointer = bitsFromNextByte; } } int i = i1 | i2; return i; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int nextLesserThan8Bits(int bitsToGet) { byte b, next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; } else { next = data[bp + 1]; } } else if (fillOrder == 2) { b = flipTable[data[bp] & 0xff]; if (bp == l) { next = 0x00; } else { next = flipTable[data[bp + 1] & 0xff]; } } else { throw new Error("TIFFFaxDecoder7"); } int bitsLeft = 8 - bitPointer; int bitsFromNextByte = bitsToGet - bitsLeft; int shift = bitsLeft - bitsToGet; int i1, i2; if (shift >= 0) { i1 = (b & table1[bitsLeft]) >>> shift; bitPointer += bitsToGet; if (bitPointer == 8) { bitPointer = 0; bytePointer++; } } else { i1 = (b & table1[bitsLeft]) << (-shift); i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); i1 |= i2; bytePointer++; bitPointer = bitsFromNextByte; } return i1; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValues(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: byte[] bytes = field.getAsBytes(); for (int i=0; i<count; i++) { output.write(bytes[i]); } break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); for (int i=0; i<count; i++) { writeUnsignedShort(chars[i]); } break; case TIFFField.TIFF_SSHORT: short[] shorts = field.getAsShorts(); for (int i=0; i<count; i++) { writeUnsignedShort(shorts[i]); } break; // unsigned 32 bits case TIFFField.TIFF_LONG: case TIFFField.TIFF_SLONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; case TIFFField.TIFF_FLOAT: float[] floats = field.getAsFloats(); for (int i=0; i<count; i++) { int intBits = Float.floatToIntBits(floats[i]); writeLong(intBits); } break; case TIFFField.TIFF_DOUBLE: double[] doubles = field.getAsDoubles(); for (int i=0; i<count; i++) { long longBits = Double.doubleToLongBits(doubles[i]); writeLong(longBits >>> 32); // write upper 32 bits writeLong(longBits & 0xffffffffL); // write lower 32 bits } break; case TIFFField.TIFF_RATIONAL: case TIFFField.TIFF_SRATIONAL: long[][] rationals = field.getAsRationals(); for (int i=0; i<count; i++) { writeLong(rationals[i][0]); writeLong(rationals[i][1]); } break; case TIFFField.TIFF_ASCII: for (int i=0; i<count; i++) { byte[] stringBytes = field.getAsString(i).getBytes(); output.write(stringBytes); if(stringBytes[stringBytes.length-1] != (byte)0) { output.write((byte)0); } } break; default: throw new Error("TIFFImageEncoder10"); } }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
public double getValue(){ try{ String t = getText(0, getLength()); if(t != null && t.length() > 0){ return Double.parseDouble(t); } else{ return 0; } }catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new Error("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new Error("Writer expected"); } prettyPrint(r, w); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
public int[] getSelected(Mark startMark, Mark finishMark) { if (startMark == null || finishMark == null) { return null; } BasicTextPainter.BasicMark start; BasicTextPainter.BasicMark finish; try { start = (BasicTextPainter.BasicMark) startMark; finish = (BasicTextPainter.BasicMark) finishMark; } catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); } TextNode textNode = start.getTextNode(); if (textNode == null) return null; if (textNode != finish.getTextNode()) throw new Error("Markers are from different TextNodes!"); AttributedCharacterIterator aci; aci = textNode.getAttributedCharacterIterator(); if (aci == null) return null; int[] result = new int[2]; result[0] = start.getHit().getCharIndex(); result[1] = finish.getHit().getCharIndex(); // get the list of text runs List textRuns = getTextRuns(textNode, aci); Iterator trI = textRuns.iterator(); int startGlyphIndex = -1; int endGlyphIndex = -1; TextSpanLayout startLayout=null, endLayout=null; while (trI.hasNext()) { TextRun tr = (TextRun)trI.next(); TextSpanLayout tsl = tr.getLayout(); if (startGlyphIndex == -1) { startGlyphIndex = tsl.getGlyphIndex(result[0]); if (startGlyphIndex != -1) startLayout = tsl; } if (endGlyphIndex == -1) { endGlyphIndex = tsl.getGlyphIndex(result[1]); if (endGlyphIndex != -1) endLayout = tsl; } if ((startGlyphIndex != -1) && (endGlyphIndex != -1)) break; } if ((startLayout == null) || (endLayout == null)) return null; int startCharCount = startLayout.getCharacterCount (startGlyphIndex, startGlyphIndex); int endCharCount = endLayout.getCharacterCount (endGlyphIndex, endGlyphIndex); if (startCharCount > 1) { if (result[0] > result[1] && startLayout.isLeftToRight()) { result[0] += startCharCount-1; } else if (result[1] > result[0] && !startLayout.isLeftToRight()) { result[0] -= startCharCount-1; } } if (endCharCount > 1) { if (result[1] > result[0] && endLayout.isLeftToRight()) { result[1] += endCharCount-1; } else if (result[0] > result[1] && !endLayout.isLeftToRight()) { result[1] -= endCharCount-1; } } return result; }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
public Shape getHighlightShape(Mark beginMark, Mark endMark) { if (beginMark == null || endMark == null) { return null; } BasicTextPainter.BasicMark begin; BasicTextPainter.BasicMark end; try { begin = (BasicTextPainter.BasicMark) beginMark; end = (BasicTextPainter.BasicMark) endMark; } catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); } TextNode textNode = begin.getTextNode(); if (textNode == null) return null; if (textNode != end.getTextNode()) throw new Error("Markers are from different TextNodes!"); AttributedCharacterIterator aci; aci = textNode.getAttributedCharacterIterator(); if (aci == null) return null; int beginIndex = begin.getHit().getCharIndex(); int endIndex = end.getHit().getCharIndex(); if (beginIndex > endIndex) { // Swap them... BasicTextPainter.BasicMark tmpMark = begin; begin = end; end = tmpMark; int tmpIndex = beginIndex; beginIndex = endIndex; endIndex = tmpIndex; } // get the list of text runs List textRuns = getTextRuns(textNode, aci); GeneralPath highlightedShape = new GeneralPath(); // for each text run, append any highlight it may contain for // the current selection for (int i = 0; i < textRuns.size(); ++i) { TextRun textRun = (TextRun)textRuns.get(i); TextSpanLayout layout = textRun.getLayout(); Shape layoutHighlightedShape = layout.getHighlightShape (beginIndex, endIndex); // append the highlighted shape of this layout to the // overall hightlighted shape if (( layoutHighlightedShape != null) && (!layoutHighlightedShape.getBounds().isEmpty())) { highlightedShape.append(layoutHighlightedShape, false); } } return highlightedShape; }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
private double[] computeInSlope(double[] prev, int prevSegType, double[] curr, int currSegType){ // Compute point into which the slope runs Point2D currEndPoint = getSegmentTerminatingPoint(curr, currSegType); double dx = 0; double dy = 0; switch(currSegType){ case PathIterator.SEG_LINETO: { // This is equivalent to a line from the previous segment's // terminating point and the current end point. Point2D prevEndPoint = getSegmentTerminatingPoint(prev, prevSegType); dx = currEndPoint.getX() - prevEndPoint.getX(); dy = currEndPoint.getY() - prevEndPoint.getY(); } break; case PathIterator.SEG_QUADTO: // If the current segment is a line, quad or cubic curve. // the slope is about equal to that of the line from the // last control point and the curEndPoint dx = currEndPoint.getX() - curr[0]; dy = currEndPoint.getY() - curr[1]; break; case PathIterator.SEG_CUBICTO: // If the current segment is a quad or cubic curve. // the slope is about equal to that of the line from the // last control point and the curEndPoint dx = currEndPoint.getX() - curr[2]; dy = currEndPoint.getY() - curr[3]; break; case ExtendedPathIterator.SEG_ARCTO: { // If the current segment is an ARCTO then we build the // arc and ask for it's end angle and get the tangent there. Point2D prevEndPoint = getSegmentTerminatingPoint(prev, prevSegType); boolean large = (curr[3]!=0.); boolean goLeft = (curr[4]!=0.); Arc2D arc = ExtendedGeneralPath.computeArc (prevEndPoint.getX(), prevEndPoint.getY(), curr[0], curr[1], curr[2], large, goLeft, curr[5], curr[6]); double theta = arc.getAngleStart()+arc.getAngleExtent(); theta = Math.toRadians(theta); dx = -arc.getWidth()/2.0*Math.sin(theta); dy = arc.getHeight()/2.0*Math.cos(theta); // System.out.println("In Theta: " + Math.toDegrees(theta) + // " Dx/Dy: " + dx + "/" + dy); if (curr[2] != 0) { double ang = Math.toRadians(-curr[2]); double sinA = Math.sin(ang); double cosA = Math.cos(ang); double tdx = dx*cosA - dy*sinA; double tdy = dx*sinA + dy*cosA; dx = tdx; dy = tdy; } // System.out.println(" Rotate: " + curr[2] + // " Dx/Dy: " + dx + "/" + dy); if (goLeft) { dx = -dx; } else { dy = -dy; } // System.out.println(" GoLeft? " + goLeft + // " Dx/Dy: " + dx + "/" + dy); } break; case PathIterator.SEG_CLOSE: // Should not have any close at this point throw new Error("should not have SEG_CLOSE here"); case PathIterator.SEG_MOVETO: // Cannot compute the slope default: return null; } if (dx == 0 && dy == 0) { return null; } return normalize(new double[] { dx, dy }); }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
protected Point2D getSegmentTerminatingPoint(double[] coords, int segType) { switch(segType){ case PathIterator.SEG_CUBICTO: return new Point2D.Double(coords[4], coords[5]); case PathIterator.SEG_LINETO: return new Point2D.Double(coords[0], coords[1]); case PathIterator.SEG_MOVETO: return new Point2D.Double(coords[0], coords[1]); case PathIterator.SEG_QUADTO: return new Point2D.Double(coords[2], coords[3]); case ExtendedPathIterator.SEG_ARCTO: return new Point2D.Double(coords[5], coords[6]); case PathIterator.SEG_CLOSE: default: throw new Error( "invalid segmentType:" + segType ); // Should never happen: close segments are replaced with lineTo } }
// in sources/org/apache/batik/gvt/TextNode.java
public void setSelection(Mark begin, Mark end) { if ((begin.getTextNode() != this) || (end.getTextNode() != this)) throw new Error("Markers not from this TextNode"); beginMark = begin; endMark = end; }
// in sources/org/apache/batik/gvt/TextNode.java
private Object readResolve() throws java.io.ObjectStreamException { switch(type){ case ANCHOR_START: return START; case ANCHOR_MIDDLE: return MIDDLE; case ANCHOR_END: return END; default: throw new Error("Unknown Anchor type"); } }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
public void setPositionTransform(AffineTransform at) { fireGraphicsNodeChangeStarted(); invalidateGeometryCache(); this.positionTransform = at; if (positionTransform != null) { transform = new AffineTransform(positionTransform); if (viewingTransform != null) transform.concatenate(viewingTransform); } else if (viewingTransform != null) transform = new AffineTransform(viewingTransform); else transform = new AffineTransform(); if (transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else{ // The transform is not invertible. Use the same // transform. inverseTransform = transform; } fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
public void setViewingTransform(AffineTransform at) { fireGraphicsNodeChangeStarted(); invalidateGeometryCache(); this.viewingTransform = at; if (positionTransform != null) { transform = new AffineTransform(positionTransform); if (viewingTransform != null) transform.concatenate(viewingTransform); } else if (viewingTransform != null) transform = new AffineTransform(viewingTransform); else transform = new AffineTransform(); if(transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else{ // The transform is not invertible. Use the same // transform. inverseTransform = transform; } fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
public void setTransform(AffineTransform newTransform) { fireGraphicsNodeChangeStarted(); this.transform = newTransform; if(transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else { // The transform is not invertible. Use the same // transform. inverseTransform = transform; } if (parent != null) parent.invalidateGeometryCache(); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/text/ConcreteTextSelector.java
public void setSelection(Mark begin, Mark end) { TextNode node = begin.getTextNode(); if (node != end.getTextNode()) { throw new Error("Markers not from same TextNode"); } node.setSelection(begin, end); selectionNode = node; selectionNodeRoot = node.getRoot(); Object selection = getSelection(); Shape shape = node.getHighlightShape(); dispatchSelectionEvent(new SelectionEvent (selection, SelectionEvent.SELECTION_DONE, shape)); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
public ComponentTransferFunction createComponentTransferFunction (Element filterElement, Element funcElement) { int type = convertType(funcElement, ctx); switch (type) { case ComponentTransferFunction.DISCRETE: { float [] v = convertTableValues(funcElement, ctx); if (v == null) { return ConcreteComponentTransferFunction.getIdentityTransfer(); } else { return ConcreteComponentTransferFunction.getDiscreteTransfer(v); } } case ComponentTransferFunction.IDENTITY: { return ConcreteComponentTransferFunction.getIdentityTransfer(); } case ComponentTransferFunction.GAMMA: { // 'amplitude' attribute - default is 1 float amplitude = convertNumber(funcElement, SVG_AMPLITUDE_ATTRIBUTE, 1, ctx); // 'exponent' attribute - default is 1 float exponent = convertNumber(funcElement, SVG_EXPONENT_ATTRIBUTE, 1, ctx); // 'offset' attribute - default is 0 float offset = convertNumber(funcElement, SVG_OFFSET_ATTRIBUTE, 0, ctx); return ConcreteComponentTransferFunction.getGammaTransfer (amplitude, exponent, offset); } case ComponentTransferFunction.LINEAR: { // 'slope' attribute - default is 1 float slope = convertNumber(funcElement, SVG_SLOPE_ATTRIBUTE, 1, ctx); // 'intercept' attribute - default is 0 float intercept = convertNumber(funcElement, SVG_INTERCEPT_ATTRIBUTE, 0, ctx); return ConcreteComponentTransferFunction.getLinearTransfer (slope, intercept); } case ComponentTransferFunction.TABLE: { float [] v = convertTableValues(funcElement, ctx); if (v == null) { return ConcreteComponentTransferFunction.getIdentityTransfer(); } else { return ConcreteComponentTransferFunction.getTableTransfer(v); } } default: throw new Error("invalid convertType:" + type ); // can't be reached } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // Default region is the size of in (if in is SourceGraphic or // SourceAlpha it will already include a pad/crop to the // proper filter region size). Rectangle2D defaultRegion = in.getBounds2D(); Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); int type = convertType(filterElement, ctx); ColorMatrixRable colorMatrix; switch (type) { case ColorMatrixRable.TYPE_HUE_ROTATE: float a = convertValuesToHueRotate(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildHueRotate(a); break; case ColorMatrixRable.TYPE_LUMINANCE_TO_ALPHA: colorMatrix = ColorMatrixRable8Bit.buildLuminanceToAlpha(); break; case ColorMatrixRable.TYPE_MATRIX: float [][] matrix = convertValuesToMatrix(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildMatrix(matrix); break; case ColorMatrixRable.TYPE_SATURATE: float s = convertValuesToSaturate(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildSaturate(s); break; default: throw new Error("invalid convertType:" + type ); // can't be reached } colorMatrix.setSource(in); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(colorMatrix, filterElement); Filter filter = new PadRable8Bit(colorMatrix, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public void putBridge(String namespaceURI, String localName, Bridge bridge) { // start assert if (!(namespaceURI.equals(bridge.getNamespaceURI()) && localName.equals(bridge.getLocalName()))) { throw new Error("Invalid Bridge: "+ namespaceURI+"/"+bridge.getNamespaceURI()+" "+ localName+"/"+bridge.getLocalName()+" "+ bridge.getClass()); } // end assert if (namespaceURIMap == null) { namespaceURIMap = new HashMap(); } namespaceURI = ((namespaceURI == null)? "" : namespaceURI); HashMap localNameMap = (HashMap) namespaceURIMap.get(namespaceURI); if (localNameMap == null) { localNameMap = new HashMap(); namespaceURIMap.put(namespaceURI, localNameMap); } localNameMap.put(localName, bridge); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Rectangle2D convertFilterPrimitiveRegion(Element filterPrimitiveElement, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Rectangle2D defaultRegion, Rectangle2D filterRegion, BridgeContext ctx) { // 'primitiveUnits' - default is userSpaceOnUse String units = ""; if (filterElement != null) { units = getChainableAttributeNS(filterElement, null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, ctx); } short unitsType; if (units.length() == 0) { unitsType = USER_SPACE_ON_USE; } else { unitsType = parseCoordinateSystem (filterElement, SVG_FILTER_UNITS_ATTRIBUTE, units, ctx); } String xStr = "", yStr = "", wStr = "", hStr = ""; if (filterPrimitiveElement != null) { // 'x' attribute - default is defaultRegion.getX() xStr = filterPrimitiveElement.getAttributeNS(null, SVG_X_ATTRIBUTE); // 'y' attribute - default is defaultRegion.getY() yStr = filterPrimitiveElement.getAttributeNS(null, SVG_Y_ATTRIBUTE); // 'width' attribute - default is defaultRegion.getWidth() wStr = filterPrimitiveElement.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE); // 'height' attribute - default is defaultRegion.getHeight() hStr = filterPrimitiveElement.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE); } double x = defaultRegion.getX(); double y = defaultRegion.getY(); double w = defaultRegion.getWidth(); double h = defaultRegion.getHeight(); // resolve units in the (referenced) filteredElement's coordinate system UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, filteredElement); switch (unitsType) { case OBJECT_BOUNDING_BOX: Rectangle2D bounds = filteredNode.getGeometryBounds(); if (bounds != null) { if (xStr.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, SVG_X_ATTRIBUTE, uctx); x = bounds.getX() + x*bounds.getWidth(); } if (yStr.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, SVG_Y_ATTRIBUTE, uctx); y = bounds.getY() + y*bounds.getHeight(); } if (wStr.length() != 0) { w = UnitProcessor.svgHorizontalLengthToObjectBoundingBox (wStr, SVG_WIDTH_ATTRIBUTE, uctx); w *= bounds.getWidth(); } if (hStr.length() != 0) { h = UnitProcessor.svgVerticalLengthToObjectBoundingBox (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); h *= bounds.getHeight(); } } break; case USER_SPACE_ON_USE: if (xStr.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, SVG_X_ATTRIBUTE, uctx); } if (yStr.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, SVG_Y_ATTRIBUTE, uctx); } if (wStr.length() != 0) { w = UnitProcessor.svgHorizontalLengthToUserSpace (wStr, SVG_WIDTH_ATTRIBUTE, uctx); } if (hStr.length() != 0) { h = UnitProcessor.svgVerticalLengthToUserSpace (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); } break; default: throw new Error("invalid unitsType:" + unitsType); // can't be reached } Rectangle2D region = new Rectangle2D.Double(x, y, w, h); // Now, extend filter primitive region with dx/dy/dw/dh // settings (Batik extension). The dx/dy/dw/dh padding is // *always* in userSpaceOnUse space. units = ""; if (filterElement != null) { units = getChainableAttributeNS (filterElement, null, SVG12Constants.SVG_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE, ctx); } if (units.length() == 0) { unitsType = USER_SPACE_ON_USE; } else { unitsType = parseCoordinateSystem (filterElement, SVG12Constants.SVG_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE, units, ctx); } String dxStr = "", dyStr = "", dwStr = "", dhStr = ""; if (filterPrimitiveElement != null) { // 'batik:dx' attribute - default is 0 dxStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MX_ATRIBUTE); // 'batik:dy' attribute - default is 0 dyStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MY_ATRIBUTE); // 'batik:dw' attribute - default is 0 dwStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MW_ATRIBUTE); // 'batik:dh' attribute - default is 0 dhStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MH_ATRIBUTE); } if (dxStr.length() == 0) { dxStr = SVG12Constants.SVG_FILTER_MX_DEFAULT_VALUE; } if (dyStr.length() == 0) { dyStr = SVG12Constants.SVG_FILTER_MY_DEFAULT_VALUE; } if (dwStr.length() == 0) { dwStr = SVG12Constants.SVG_FILTER_MW_DEFAULT_VALUE; } if (dhStr.length() == 0) { dhStr = SVG12Constants.SVG_FILTER_MH_DEFAULT_VALUE; } region = extendRegion(dxStr, dyStr, dwStr, dhStr, unitsType, filteredNode, region, uctx); Rectangle2D.intersect(region, filterRegion, region); return region; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
protected static Rectangle2D convertRegion(String xStr, String yStr, String wStr, String hStr, short unitsType, GraphicsNode targetNode, UnitProcessor.Context uctx) { // construct the mask region in the appropriate coordinate system double x, y, w, h; switch (unitsType) { case OBJECT_BOUNDING_BOX: x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, SVG_X_ATTRIBUTE, uctx); y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, SVG_Y_ATTRIBUTE, uctx); w = UnitProcessor.svgHorizontalLengthToObjectBoundingBox (wStr, SVG_WIDTH_ATTRIBUTE, uctx); h = UnitProcessor.svgVerticalLengthToObjectBoundingBox (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); Rectangle2D bounds = targetNode.getGeometryBounds(); if (bounds != null ) { x = bounds.getX() + x*bounds.getWidth(); y = bounds.getY() + y*bounds.getHeight(); w *= bounds.getWidth(); h *= bounds.getHeight(); } else { x = y = w = h = 0; } break; case USER_SPACE_ON_USE: x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, SVG_X_ATTRIBUTE, uctx); y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, SVG_Y_ATTRIBUTE, uctx); w = UnitProcessor.svgHorizontalLengthToUserSpace (wStr, SVG_WIDTH_ATTRIBUTE, uctx); h = UnitProcessor.svgVerticalLengthToUserSpace (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); break; default: throw new Error("invalid unitsType:" + unitsType ); // can't be reached } return new Rectangle2D.Double(x, y, w, h); }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public void installSecurityManager(){ Policy policy = Policy.getPolicy(); BatikSecurityManager securityManager = new BatikSecurityManager(); // // If there is a java.security.policy property defined, // it takes precedence over the one passed to this object. // Otherwise, we default to the one passed to the constructor // ClassLoader cl = appMainClass.getClassLoader(); String securityPolicyProperty = System.getProperty(PROPERTY_JAVA_SECURITY_POLICY); if (securityPolicyProperty == null || securityPolicyProperty.equals("")) { // Specify app's security policy in the // system property. URL policyURL = getPolicyURL(); System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, policyURL.toString()); } // // The following detects whether the application is running in the // development environment, in which case it will set the // app.dev.base property or if it is running in the binary // distribution, in which case it will set the app.jar.base // property. These properties are expanded in the security // policy files. // Property expansion is used to provide portability of the // policy files between various code bases (e.g., file base, // server base, etc..). // URL mainClassURL = cl.getResource(appMainClassRelativeURL); if (mainClassURL == null){ // Something is really wrong: we would be running a class // which can't be found.... throw new Error(appMainClassRelativeURL); } String expandedMainClassName = mainClassURL.toString(); if (expandedMainClassName.startsWith(JAR_PROTOCOL) ) { setJarBase(expandedMainClassName); } else { setDevBase(expandedMainClassName); } // Install new security manager System.setSecurityManager(securityManager); lastSecurityManagerInstalled = securityManager; // Forces re-loading of the security policy policy.refresh(); if (securityPolicyProperty == null || securityPolicyProperty.equals("")) { System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, ""); } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
private void setJarBase(String expandedMainClassName){ // // Only set the app.jar.base if it is not already defined // String curAppJarBase = System.getProperty(PROPERTY_APP_JAR_BASE); if (curAppJarBase == null) { expandedMainClassName = expandedMainClassName.substring(JAR_PROTOCOL.length()); int codeBaseEnd = expandedMainClassName.indexOf(JAR_URL_FILE_SEPARATOR + appMainClassRelativeURL); if (codeBaseEnd == -1){ // Something is seriously wrong. This should *never* happen // as the APP_SECURITY_POLICY_URL is such that it will be // a substring of its corresponding URL value throw new Error(); } String appCodeBase = expandedMainClassName.substring(0, codeBaseEnd); // At this point appCodeBase contains the JAR file name // Now, we extract it. codeBaseEnd = appCodeBase.lastIndexOf('/'); if (codeBaseEnd == -1) { appCodeBase = ""; } else { appCodeBase = appCodeBase.substring(0, codeBaseEnd); } System.setProperty(PROPERTY_APP_JAR_BASE, appCodeBase); } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
private void setDevBase(String expandedMainClassName){ // // Only set the app.code.base property if it is not already // defined. // String curAppCodeBase = System.getProperty(PROPERTY_APP_DEV_BASE); if (curAppCodeBase == null) { int codeBaseEnd = expandedMainClassName.indexOf(APP_MAIN_CLASS_DIR + appMainClassRelativeURL); if (codeBaseEnd == -1){ // Something is seriously wrong. This should *never* happen // as the APP_SECURITY_POLICY_URL is such that it will be // a substring of its corresponding URL value throw new Error(); } String appCodeBase = expandedMainClassName.substring(0, codeBaseEnd); System.setProperty(PROPERTY_APP_DEV_BASE, appCodeBase); } }
11
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
0
(Lib) UnsupportedOperationException 67
              
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void set(Object o) { Rectangle r = (Rectangle)o; if (!removeOk) throw new IllegalStateException ("set can only be called directly after next/previous"); if (forward) idx--; if (idx+1<size) { if (rects[idx+1].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx>=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } rects[idx] = r; removeOk = false; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void add(Object o) { Rectangle r = (Rectangle)o; if (idx<size) { if (rects[idx].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx!=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } ensureCapacity(size+1); if (idx != size) System.arraycopy(rects, idx, rects, idx+1, size-idx); rects[idx] = r; idx++; removeOk = false; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFLZWDecoder.java
public byte[] decode(byte[] data, byte[] uncompData, int h) { if(data[0] == (byte)0x00 && data[1] == (byte)0x01) { throw new UnsupportedOperationException("TIFFLZWDecoder0"); } initializeStringTable(); this.data = data; this.h = h; this.uncompData = uncompData; // Initialize pointers bytePointer = 0; bitPointer = 0; dstIndex = 0; nextData = 0; nextBits = 0; int code, oldCode = 0; byte[] string; while ( ((code = getNextCode()) != 257) && dstIndex != uncompData.length) { if (code == 256) { initializeStringTable(); code = getNextCode(); if (code == 257) { break; } writeString(stringTable[code]); oldCode = code; } else { if (code < tableIndex) { string = stringTable[code]; writeString(string); addStringToTable(stringTable[oldCode], string[0]); oldCode = code; } else { string = stringTable[oldCode]; string = composeString(string, string[0]); writeString(string); addStringToTable(string); oldCode = code; } } } // Horizontal Differencing Predictor if (predictor == 2) { int count; for (int j = 0; j < h; j++) { count = samplesPerPixel * (j * w + 1); for (int i = samplesPerPixel; i < w * samplesPerPixel; i++) { uncompData[count] += uncompData[count - samplesPerPixel]; count++; } } } return uncompData; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { Iterator iter; iter = ImageIO.getImageWritersByMIMEType(getMIMEType()); javax.imageio.ImageWriter iiowriter = null; try { iiowriter = (javax.imageio.ImageWriter)iter.next(); if (iiowriter != null) { iiowriter.addIIOWriteWarningListener(this); ImageOutputStream imgout = null; try { imgout = ImageIO.createImageOutputStream(out); ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params); ImageTypeSpecifier type; if (iwParam.getDestinationType() != null) { type = iwParam.getDestinationType(); } else { type = ImageTypeSpecifier.createFromRenderedImage(image); } //Handle metadata IIOMetadata meta = iiowriter.getDefaultImageMetadata( type, iwParam); //meta might be null for some JAI codecs as they don't support metadata if (params != null && meta != null) { meta = updateMetadata(meta, params); } //Write image iiowriter.setOutput(imgout); IIOImage iioimg = new IIOImage(image, null, meta); iiowriter.write(null, iioimg, iwParam); } finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } } } else { throw new UnsupportedOperationException("No ImageIO codec for writing " + getMIMEType() + " is available!"); } } finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
Override public void run() { Filter filt; try{ Iterator<ImageReader> iter = ImageIO.getImageReadersByMIMEType( getMimeTypes().get(0).toString()); if (!iter.hasNext()) { throw new UnsupportedOperationException( "No image reader for " + getFormatName() + " available!"); } ImageReader reader = iter.next(); ImageInputStream imageIn = ImageIO.createImageInputStream(is); reader.setInput(imageIn, true); int imageIndex = 0; dr.setBounds(new Rectangle2D.Double (0, 0, reader.getWidth(imageIndex), reader.getHeight(imageIndex))); CachableRed cr; //Naive approach possibly wasting lots of memory //and ignoring the gamma correction done by PNGRed :-( //Matches the code used by the former JPEGRegistryEntry, though. BufferedImage bi = reader.read(imageIndex); cr = GraphicsUtil.wrap(bi); cr = new Any2sRGBRed(cr); cr = new FormatRed(cr, GraphicsUtil.sRGB_Unpre); WritableRaster wr = (WritableRaster)cr.getData(); ColorModel cm = cr.getColorModel(); BufferedImage image = new BufferedImage (cm, wr, cm.isAlphaPremultiplied(), null); cr = GraphicsUtil.wrap(image); filt = new RedRable(cr); } catch (IOException ioe) { // Something bad happened here... filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); } catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; } catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); } dr.setSource(filt); }
// in sources/org/apache/batik/ext/awt/image/SVGComposite.java
public CompositeContext createContext(ColorModel srcCM, ColorModel dstCM, RenderingHints hints) { if (false) { ColorSpace srcCS = srcCM.getColorSpace(); ColorSpace dstCS = dstCM.getColorSpace(); System.out.println("srcCS: " + srcCS); System.out.println("dstCS: " + dstCS); System.out.println ("lRGB: " + ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)); System.out.println ("sRGB: " + ColorSpace.getInstance(ColorSpace.CS_sRGB)); } // Orig Time no int_pack = 51792 // Simple int_pack = 19600 boolean use_int_pack = (is_INT_PACK(srcCM) && is_INT_PACK(dstCM)); // use_int_pack = false; switch (rule.getRule()) { case CompositeRule.RULE_OVER: if (!dstCM.hasAlpha()) { if (use_int_pack) return new OverCompositeContext_INT_PACK_NA(srcCM, dstCM); else return new OverCompositeContext_NA (srcCM, dstCM); } if (!use_int_pack) return new OverCompositeContext(srcCM, dstCM); if (srcCM.isAlphaPremultiplied()) return new OverCompositeContext_INT_PACK(srcCM, dstCM); else return new OverCompositeContext_INT_PACK_UNPRE(srcCM, dstCM); case CompositeRule.RULE_IN: if (use_int_pack) return new InCompositeContext_INT_PACK(srcCM, dstCM); else return new InCompositeContext (srcCM, dstCM); case CompositeRule.RULE_OUT: if (use_int_pack) return new OutCompositeContext_INT_PACK(srcCM, dstCM); else return new OutCompositeContext (srcCM, dstCM); case CompositeRule.RULE_ATOP: if (use_int_pack) return new AtopCompositeContext_INT_PACK(srcCM, dstCM); else return new AtopCompositeContext(srcCM, dstCM); case CompositeRule.RULE_XOR: if (use_int_pack) return new XorCompositeContext_INT_PACK(srcCM, dstCM); else return new XorCompositeContext (srcCM, dstCM); case CompositeRule.RULE_ARITHMETIC: float [] coeff = rule.getCoefficients(); if (use_int_pack) return new ArithCompositeContext_INT_PACK_LUT (srcCM, dstCM, coeff[0], coeff[1], coeff[2], coeff[3]); else return new ArithCompositeContext (srcCM, dstCM, coeff[0], coeff[1], coeff[2], coeff[3]); case CompositeRule.RULE_MULTIPLY: if (use_int_pack) return new MultiplyCompositeContext_INT_PACK(srcCM, dstCM); else return new MultiplyCompositeContext(srcCM, dstCM); case CompositeRule.RULE_SCREEN: if (use_int_pack) return new ScreenCompositeContext_INT_PACK(srcCM, dstCM); else return new ScreenCompositeContext (srcCM, dstCM); case CompositeRule.RULE_DARKEN: if (use_int_pack) return new DarkenCompositeContext_INT_PACK(srcCM, dstCM); else return new DarkenCompositeContext (srcCM, dstCM); case CompositeRule.RULE_LIGHTEN: if (use_int_pack) return new LightenCompositeContext_INT_PACK(srcCM, dstCM); else return new LightenCompositeContext (srcCM, dstCM); default: throw new UnsupportedOperationException ("Unknown composite rule requested."); } }
// in sources/org/apache/batik/dom/svg/SVGOMUseElement.java
public SVGElementInstance getInstanceRoot() { throw new UnsupportedOperationException ("SVGUseElement.getInstanceRoot is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMUseElement.java
public SVGElementInstance getAnimatedInstanceRoot() { throw new UnsupportedOperationException ("SVGUseElement.getAnimatedInstanceRoot is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMComponentTransferFunctionElement.java
public SVGAnimatedNumberList getTableValues() { // XXX throw new UnsupportedOperationException ("SVGComponentTransferFunctionElement.getTableValues is not implemented"); // return tableValues; }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public org.w3c.dom.stylesheets.StyleSheet getSheet() { throw new UnsupportedOperationException ("LinkStyle.getSheet() is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java
public SVGAnimatedNumber getBaseFrequencyX() { throw new UnsupportedOperationException ("SVGFETurbulenceElement.getBaseFrequencyX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java
public SVGAnimatedNumber getBaseFrequencyY() { throw new UnsupportedOperationException ("SVGFETurbulenceElement.getBaseFrequencyY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public SVGAnimatedInteger getFilterResX() { throw new UnsupportedOperationException ("SVGFilterElement.getFilterResX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public SVGAnimatedInteger getFilterResY() { throw new UnsupportedOperationException ("SVGFilterElement.getFilterResY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public void setFilterRes(int filterResX, int filterResY) { throw new UnsupportedOperationException ("SVGFilterElement.setFilterRes is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumberList getKernelMatrix() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelMatrix is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getOrderX() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getOrderX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getOrderY() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getOrderY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getTargetX() { // Default value relative to orderX... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getTargetX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getTargetY() { // Default value relative to orderY... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getTargetY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getDivisor() { // Default value relative to kernel matrix... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getDivisor is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getKernelUnitLengthX() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelUnitLengthX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getKernelUnitLengthY() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelUnitLengthY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEColorMatrixElement.java
public SVGAnimatedNumberList getValues() { throw new UnsupportedOperationException ("SVGFEColorMatrixElement.getValues is not implemented"); // XXX // return values; }
// in sources/org/apache/batik/dom/svg/SVGOMPathElement.java
public SVGAnimatedNumber getPathLength() { throw new UnsupportedOperationException ("SVGPathElement.getPathLength is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public boolean getUseCurrentView() { throw new UnsupportedOperationException ("SVGSVGElement.getUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setUseCurrentView(boolean useCurrentView) throws DOMException { throw new UnsupportedOperationException ("SVGSVGElement.setUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public SVGViewSpec getCurrentView() { throw new UnsupportedOperationException ("SVGSVGElement.getCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getRequiredFeatures(Element elt) { throw new UnsupportedOperationException ("SVGTests.getRequiredFeatures is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getRequiredExtensions(Element elt) { throw new UnsupportedOperationException ("SVGTests.getRequiredExtensions is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getSystemLanguage(Element elt) { throw new UnsupportedOperationException ("SVGTests.getSystemLanguage is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static boolean hasExtension(Element elt, String extension) { throw new UnsupportedOperationException ("SVGTests.hasExtension is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMGradientElement.java
public SVGAnimatedTransformList getGradientTransform() { throw new UnsupportedOperationException ("SVGGradientElement.getGradientTransform is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMViewElement.java
public SVGStringList getViewTarget() { throw new UnsupportedOperationException ("SVGViewElement.getViewTarget is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMViewElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSegList getAnimatedNormalizedPathSegList() { throw new UnsupportedOperationException ("SVGAnimatedPathData.getAnimatedNormalizedPathSegList is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEGaussianBlurElement.java
public SVGAnimatedNumber getStdDeviationX() { throw new UnsupportedOperationException ("SVGFEGaussianBlurElement.getStdDeviationX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEGaussianBlurElement.java
public SVGAnimatedNumber getStdDeviationY() { throw new UnsupportedOperationException ("SVGFEGaussianBlurElement.getStdDeviationY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
public SVGAnimatedTransformList getPatternTransform() { throw new UnsupportedOperationException ("SVGPatternElement.getPatternTransform is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEMorphologyElement.java
public SVGAnimatedNumber getRadiusX() { throw new UnsupportedOperationException ("SVGFEMorphologyElement.getRadiusX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEMorphologyElement.java
public SVGAnimatedNumber getRadiusY() { throw new UnsupportedOperationException ("SVGFEMorphologyElement.getRadiusY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleSheet createCSSStyleSheet(String title, String media) { throw new UnsupportedOperationException ("DOMImplementationCSS.createCSSStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleDeclaration createCSSStyleDeclaration() { throw new UnsupportedOperationException ("CSSStyleDeclarationFactory.createCSSStyleDeclaration is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public StyleSheet createStyleSheet(Node n, HashTable attrs) { throw new UnsupportedOperationException ("StyleSheetFactory.createStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleSheet getUserAgentStyleSheet() { throw new UnsupportedOperationException ("StyleSheetFactory.getUserAgentStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
protected void updateAnimatedValue(AnimatableValue val) { // XXX TODO throw new UnsupportedOperationException ("Animation of marker orient value is not implemented"); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public AnimatableValue getUnderlyingValue(AnimationTarget target) { // XXX TODO throw new UnsupportedOperationException ("Animation of marker orient value is not implemented"); }
// in sources/org/apache/batik/dom/svg/SVGOMSymbolElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEDiffuseLightingElement.java
public SVGAnimatedNumber getKernelUnitLengthX() { throw new UnsupportedOperationException ("SVGFEDiffuseLightingElement.getKernelUnitLengthX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEDiffuseLightingElement.java
public SVGAnimatedNumber getKernelUnitLengthY() { throw new UnsupportedOperationException ("SVGFEDiffuseLightingElement.getKernelUnitLengthY is not implemented"); // XXX }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public CSSStyleDeclaration getStyle() { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public CSSValue getPresentationAttribute(String name) { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public SVGAnimatedString getClassName() { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean addAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean addAll(int index, Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean removeAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void clear() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public List subList(int fromIndex, int toIndex) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
private void incrementKeyTarget() { // <!> FIXME TODO: Not implemented. throw new UnsupportedOperationException("Increment not implemented."); }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
private void decrementKeyTarget() { // <!> FIXME TODO: Not implemented. throw new UnsupportedOperationException("Decrement not implemented."); }
// in sources/org/apache/batik/util/DoublyIndexedTable.java
public void remove() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/util/RunnableQueue.java
public void remove() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
private void throwUnsupportedEx(){ throw new UnsupportedOperationException("you try to use an empty method in Adapter-class" ); }
0 0
(Lib) IllegalStateException 58
              
// in sources/org/apache/batik/apps/svgbrowser/LocalHistory.java
public void update(String uri) { if (currentURI < -1) { throw new IllegalStateException("Unexpected currentURI:" + currentURI ); } state = STABLE_STATE; if (++currentURI < visitedURIs.size()) { if (!visitedURIs.get(currentURI).equals(uri)) { int len = menu.getItemCount(); for (int i = len - 1; i >= index + currentURI + 1; i--) { JMenuItem mi = menu.getItem(i); group.remove(mi); menu.remove(i); } visitedURIs = visitedURIs.subList(0, currentURI + 1); } JMenuItem mi = menu.getItem(index + currentURI); group.remove(mi); menu.remove(index + currentURI); visitedURIs.set(currentURI, uri); } else { if (visitedURIs.size() >= 15) { visitedURIs.remove(0); JMenuItem mi = menu.getItem(index); group.remove(mi); menu.remove(index); currentURI--; } visitedURIs.add(uri); } // Computes the button text. String text = uri; int i = uri.lastIndexOf('/'); if (i == -1) { i = uri.lastIndexOf('\\' ); } if (i != -1) { text = uri.substring(i + 1); } JMenuItem mi = new JRadioButtonMenuItem(text); mi.setToolTipText(uri); mi.setActionCommand(uri); mi.addActionListener(actionListener); group.add(mi); mi.setSelected(true); menu.insert(mi, index + currentURI); }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void remove() { if (!removeOk) throw new IllegalStateException ("remove can only be called directly after next/previous"); if (forward) idx--; if (idx != size-1) System.arraycopy(rects, idx+1, rects, idx, size-(idx+1)); size--; rects[size] = null; removeOk = false; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void set(Object o) { Rectangle r = (Rectangle)o; if (!removeOk) throw new IllegalStateException ("set can only be called directly after next/previous"); if (forward) idx--; if (idx+1<size) { if (rects[idx+1].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx>=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } rects[idx] = r; removeOk = false; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private long getOffset(OutputStream out) throws IOException { if(out instanceof ByteArrayOutputStream) { return ((ByteArrayOutputStream)out).size(); } else if(out instanceof SeekableOutputStream) { return ((SeekableOutputStream)out).getFilePointer(); } else { // Shouldn't happen. throw new IllegalStateException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPalette() { if (!paletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam3")); } return (int[])(palette.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBackgroundPaletteIndex() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam4")); } return backgroundPaletteIndex; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public byte[] getPaletteTransparency() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam5")); } byte[] alpha = new byte[transparency.length]; for (int i = 0; i < alpha.length; i++) { alpha[i] = (byte)transparency[i]; } return alpha; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBackgroundGray() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam6")); } return backgroundPaletteGray; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getTransparentGray() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam7")); } int gray = transparency[0]; return gray; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBitShift() { if (!bitShiftSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam8")); } return bitShift; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getBackgroundRGB() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam9")); } return backgroundRGB; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getTransparentRGB() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam10")); } return (int[])(transparency.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBitDepth() { if (!bitDepthSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam11")); } return bitDepth; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public float[] getChromaticity() { if (!chromaticitySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam12")); } return (float[])(chromaticity.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public float getGamma() { if (!gammaSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam13")); } return gamma; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPaletteHistogram() { if (!paletteHistogramSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam14")); } return paletteHistogram; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public byte[] getICCProfileData() { if (!ICCProfileDataSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam15")); } return (byte[])(ICCProfileData.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPhysicalDimension() { if (!physicalDimensionSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam16")); } return (int[])(physicalDimension.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public PNGSuggestedPaletteEntry[] getSuggestedPalette() { if (!suggestedPaletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam17")); } return (PNGSuggestedPaletteEntry[])(suggestedPalette.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getSignificantBits() { if (!significantBitsSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam18")); } return (int[])significantBits.clone(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getSRGBIntent() { if (!SRGBIntentSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam19")); } return SRGBIntent; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public String[] getText() { if (!textSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam20")); } return text; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public Date getModificationTime() { if (!modificationTimeSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam21")); } return modificationTime; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public String[] getCompressedText() { if (!zTextSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam22")); } return zText; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
protected void renderGVTTree() { Rectangle visRect = getRenderRect(); if (gvtRoot == null || visRect.width <= 0 || visRect.height <= 0) { return; } // Renderer setup. if (renderer == null || renderer.getTree() != gvtRoot) { renderer = createImageRenderer(); renderer.setTree(gvtRoot); } // Area of interest computation. AffineTransform inv; try { inv = renderingTransform.createInverse(); } catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); } Shape s = inv.createTransformedShape(visRect); // Rendering thread setup. gvtTreeRenderer = new GVTTreeRenderer(renderer, renderingTransform, doubleBufferedRendering, s, visRect.width, visRect.height); gvtTreeRenderer.setPriority(Thread.MIN_PRIORITY); Iterator it = gvtTreeRendererListeners.iterator(); while (it.hasNext()) { gvtTreeRenderer.addGVTTreeRendererListener ((GVTTreeRendererListener)it.next()); } // Disable the dispatch during the rendering // to avoid concurrent access to the GVT tree. if (eventDispatcher != null) { eventDispatcher.setEventDispatchEnabled(false); } gvtTreeRenderer.start(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void remove() { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.remove(lastRet); if (lastRet < cursor) { cursor--; } lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void set(Object o) { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.set(lastRet, o); expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/bridge/UpdateManager.java
public void dispatchSVGUnLoadEvent() { if (!started) { throw new IllegalStateException("UpdateManager not started."); } // Invoke first to cancel the pending tasks updateRunnableQueue.preemptLater(new Runnable() { public void run() { synchronized (UpdateManager.this) { AbstractEvent evt = (AbstractEvent) ((DocumentEvent)document).createEvent("SVGEvents"); String type; if (bridgeContext.isSVG12()) { type = "unload"; } else { type = "SVGUnload"; } evt.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, type, false, // canBubbleArg false); // cancelableArg ((EventTarget)(document.getDocumentElement())). dispatchEvent(evt); running = false; // Now shut everything down and disconnect // everything before we send the // UpdateMangerStopped event. scriptingEnvironment.interrupt(); updateRunnableQueue.getThread().halt(); bridgeContext.dispose(); // Send the UpdateManagerStopped event. UpdateManagerEvent ev = new UpdateManagerEvent (UpdateManager.this, null, null); fireEvent(stoppedDispatcher, ev); } } }); resume(); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Map getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result) { SVGTextContentElement tce = null; if (element instanceof SVGTextContentElement) { // 'a' elements aren't SVGTextContentElements, so they shouldn't // be checked for 'textLength' or 'lengthAdjust' attributes. tce = (SVGTextContentElement) element; } Map inheritMap = null; String s; if (SVG_NAMESPACE_URI.equals(element.getNamespaceURI()) && element.getLocalName().equals(SVG_ALT_GLYPH_TAG)) { result.put(ALT_GLYPH_HANDLER, new SVGAltGlyphHandler(ctx, element)); } // Add null TPI objects to the text (after we set it on the // Text we will swap in the correct values. TextPaintInfo pi = new TextPaintInfo(); // Set some basic props so we can get bounds info for complex paints. pi.visible = true; pi.fillPaint = Color.black; result.put(PAINT_INFO, pi); elemTPI.put(element, pi); if (textPath != null) { result.put(TEXTPATH, textPath); } // Text-anchor TextNode.Anchor a = TextUtilities.convertTextAnchor(element); result.put(ANCHOR_TYPE, a); // Font family List fontList = getFontList(ctx, element, result); result.put(GVT_FONTS, fontList); // Text baseline adjustment. Object bs = TextUtilities.convertBaselineShift(element); if (bs != null) { result.put(BASELINE_SHIFT, bs); } // Unicode-bidi mode Value val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.UNICODE_BIDI_INDEX); s = val.getStringValue(); if (s.charAt(0) == 'n') { if (bidiLevel != null) result.put(TextAttribute.BIDI_EMBEDDING, bidiLevel); } else { // Text direction // XXX: this needs to coordinate with the unicode-bidi // property, so that when an explicit reversal // occurs, the BIDI_EMBEDDING level is // appropriately incremented or decremented. // Note that direction is implicitly handled by unicode // BiDi algorithm in most cases, this property // is only needed when one wants to override the // normal writing direction for a string/substring. val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.DIRECTION_INDEX); String rs = val.getStringValue(); int cbidi = 0; if (bidiLevel != null) cbidi = bidiLevel.intValue(); // We don't care if it was embed or override we just want // it's level here. So map override to positive value. if (cbidi < 0) cbidi = -cbidi; switch (rs.charAt(0)) { case 'l': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_LTR); if ((cbidi & 0x1) == 1) cbidi++; // was odd now even else cbidi+=2; // next greater even number break; case 'r': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); if ((cbidi & 0x1) == 1) cbidi+=2; // next greater odd number else cbidi++; // was even now odd break; } switch (s.charAt(0)) { case 'b': // bidi-override cbidi = -cbidi; // For bidi-override we want a negative number. break; } result.put(TextAttribute.BIDI_EMBEDDING, new Integer(cbidi)); } // Writing mode val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.WRITING_MODE_INDEX); s = val.getStringValue(); switch (s.charAt(0)) { case 'l': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_LTR); break; case 'r': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_RTL); break; case 't': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_TTB); break; } // glyph-orientation-vertical val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX); int primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: // auto result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_AUTO); break; case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (V):" + primitiveType ); } // glyph-orientation-horizontal val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_HORIZONTAL_INDEX); primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (H):" + primitiveType ); } // text spacing properties... // Letter Spacing Float sp = TextUtilities.convertLetterSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.LETTER_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Word spacing sp = TextUtilities.convertWordSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.WORD_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Kerning sp = TextUtilities.convertKerning(element); if (sp != null) { result.put(GVTAttributedCharacterIterator.TextAttribute.KERNING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } if (tce == null) { return inheritMap; } try { // textLength AbstractSVGAnimatedLength textLength = (AbstractSVGAnimatedLength) tce.getTextLength(); if (textLength.isSpecified()) { if (inheritMap == null) { inheritMap = new HashMap(); } Object value = new Float(textLength.getCheckedValue()); result.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); inheritMap.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); // lengthAdjust SVGOMAnimatedEnumeration _lengthAdjust = (SVGOMAnimatedEnumeration) tce.getLengthAdjust(); if (_lengthAdjust.getCheckedVal() == SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS) { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); } else { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } return inheritMap; }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static int convertPointerEvents(Element e) { Value v = getComputedStyle(e, SVGCSSEngine.POINTER_EVENTS_INDEX); String s = v.getStringValue(); switch(s.charAt(0)) { case 'v': if (s.length() == 7) { return GraphicsNode.VISIBLE; } else { switch(s.charAt(7)) { case 'p': return GraphicsNode.VISIBLE_PAINTED; case 'f': return GraphicsNode.VISIBLE_FILL; case 's': return GraphicsNode.VISIBLE_STROKE; default: // can't be reached throw new IllegalStateException("unexpected event, must be one of (p,f,s) is:" + s.charAt(7) ); } } case 'p': return GraphicsNode.PAINTED; case 'f': return GraphicsNode.FILL; case 's': return GraphicsNode.STROKE; case 'a': return GraphicsNode.ALL; case 'n': return GraphicsNode.NONE; default: // can't be reached throw new IllegalStateException("unexpected event, must be one of (v,p,f,s,a,n) is:" + s.charAt(0) ); } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Rectangle2D convertEnableBackground(Element e /*, UnitProcessor.Context uctx*/) { Value v = getComputedStyle(e, SVGCSSEngine.ENABLE_BACKGROUND_INDEX); if (v.getCssValueType() != CSSValue.CSS_VALUE_LIST) { return null; // accumulate } ListValue lv = (ListValue)v; int length = lv.getLength(); switch (length) { case 1: return CompositeGraphicsNode.VIEWPORT; // new case 5: // new <x>,<y>,<width>,<height> float x = lv.item(1).getFloatValue(); float y = lv.item(2).getFloatValue(); float w = lv.item(3).getFloatValue(); float h = lv.item(4).getFloatValue(); return new Rectangle2D.Float(x, y, w, h); default: throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static float[] convertClip(Element e) { Value v = getComputedStyle(e, SVGCSSEngine.CLIP_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_RECT: float [] off = new float[4]; off[0] = v.getTop().getFloatValue(); off[1] = v.getRight().getFloatValue(); off[2] = v.getBottom().getFloatValue(); off[3] = v.getLeft().getFloatValue(); return off; case CSSPrimitiveValue.CSS_IDENT: return null; // 'auto' means no offsets default: // can't be reached throw new IllegalStateException("Unexpected primitiveType:" + primitiveType ); } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Filter convertFilter(Element filteredElement, GraphicsNode filteredNode, BridgeContext ctx) { Value v = getComputedStyle(filteredElement, SVGCSSEngine.FILTER_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'filter:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element filter = ctx.getReferencedElement(filteredElement, uri); Bridge bridge = ctx.getBridge(filter); if (bridge == null || !(bridge instanceof FilterBridge)) { throw new BridgeException(ctx, filteredElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((FilterBridge)bridge).createFilter(ctx, filter, filteredElement, filteredNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static ClipRable convertClipPath(Element clippedElement, GraphicsNode clippedNode, BridgeContext ctx) { Value v = getComputedStyle(clippedElement, SVGCSSEngine.CLIP_PATH_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'clip-path:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element cp = ctx.getReferencedElement(clippedElement, uri); Bridge bridge = ctx.getBridge(cp); if (bridge == null || !(bridge instanceof ClipBridge)) { throw new BridgeException(ctx, clippedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((ClipBridge)bridge).createClip(ctx, cp, clippedElement, clippedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Mask convertMask(Element maskedElement, GraphicsNode maskedNode, BridgeContext ctx) { Value v = getComputedStyle(maskedElement, SVGCSSEngine.MASK_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'mask:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element m = ctx.getReferencedElement(maskedElement, uri); Bridge bridge = ctx.getBridge(m); if (bridge == null || !(bridge instanceof MaskBridge)) { throw new BridgeException(ctx, maskedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MaskBridge)bridge).createMask(ctx, m, maskedElement, maskedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void invokeLater(Runnable r) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (list) { list.push(new Link(r)); list.notify(); } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void invokeAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.push(l); list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public void preemptLater(Runnable r) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (list) { list.add(preemptCount, new Link(r)); preemptCount++; list.notify(); } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void preemptAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.add(preemptCount, l); preemptCount++; list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public void suspendExecution(boolean waitTillSuspended) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } // System.err.println("Suspend Called"); synchronized (stateLock) { wasResumed = false; if (state == SUSPENDED) { // already suspended, notify stateLock so an event is // generated. stateLock.notifyAll(); return; } if (state == RUNNING) { state = SUSPENDING; synchronized (list) { // Wake up run thread if it is waiting for jobs, // so we go into the suspended case (notifying // run-handler etc...) list.notify(); } } if (waitTillSuspended) { while (state == SUSPENDING) { try { stateLock.wait(); } catch(InterruptedException ie) { } } } } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void resumeExecution() { // System.err.println("Resume Called"); if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (stateLock) { wasResumed = true; if (state != RUNNING) { state = RUNNING; stateLock.notifyAll(); // wake it up. } } }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public int getIntegerValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public float getFloatValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getDimensionUnitText() { switch (lexicalUnitType) { case LexicalUnit.SAC_CENTIMETER: return UNIT_TEXT_CENTIMETER; case LexicalUnit.SAC_DEGREE: return UNIT_TEXT_DEGREE; case LexicalUnit.SAC_EM: return UNIT_TEXT_EM; case LexicalUnit.SAC_EX: return UNIT_TEXT_EX; case LexicalUnit.SAC_GRADIAN: return UNIT_TEXT_GRADIAN; case LexicalUnit.SAC_HERTZ: return UNIT_TEXT_HERTZ; case LexicalUnit.SAC_INCH: return UNIT_TEXT_INCH; case LexicalUnit.SAC_KILOHERTZ: return UNIT_TEXT_KILOHERTZ; case LexicalUnit.SAC_MILLIMETER: return UNIT_TEXT_MILLIMETER; case LexicalUnit.SAC_MILLISECOND: return UNIT_TEXT_MILLISECOND; case LexicalUnit.SAC_PERCENTAGE: return UNIT_TEXT_PERCENTAGE; case LexicalUnit.SAC_PICA: return UNIT_TEXT_PICA; case LexicalUnit.SAC_PIXEL: return UNIT_TEXT_PIXEL; case LexicalUnit.SAC_POINT: return UNIT_TEXT_POINT; case LexicalUnit.SAC_RADIAN: return UNIT_TEXT_RADIAN; case LexicalUnit.SAC_REAL: return UNIT_TEXT_REAL; case LexicalUnit.SAC_SECOND: return UNIT_TEXT_SECOND; default: throw new IllegalStateException("No Unit Text for type: " + lexicalUnitType); } }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getFunctionName() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public LexicalUnit getParameters() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getStringValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public LexicalUnit getSubValues() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public short getColorType() { Value value = valueProvider.getValue(); int cssValueType = value.getCssValueType(); switch ( cssValueType ) { case CSSValue.CSS_PRIMITIVE_VALUE: int primitiveType = value.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: { if (value.getStringValue().equalsIgnoreCase (CSSConstants.CSS_CURRENTCOLOR_VALUE)) return SVG_COLORTYPE_CURRENTCOLOR; return SVG_COLORTYPE_RGBCOLOR; } case CSSPrimitiveValue.CSS_RGBCOLOR: return SVG_COLORTYPE_RGBCOLOR; } // there was no case for this primitiveType, prevent throwing the other exception throw new IllegalStateException("Found unexpected PrimitiveType:" + primitiveType ); case CSSValue.CSS_VALUE_LIST: return SVG_COLORTYPE_RGBCOLOR_ICCCOLOR; } // should not happen throw new IllegalStateException("Found unexpected CssValueType:" + cssValueType ); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { String ident = value.getStringValue(); // Search for a direct computed value. Value v = (Value)computedValues.get(ident); if (v != null) { return v; } // Must be a system color... if (values.get(ident) == null) { throw new IllegalStateException("Not a system-color:" + ident ); } return engine.getCSSContext().getSystemColor(ident); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
protected void inlineStyleAttributeUpdated(CSSStylableElement elt, StyleMap style, short attrChange, String prevValue, String newValue) { boolean[] updated = styleDeclarationUpdateHandler.updatedProperties; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { updated[i] = false; } switch (attrChange) { case MutationEvent.ADDITION: // intentional fall-through case MutationEvent.MODIFICATION: if (newValue.length() > 0) { element = elt; try { parser.setSelectorFactory(CSSSelectorFactory.INSTANCE); parser.setConditionFactory(cssConditionFactory); styleDeclarationUpdateHandler.styleMap = style; parser.setDocumentHandler(styleDeclarationUpdateHandler); parser.parseStyleDeclaration(newValue); styleDeclarationUpdateHandler.styleMap = null; } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } finally { element = null; cssBaseURI = null; } } // Fall through case MutationEvent.REMOVAL: boolean removed = false; if (prevValue != null && prevValue.length() > 0) { // Check if the style map has cascaded styles which // come from the inline style attribute or override style. for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (style.isComputed(i) && !updated[i]) { short origin = style.getOrigin(i); if (origin >= StyleMap.INLINE_AUTHOR_ORIGIN) { // ToDo Jlint says: always same result ?? removed = true; updated[i] = true; } } } } if (removed) { invalidateProperties(elt, null, updated, true); } else { int count = 0; // Invalidate the relative values boolean fs = (fontSizeIndex == -1) ? false : updated[fontSizeIndex]; boolean lh = (lineHeightIndex == -1) ? false : updated[lineHeightIndex]; boolean cl = (colorIndex == -1) ? false : updated[colorIndex]; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (updated[i]) { count++; } else if ((fs && style.isFontSizeRelative(i)) || (lh && style.isLineHeightRelative(i)) || (cl && style.isColorRelative(i))) { updated[i] = true; clearComputedValue(style, i); count++; } } if (count > 0) { int[] props = new int[count]; count = 0; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (updated[i]) { props[count++] = i; } } invalidateProperties(elt, props, null, true); } } break; default: // Must not happen throw new IllegalStateException("Invalid attrChangeType"); } }
1
              
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
0
(Domain) SVGGraphics2DRuntimeException 50
              
// in sources/org/apache/batik/svggen/DOMTreeManager.java
public void setTopLevelGroup(Element topLevelGroup){ if(topLevelGroup == null) throw new SVGGraphics2DRuntimeException(ERR_TOP_LEVEL_GROUP_NULL); if(!SVG_G_TAG.equalsIgnoreCase(topLevelGroup.getTagName())) throw new SVGGraphics2DRuntimeException(ERR_TOP_LEVEL_GROUP_NOT_G); recycleTopLevelGroup(false); this.topLevelGroup = topLevelGroup; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setIDGenerator(SVGIDGenerator idGenerator) { if (idGenerator == null) throw new SVGGraphics2DRuntimeException(ERR_ID_GENERATOR_NULL); this.idGenerator = idGenerator; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setDOMFactory(Document domFactory) { if (domFactory == null) throw new SVGGraphics2DRuntimeException(ERR_DOM_FACTORY_NULL); this.domFactory = domFactory; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setExtensionHandler(ExtensionHandler extensionHandler) { if (extensionHandler == null) throw new SVGGraphics2DRuntimeException(ERR_EXTENSION_HANDLER_NULL); this.extensionHandler = extensionHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setImageHandler(ImageHandler imageHandler) { if (imageHandler == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_HANDLER_NULL); this.imageHandler = imageHandler; this.genericImageHandler = new SimpleImageHandler(imageHandler); }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setGenericImageHandler(GenericImageHandler genericImageHandler){ if (genericImageHandler == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_HANDLER_NULL); } this.imageHandler = null; this.genericImageHandler = genericImageHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setStyleHandler(StyleHandler styleHandler) { if (styleHandler == null) throw new SVGGraphics2DRuntimeException(ERR_STYLE_HANDLER_NULL); this.styleHandler = styleHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setErrorHandler(ErrorHandler errorHandler) { if (errorHandler == null) throw new SVGGraphics2DRuntimeException(ERR_ERROR_HANDLER_NULL); this.errorHandler = errorHandler; }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(Image image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth( null ) ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight( null ) ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = buf.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); } RenderedImage r = image.createDefaultRendering(); if (r == null) { handleEmptyImage(imageElement); } else { handleHREF(r, imageElement, generatorContext); } }
// in sources/org/apache/batik/svggen/SVGLookupOp.java
private String[] convertLookupTables(LookupOp lookupOp){ LookupTable lookupTable = lookupOp.getTable(); int nComponents = lookupTable.getNumComponents(); if((nComponents != 1) && (nComponents != 3) && (nComponents != 4)) throw new SVGGraphics2DRuntimeException(ERR_ILLEGAL_BUFFERED_IMAGE_LOOKUP_OP); StringBuffer[] lookupTableBuf = new StringBuffer[nComponents]; for(int i=0; i<nComponents; i++) lookupTableBuf[i] = new StringBuffer(); if(!(lookupTable instanceof ByteLookupTable)){ int[] src = new int[nComponents]; int[] dest= new int[nComponents]; int offset = lookupTable.getOffset(); // Offsets are used for constrained sources. Therefore, // the lookup values should never be used under offset. // There is no SVG equivalent for this behavior. // These values are mapped to identity. for(int i=0; i<offset; i++){ // Fill in string buffers for(int j=0; j<nComponents; j++){ // lookupTableBuf[j].append(Integer.toString(i)); lookupTableBuf[j].append(doubleString(i/255.0)).append(SPACE); } } for(int i=offset; i<=255; i++){ // Fill in source array Arrays.fill( src, i ); // Get destination values lookupTable.lookupPixel(src, dest); // Fill in string buffers for(int j=0; j<nComponents; j++){ lookupTableBuf[j].append(doubleString( dest[j]/255.0) ).append(SPACE); } } } else{ byte[] src = new byte[nComponents]; byte[] dest = new byte[nComponents]; int offset = lookupTable.getOffset(); // Offsets are used for constrained sources. Therefore, // the lookup values should never be used under offset. // There is no SVG equivalent for this behavior. // These values are mapped to identity. for(int i=0; i<offset; i++){ // Fill in string buffers for(int j=0; j<nComponents; j++){ // lookupTableBuf[j].append(Integer.toString(i)); lookupTableBuf[j].append( doubleString(i/255.0) ).append(SPACE); } } for(int i=0; i<=255; i++){ // Fill in source array Arrays.fill( src, (byte)(0xff & i) ); // Get destination values ((ByteLookupTable)lookupTable).lookupPixel(src, dest); // Fill in string buffers for(int j=0; j<nComponents; j++){ lookupTableBuf[j].append( doubleString( (0xff & dest[j])/255.0) ).append(SPACE); } } } String[] lookupTables = new String[nComponents]; for(int i=0; i<nComponents; i++) lookupTables[i] = lookupTableBuf[i].toString().trim(); /*for(int i=0; i<lookupTables.length; i++){ System.out.println(lookupTables[i]); }*/ return lookupTables; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, int x, int y, ImageObserver observer) { Element imageElement = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform xform = getGenericImageHandler().handleImage( img, imageElement, x, y, img.getWidth(null), img.getHeight(null), getGeneratorContext()); if (xform == null) { domGroupManager.addElement(imageElement); } else { AffineTransform inverseTransform = null; try { inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(imageElement); gc.transform(inverseTransform); } return true; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer){ Element imageElement = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform xform = getGenericImageHandler().handleImage( img, imageElement, x, y, width, height, getGeneratorContext()); if (xform == null) { domGroupManager.addElement(imageElement); } else { AffineTransform inverseTransform = null; try { inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(imageElement); gc.transform(inverseTransform); } return true; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs){ boolean retVal = true; if (xform == null) { retVal = drawImage(img, 0, 0, null); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.setTransform(savTransform); } return retVal; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void drawRenderedImage(RenderedImage img, AffineTransform trans2) { Element image = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform trans1 = getGenericImageHandler().handleImage( img, image, img.getMinX(), img.getMinY(), img.getWidth(), img.getHeight(), getGeneratorContext()); AffineTransform xform; // Concatenate the transformation we receive from the imageHandler // to the user-supplied one. Be aware that both may be null. if (trans2 == null) { xform = trans1; } else { if(trans1 == null) { xform = trans2; } else { xform = new AffineTransform(trans2); xform.concatenate(trans1); } } if(xform == null) { domGroupManager.addElement(image); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); }catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(image); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); domGroupManager.addElement(image); gc.setTransform(savTransform); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void drawRenderableImage(RenderableImage img, AffineTransform trans2){ Element image = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform trans1 = getGenericImageHandler().handleImage( img, image, img.getMinX(), img.getMinY(), img.getWidth(), img.getHeight(), getGeneratorContext()); AffineTransform xform; // Concatenate the transformation we receive from the imageHandler // to the user-supplied one. Be aware that both may be null. if (trans2 == null) { xform = trans1; } else { if(trans1 == null) { xform = trans2; } else { xform = new AffineTransform(trans2); xform.concatenate(trans1); } } if (xform == null) { domGroupManager.addElement(image); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); }catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(image); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); domGroupManager.addElement(image); gc.setTransform(savTransform); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(Image image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext) { int imageWidth = image.getWidth(null); int imageHeight = image.getHeight(null); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x, y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(RenderedImage image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext) { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x, y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(RenderableImage image, Element imageElement, double x, double y, double width, double height, SVGGeneratorContext generatorContext) { double imageWidth = image.getWidth(); double imageHeight = image.getHeight(); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x,y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = buildBufferedImage(new Dimension(width, height)); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/SVGRescaleOp.java
public SVGFilterDescriptor toSVG(RescaleOp rescaleOp) { // Reuse definition if rescaleOp has already been converted SVGFilterDescriptor filterDesc = (SVGFilterDescriptor)descMap.get(rescaleOp); Document domFactory = generatorContext.domFactory; if (filterDesc == null) { // // First time filter is converted: create its corresponding // SVG filter // Element filterDef = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FILTER_TAG); Element feComponentTransferDef = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_COMPONENT_TRANSFER_TAG); // Append transfer function for each component, setting // the attributes corresponding to the scale and offset. // Because we are using a RescaleOp as a BufferedImageOp, // the scaleFactors must be either: // + 1, in which case the same scale is applied to the // Red, Green and Blue components, // + 3, in which case the scale factors apply to the // Red, Green and Blue components // + 4, in which case the scale factors apply to the // Red, Green, Blue and Alpha components float[] offsets = rescaleOp.getOffsets(null); float[] scaleFactors = rescaleOp.getScaleFactors(null); if(offsets.length != scaleFactors.length) throw new SVGGraphics2DRuntimeException(ERR_SCALE_FACTORS_AND_OFFSETS_MISMATCH); if(offsets.length != 1 && offsets.length != 3 && offsets.length != 4) throw new SVGGraphics2DRuntimeException(ERR_ILLEGAL_BUFFERED_IMAGE_RESCALE_OP); Element feFuncR = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_R_TAG); Element feFuncG = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_G_TAG); Element feFuncB = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_B_TAG); Element feFuncA = null; String type = SVG_LINEAR_VALUE; if(offsets.length == 1){ String slope = doubleString(scaleFactors[0]); String intercept = doubleString(offsets[0]); feFuncR.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncG.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncB.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncR.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncG.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncB.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncR.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); feFuncG.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); feFuncB.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); } else if(offsets.length >= 3){ feFuncR.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncG.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncB.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncR.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[0])); feFuncG.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[1])); feFuncB.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[2])); feFuncR.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[0])); feFuncG.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[1])); feFuncB.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[2])); if(offsets.length == 4){ feFuncA = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_A_TAG); feFuncA.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncA.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[3])); feFuncA.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[3])); } } feComponentTransferDef.appendChild(feFuncR); feComponentTransferDef.appendChild(feFuncG); feComponentTransferDef.appendChild(feFuncB); if(feFuncA != null) feComponentTransferDef.appendChild(feFuncA); filterDef.appendChild(feComponentTransferDef); filterDef. setAttributeNS(null, SVG_ID_ATTRIBUTE, generatorContext.idGenerator. generateID(ID_PREFIX_FE_COMPONENT_TRANSFER)); // // Create a filter descriptor // // Process filter attribute // StringBuffer filterAttrBuf = new StringBuffer(URL_PREFIX); // filterAttrBuf.append(SIGN_POUND); // filterAttrBuf.append(filterDef.getAttributeNS(null, SVG_ID_ATTRIBUTE)); // filterAttrBuf.append(URL_SUFFIX); String filterAttrBuf = URL_PREFIX + SIGN_POUND + filterDef.getAttributeNS(null, SVG_ID_ATTRIBUTE) + URL_SUFFIX; filterDesc = new SVGFilterDescriptor(filterAttrBuf, filterDef); defSet.add(filterDef); descMap.put(rescaleOp, filterDesc); } return filterDesc; }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
private void saveBufferedImageToFile(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); // Create a new file in image directory File imageFile = null; // While the files we are generating exist, try to create another // id that is unique. while (imageFile == null) { String fileId = generatorContext.idGenerator.generateID(getPrefix()); imageFile = new File(imageDir, fileId + getSuffix()); if (imageFile.exists()) imageFile = null; } // Encode image here encodeImage(buf, imageFile); // Update HREF imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, urlRoot + "/" + imageFile.getName()); }
11
              
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
1
              
// in sources/org/apache/batik/svggen/DefaultErrorHandler.java
public void handleError(SVGGraphics2DRuntimeException ex) throws SVGGraphics2DRuntimeException { System.err.println(ex.getMessage()); }
(Domain) ParseException 40
              
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = EOF; return; case ':': nextChar(); type = COLON; return; case '[': nextChar(); type = LEFT_SQUARE_BRACKET; return; case ']': nextChar(); type = RIGHT_SQUARE_BRACKET; return; case '(': nextChar(); type = LEFT_PARENTHESIS; return; case ')': nextChar(); type = RIGHT_PARENTHESIS; return; case '*': nextChar(); type = ASTERISK; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (XMLUtilities.isXMLSpace((char) current)); nextToken(); return; case '\'': type = string1(); return; case '"': type = string2(); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; default: if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { do { nextChar(); } while (current != -1 && current != ':' && XMLUtilities.isXMLNameCharacter((char) current)); type = NAME; return; } nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string1() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string2() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '"': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/css/parser/Scanner.java
public void scanAtRule() throws ParseException { try { // waiting for EOF, ';' or '{' loop: for (;;) { switch (current) { case '{': int brackets = 1; for (;;) { nextChar(); switch (current) { case '}': if (--brackets > 0) { break; } case -1: break loop; case '{': brackets++; } } case -1: case ';': break loop; } nextChar(); } end = position; } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = LexicalUnits.EOF; return; case '{': nextChar(); type = LexicalUnits.LEFT_CURLY_BRACE; return; case '}': nextChar(); type = LexicalUnits.RIGHT_CURLY_BRACE; return; case '=': nextChar(); type = LexicalUnits.EQUAL; return; case '+': nextChar(); type = LexicalUnits.PLUS; return; case ',': nextChar(); type = LexicalUnits.COMMA; return; case ';': nextChar(); type = LexicalUnits.SEMI_COLON; return; case '>': nextChar(); type = LexicalUnits.PRECEDE; return; case '[': nextChar(); type = LexicalUnits.LEFT_BRACKET; return; case ']': nextChar(); type = LexicalUnits.RIGHT_BRACKET; return; case '*': nextChar(); type = LexicalUnits.ANY; return; case '(': nextChar(); type = LexicalUnits.LEFT_BRACE; return; case ')': nextChar(); type = LexicalUnits.RIGHT_BRACE; return; case ':': nextChar(); type = LexicalUnits.COLON; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (ScannerUtilities.isCSSSpace((char)current)); type = LexicalUnits.SPACE; return; case '/': nextChar(); if (current != '*') { type = LexicalUnits.DIVIDE; return; } // Comment nextChar(); start = position - 1; do { while (current != -1 && current != '*') { nextChar(); } do { nextChar(); } while (current != -1 && current == '*'); } while (current != -1 && current != '/'); if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.COMMENT; return; case '\'': // String1 type = string1(); return; case '"': // String2 type = string2(); return; case '<': nextChar(); if (current != '!') { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (current == '-') { nextChar(); if (current == '-') { nextChar(); type = LexicalUnits.CDO; return; } } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '-': nextChar(); if (current != '-') { type = LexicalUnits.MINUS; return; } nextChar(); if (current == '>') { nextChar(); type = LexicalUnits.CDC; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '|': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.DASHMATCH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '~': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.INCLUDES; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '#': nextChar(); if (ScannerUtilities.isCSSNameCharacter((char)current)) { start = position - 1; do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); type = LexicalUnits.HASH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '@': nextChar(); switch (current) { case 'c': case 'C': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'h') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 's') && isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.CHARSET_SYMBOL; return; } break; case 'f': case 'F': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), '-') && isEqualIgnoreCase(nextChar(), 'f') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'c') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.FONT_FACE_SYMBOL; return; } break; case 'i': case 'I': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORT_SYMBOL; return; } break; case 'm': case 'M': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 'd') && isEqualIgnoreCase(nextChar(), 'i') && isEqualIgnoreCase(nextChar(), 'a')) { nextChar(); type = LexicalUnits.MEDIA_SYMBOL; return; } break; case 'p': case 'P': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'g') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.PAGE_SYMBOL; return; } break; default: if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } start = position - 1; } do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); type = LexicalUnits.AT_KEYWORD; return; case '!': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace((char)current)); if (isEqualIgnoreCase(current, 'i') && isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORTANT_SYMBOL; return; } if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } else { throw new ParseException("character", reader.getLine(), reader.getColumn()); } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = dotNumber(); return; default: type = LexicalUnits.DOT; return; } case 'u': case 'U': nextChar(); switch (current) { case '+': boolean range = false; for (int i = 0; i < 6; i++) { nextChar(); switch (current) { case '?': range = true; break; default: if (range && !ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); if (range) { type = LexicalUnits.UNICODE_RANGE; return; } if (current == '-') { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); type = LexicalUnits.UNICODE_RANGE; return; } case 'r': case 'R': nextChar(); switch (current) { case 'l': case 'L': nextChar(); switch (current) { case '(': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)); switch (current) { case '\'': string1(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case '"': string2(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case ')': throw new ParseException("character", reader.getLine(), reader.getColumn()); default: if (!ScannerUtilities.isCSSURICharacter ((char)current)) { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } start = position - 1; do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSURICharacter ((char)current)); blankCharacters++; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; } } } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; default: if (current == '\\') { do { nextChar(); escape(); } while(current == '\\'); } else if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } // Identifier while ((current != -1) && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); while (current == '\\') { nextChar(); escape(); } } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string1() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; case '"': break; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string2() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break; case '"': break loop; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(true); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void escape() throws IOException { if (ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } } if ((current >= ' ' && current <= '~') || current >= 128) { nextChar(); return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); }
9
              
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
419
              
// in sources/org/apache/batik/anim/timing/TimedElement.java
protected float parseClockValue(String s, boolean parseOffset) throws ParseException { ClockParser p = new ClockParser(parseOffset); class Handler implements ClockHandler { protected float v = 0; public void clockValue(float newClockValue) { v = newClockValue; } } Handler h = new Handler(); p.setClockHandler(h); p.parse(s); return h.v; }
// in sources/org/apache/batik/parser/PointsParser.java
protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void startNumberList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void endNumberList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void startNumber() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void numberValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void endNumber() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultErrorHandler.java
public void error(ParseException e) throws ParseException { throw e; }
// in sources/org/apache/batik/parser/TimingSpecifierListParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); ((TimingSpecifierListHandler) timingSpecifierHandler) .startTimingSpecifierList(); skipSpaces(); if (current != -1) { for (;;) { Object[] spec = parseTimingSpecifier(); handleTimingSpecifier(spec); skipSpaces(); if (current == -1) { break; } if (current == ';') { current = reader.read(); continue; } reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportUnexpectedCharacterError( current ); } ((TimingSpecifierListHandler) timingSpecifierHandler) .endTimingSpecifierList(); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void startPath() throws ParseException { cs = new LinkedList(); c = new short[11]; ps = new LinkedList(); p = new float[11]; ccount = 0; pcount = 0; cindex = 0; pindex = 0; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void movetoRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_MOVETO_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void movetoAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_MOVETO_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void closePath() throws ParseException { command(SVGPathSeg.PATHSEG_CLOSEPATH); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoHorizontalRel(float x) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL); param(x); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoHorizontalAbs(float x) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS); param(x); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoVerticalRel(float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoVerticalAbs(float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL); param(x1); param(y1); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS); param(x1); param(y1); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL); param(x1); param(y1); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS); param(x1); param(y1); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_ARC_REL); param(rx); param(ry); param(xAxisRotation); param(largeArcFlag ? 1 : 0); param(sweepFlag ? 1 : 0); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_ARC_ABS); param(rx); param(ry); param(xAxisRotation); param(largeArcFlag ? 1 : 0); param(sweepFlag ? 1 : 0); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
protected void command(short val) throws ParseException { if (cindex == c.length) { cs.add(c); c = new short[c.length * 2 + 1]; cindex = 0; } c[cindex++] = val; ccount++; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
protected void param(float val) throws ParseException { if (pindex == p.length) { ps.add(p); p = new float[p.length * 2 + 1]; pindex = 0; } p[pindex++] = val; pcount++; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void endPath() throws ParseException { short[] allCommands = new short[ccount]; int pos = 0; Iterator it = cs.iterator(); while (it.hasNext()) { short[] a = (short[]) it.next(); System.arraycopy(a, 0, allCommands, pos, a.length); pos += a.length; } System.arraycopy(c, 0, allCommands, pos, cindex); cs.clear(); c = allCommands; float[] allParams = new float[pcount]; pos = 0; it = ps.iterator(); while (it.hasNext()) { float[] a = (float[]) it.next(); System.arraycopy(a, 0, allParams, pos, a.length); pos += a.length; } System.arraycopy(p, 0, allParams, pos, pindex); ps.clear(); p = allParams; }
// in sources/org/apache/batik/parser/NumberListParser.java
protected void doParse() throws ParseException, IOException { numberListHandler.startNumberList(); current = reader.read(); skipSpaces(); try { for (;;) { numberListHandler.startNumber(); float f = parseFloat(); numberListHandler.numberValue(f); numberListHandler.endNumber(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } numberListHandler.endNumberList(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PathParser p = new PathParser(); AWTPathProducer ph = new AWTPathProducer(); ph.setWindingRule(wr); p.setPathHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void startPath() throws ParseException { currentX = 0; currentY = 0; xCenter = 0; yCenter = 0; path = new ExtendedGeneralPath(windingRule); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void endPath() throws ParseException { }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void movetoRel(float x, float y) throws ParseException { path.moveTo(xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void movetoAbs(float x, float y) throws ParseException { path.moveTo(xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void closePath() throws ParseException { path.closePath(); Point2D pt = path.getCurrentPoint(); currentX = (float)pt.getX(); currentY = (float)pt.getY(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoRel(float x, float y) throws ParseException { path.lineTo(xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoAbs(float x, float y) throws ParseException { path.lineTo(xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoHorizontalRel(float x) throws ParseException { path.lineTo(xCenter = currentX += x, yCenter = currentY); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoHorizontalAbs(float x) throws ParseException { path.lineTo(xCenter = currentX = x, yCenter = currentY); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoVerticalRel(float y) throws ParseException { path.lineTo(xCenter = currentX, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoVerticalAbs(float y) throws ParseException { path.lineTo(xCenter = currentX, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX + x1, currentY + y1, xCenter = currentX + x2, yCenter = currentY + y2, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { path.curveTo(x1, y1, xCenter = x2, yCenter = y2, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX * 2 - xCenter, currentY * 2 - yCenter, xCenter = currentX + x2, yCenter = currentY + y2, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX * 2 - xCenter, currentY * 2 - yCenter, xCenter = x2, yCenter = y2, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { path.quadTo(xCenter = currentX + x1, yCenter = currentY + y1, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { path.quadTo(xCenter = x1, yCenter = y1, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { path.quadTo(xCenter = currentX * 2 - xCenter, yCenter = currentY * 2 - yCenter, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { path.quadTo(xCenter = currentX * 2 - xCenter, yCenter = currentY * 2 - yCenter, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { path.arcTo(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { path.arcTo(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/LengthListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler)lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler)lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(Reader r) throws ParseException { try { reader = new StreamNormalizingReader(r); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(InputStream is, String enc) throws ParseException { try { reader = new StreamNormalizingReader(is, enc); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(String s) throws ParseException { try { reader = new StringNormalizingReader(s); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void reportError(String key, Object[] args) throws ParseException { errorHandler.error(new ParseException(createErrorMessage(key, args), reader.getLine(), reader.getColumn())); }
// in sources/org/apache/batik/parser/NumberParser.java
protected float parseFloat() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; switch (current) { case '-': mantPos = false; // fallthrough case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return 0.0f; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; case '.': case 'e': case 'E': break m1; default: return 0.0f; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return 0.0f; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: if (!mantRead) { return 0.0f; } break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } switch (current) { case 'e': case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } return buildFloat(mant, exp); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } lengthHandler.endLength(); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void parseLength() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; int unitState = 0; switch (current) { case '-': mantPos = false; case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m1; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } boolean le = false; es: switch (current) { case 'e': le = true; case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 1; break es; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 2; break es; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } lengthHandler.lengthValue(NumberParser.buildFloat(mant, exp)); switch (unitState) { case 1: lengthHandler.em(); current = reader.read(); return; case 2: lengthHandler.ex(); current = reader.read(); return; } switch (current) { case 'e': current = reader.read(); switch (current) { case 'm': lengthHandler.em(); current = reader.read(); break; case 'x': lengthHandler.ex(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'p': current = reader.read(); switch (current) { case 'c': lengthHandler.pc(); current = reader.read(); break; case 't': lengthHandler.pt(); current = reader.read(); break; case 'x': lengthHandler.px(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'i': current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break; } lengthHandler.in(); current = reader.read(); break; case 'c': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.cm(); current = reader.read(); break; case 'm': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.mm(); current = reader.read(); break; case '%': lengthHandler.percentage(); current = reader.read(); break; } }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void startPath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void endPath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void movetoRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void movetoAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void closePath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoHorizontalRel(float x) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoHorizontalAbs(float x) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoVerticalRel(float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoVerticalAbs(float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void doParse() throws ParseException, IOException { bufferSize = 0; current = reader.read(); fragmentIdentifierHandler.startFragmentIdentifier(); ident: { String id = null; switch (current) { case 'x': bufferize(); current = reader.read(); if (current != 'p') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'o') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'n') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 't') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'r') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break ident; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break ident; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break ident; } current = reader.read(); if (current != '"' && current != '\'') { reportCharacterExpectedError( '\'', current ); break ident; } char q = (char)current; current = reader.read(); parseIdentifier(); id = getBufferContent(); bufferSize = 0; fragmentIdentifierHandler.idReference(id); if (current != q) { reportCharacterExpectedError( q, current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; case 's': bufferize(); current = reader.read(); if (current != 'v') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'g') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'V') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'w') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); parseViewAttributes(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; default: if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { break ident; } bufferize(); current = reader.read(); parseIdentifier(); } id = getBufferContent(); fragmentIdentifierHandler.idReference(id); } fragmentIdentifierHandler.endFragmentIdentifier(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseViewAttributes() throws ParseException, IOException { boolean first = true; loop: for (;;) { switch (current) { case -1: case ')': if (first) { reportUnexpectedCharacterError( current ); break loop; } // fallthrough default: break loop; case ';': if (first) { reportUnexpectedCharacterError( current ); break loop; } current = reader.read(); break; case 'v': first = false; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); break loop; } current = reader.read(); switch (current) { case 'B': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); float x = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float y = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float w = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float h = parseFloat(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.viewBox(x, y, w, h); if (current != ')' && current != ';') { reportCharacterExpectedError( ')', current ); break loop; } break; case 'T': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.startViewTarget(); id: for (;;) { bufferSize = 0; if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { reportUnexpectedCharacterError( current ); break loop; } bufferize(); current = reader.read(); parseIdentifier(); String s = getBufferContent(); fragmentIdentifierHandler.viewTarget(s); bufferSize = 0; switch (current) { case ')': current = reader.read(); break id; case ',': case ';': current = reader.read(); break; default: reportUnexpectedCharacterError( current ); break loop; } } fragmentIdentifierHandler.endViewTarget(); break; default: reportUnexpectedCharacterError( current ); break loop; } break; case 'p': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'v') { reportCharacterExpectedError( 'v', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'p') { reportCharacterExpectedError( 'p', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'R') { reportCharacterExpectedError( 'R', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); parsePreserveAspectRatio(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); break; case 't': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } fragmentIdentifierHandler.startTransformList(); tloop: for (;;) { try { current = reader.read(); switch (current) { case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; default: break tloop; } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } fragmentIdentifierHandler.endTransformList(); break; case 'z': first = false; current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break loop; } current = reader.read(); if (current != 'P') { reportCharacterExpectedError( 'P', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); switch (current) { case 'm': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'y') { reportCharacterExpectedError( 'y', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(true); break; case 'd': current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'b') { reportCharacterExpectedError( 'b', current ); break loop; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(false); break; default: reportUnexpectedCharacterError( current ); break loop; } if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseIdentifier() throws ParseException, IOException { for (;;) { if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { break; } bufferize(); current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall-through case 'Y': break; default: reportCharacterExpectedError( 'X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } if (skewX) { fragmentIdentifierHandler.skewX(sk); } else { fragmentIdentifierHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { fragmentIdentifierHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); fragmentIdentifierHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMaxYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMidYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMinYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipIdentifier(); break; } fragmentIdentifierHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } fragmentIdentifierHandler.slice(); current = reader.read(); } fragmentIdentifierHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void idReference(String s) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void viewBox(float x, float y, float width, float height) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startViewTarget() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void viewTarget(String name) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endViewTarget() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void rotate(float theta) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void rotate(float theta, float cx, float cy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void translate(float tx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void translate(float tx, float ty) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void scale(float sx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void scale(float sx, float sy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void skewX(float skx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void skewY(float sky) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void startNumberList() throws ParseException { as = new LinkedList(); a = new float[11]; count = 0; index = 0; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void numberValue(float v) throws ParseException { if (index == a.length) { as.add(a); a = new float[a.length * 2 + 1]; index = 0; } a[index++] = v; count++; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void endNumberList() throws ParseException { float[] all = new float[count]; int pos = 0; Iterator it = as.iterator(); while (it.hasNext()) { float[] b = (float[]) it.next(); System.arraycopy(b, 0, all, pos, b.length); pos += b.length; } System.arraycopy(a, 0, all, pos, index); as.clear(); a = all; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void startPoints() throws ParseException { startNumberList(); }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void point(float x, float y) throws ParseException { numberValue(x); numberValue(y); }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void endPoints() throws ParseException { endNumberList(); }
// in sources/org/apache/batik/parser/LengthPairListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler) lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipSpaces(); if (current == -1) { break; } if (current != ';') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler) lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/ClockParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); float clockValue = parseOffset ? parseOffset() : parseClockValue(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } if (clockHandler != null) { clockHandler.clockValue(clockValue); } }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void startTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void rotate(float theta) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void rotate(float theta, float cx, float cy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void translate(float tx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void translate(float tx, float ty) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void scale(float sx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void scale(float sx, float sy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void skewX(float skx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void skewY(float sky) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void startLengthList() throws ParseException { us = new LinkedList(); u = new short[11]; vs = new LinkedList(); v = new float[11]; count = 0; index = 0; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void numberValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void lengthValue(float val) throws ParseException { if (index == v.length) { vs.add(v); v = new float[v.length * 2 + 1]; us.add(u); u = new short[u.length * 2 + 1]; index = 0; } v[index] = val; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void startLength() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_NUMBER; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void endLength() throws ParseException { u[index++] = currentUnit; count++; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void em() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void ex() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void in() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void cm() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void mm() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void pc() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void pt() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void px() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void percentage() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void endLengthList() throws ParseException { float[] allValues = new float[count]; int pos = 0; Iterator it = vs.iterator(); while (it.hasNext()) { float[] a = (float[]) it.next(); System.arraycopy(a, 0, allValues, pos, a.length); pos += a.length; } System.arraycopy(v, 0, allValues, pos, index); vs.clear(); v = allValues; short[] allUnits = new short[count]; pos = 0; it = us.iterator(); while (it.hasNext()) { short[] a = (short[]) it.next(); System.arraycopy(a, 0, allUnits, pos, a.length); pos += a.length; } System.arraycopy(u, 0, allUnits, pos, index); us.clear(); u = allUnits; }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void startLength() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void lengthValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void em() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void ex() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void in() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void cm() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void mm() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void pc() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void pt() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void px() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void percentage() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); skipSpaces(); parsePreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { preserveAspectRatioHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); preserveAspectRatioHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMaxYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMidYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMinYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't',current ); skipIdentifier(); break; } preserveAspectRatioHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } preserveAspectRatioHandler.slice(); current = reader.read(); break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } preserveAspectRatioHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/AngleParser.java
protected void doParse() throws ParseException, IOException { angleHandler.startAngle(); current = reader.read(); skipSpaces(); try { float f = parseFloat(); angleHandler.angleValue(f); s: if (current != -1) { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: break s; } switch (current) { case 'd': current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); break; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError('g', current ); break; } angleHandler.deg(); current = reader.read(); break; case 'g': current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); break; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.grad(); current = reader.read(); break; case 'r': current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.rad(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } angleHandler.endAngle(); }
// in sources/org/apache/batik/parser/AbstractScanner.java
public int next() throws ParseException { blankCharacters = 0; start = position - 1; previousType = type; nextToken(); end = position - endGap(); return type; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToObjectBoundingBox(ur.value, ur.unit, d, ctx); }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void startLength() throws ParseException { }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void lengthValue(float v) throws ParseException { this.value = v; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void em() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void ex() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void in() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void cm() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void mm() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void pc() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void pt() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void px() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void percentage() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void startAngle() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void angleValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void deg() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void grad() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void rad() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void endAngle() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void startPoints() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void point(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void endPoints() throws ParseException { }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseTimingSpecifier() throws ParseException, IOException { skipSpaces(); boolean escaped = false; if (current == '\\') { escaped = true; current = reader.read(); } Object[] ret = null; if (current == '+' || (current == '-' && !escaped) || (current >= '0' && current <= '9')) { float offset = parseOffset(); ret = new Object[] { new Integer(TIME_OFFSET), new Float(offset) }; } else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { ret = parseIDValue(escaped); } else { reportUnexpectedCharacterError( current ); } return ret; }
// in sources/org/apache/batik/parser/TimingParser.java
protected String parseName() throws ParseException, IOException { StringBuffer sb = new StringBuffer(); boolean midEscaped = false; do { sb.append((char) current); current = reader.read(); midEscaped = false; if (current == '\\') { midEscaped = true; current = reader.read(); } } while (XMLUtilities.isXMLNameCharacter((char) current) && (midEscaped || (current != '-' && current != '.'))); return sb.toString(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseIDValue(boolean escaped) throws ParseException, IOException { String id = parseName(); if ((id.equals("accessKey") && useSVG11AccessKeys || id.equals("accesskey")) && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); if (current == -1) { reportError("end.of.stream", new Object[0]); } char key = (char) current; current = reader.read(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY), new Float(offset), new Character(key) }; } else if (id.equals("accessKey") && useSVG12AccessKeys && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); StringBuffer keyName = new StringBuffer(); while (current >= 'A' && current <= 'Z' || current >= 'a' && current <= 'z' || current >= '0' && current <= '9' || current == '+') { keyName.append((char) current); current = reader.read(); } if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY_SVG12), new Float(offset), keyName.toString() }; } else if (id.equals("wallclock") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); Calendar wallclockValue = parseWallclockValue(); skipSpaces(); if (current != ')') { reportError("character.unexpected", new Object[] { new Integer(current) }); } current = reader.read(); return new Object[] { new Integer(TIME_WALLCLOCK), wallclockValue }; } else if (id.equals("indefinite") && !escaped) { return new Object[] { new Integer(TIME_INDEFINITE) }; } else { if (current == '.') { current = reader.read(); if (current == '\\') { escaped = true; current = reader.read(); } if (!XMLUtilities.isXMLNameFirstCharacter((char) current)) { reportUnexpectedCharacterError( current ); } String id2 = parseName(); if ((id2.equals("begin") || id2.equals("end")) && !escaped) { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_SYNCBASE), new Float(offset), id, id2 }; } else if (id2.equals("repeat") && !escaped) { Integer repeatIteration = null; if (current == '(') { current = reader.read(); repeatIteration = new Integer(parseDigits()); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); } skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_REPEAT), new Float(offset), id, repeatIteration }; } else if (id2.equals("marker") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } String markerName = parseName(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); return new Object[] { new Integer(TIME_MEDIA_MARKER), id, markerName }; } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), id, id2 }; } } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), null, id }; } } }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseClockValue() throws ParseException, IOException { int d1 = parseDigits(); float offset; if (current == ':') { current = reader.read(); int d2 = parseDigits(); if (current == ':') { current = reader.read(); int d3 = parseDigits(); offset = d1 * 3600 + d2 * 60 + d3; } else { offset = d1 * 60 + d2; } if (current == '.') { current = reader.read(); offset += parseFraction(); } } else if (current == '.') { current = reader.read(); offset = (parseFraction() + d1) * parseUnit(); } else { offset = d1 * parseUnit(); } return offset; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseOffset() throws ParseException, IOException { boolean offsetNegative = false; if (current == '-') { offsetNegative = true; current = reader.read(); skipSpaces(); } else if (current == '+') { current = reader.read(); skipSpaces(); } if (offsetNegative) { return -parseClockValue(); } return parseClockValue(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected int parseDigits() throws ParseException, IOException { int value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } do { value = value * 10 + (current - '0'); current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseFraction() throws ParseException, IOException { float value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } float weight = 0.1f; do { value += weight * (current - '0'); weight *= 0.1f; current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseUnit() throws ParseException, IOException { if (current == 'h') { current = reader.read(); return 3600; } else if (current == 'm') { current = reader.read(); if (current == 'i') { current = reader.read(); if (current != 'n') { reportUnexpectedCharacterError( current ); } current = reader.read(); return 60; } else if (current == 's') { current = reader.read(); return 0.001f; } else { reportUnexpectedCharacterError( current ); } } else if (current == 's') { current = reader.read(); } return 1; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Calendar parseWallclockValue() throws ParseException, IOException { int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0, tzh = 0, tzm = 0; float frac = 0; boolean dateSpecified = false; boolean timeSpecified = false; boolean tzSpecified = false; boolean tzNegative = false; String tzn = null; int digits1 = parseDigits(); do { if (current == '-') { dateSpecified = true; y = digits1; current = reader.read(); M = parseDigits(); if (current != '-') { reportUnexpectedCharacterError( current ); } current = reader.read(); d = parseDigits(); if (current != 'T') { break; } current = reader.read(); digits1 = parseDigits(); if (current != ':') { reportUnexpectedCharacterError( current ); } } if (current == ':') { timeSpecified = true; h = digits1; current = reader.read(); m = parseDigits(); if (current == ':') { current = reader.read(); s = parseDigits(); if (current == '.') { current = reader.read(); frac = parseFraction(); } } if (current == 'Z') { tzSpecified = true; tzn = "UTC"; current = reader.read(); } else if (current == '+' || current == '-') { StringBuffer tznb = new StringBuffer(); tzSpecified = true; if (current == '-') { tzNegative = true; tznb.append('-'); } else { tznb.append('+'); } current = reader.read(); tzh = parseDigits(); if (tzh < 10) { tznb.append('0'); } tznb.append(tzh); if (current != ':') { reportUnexpectedCharacterError( current ); } tznb.append(':'); current = reader.read(); tzm = parseDigits(); if (tzm < 10) { tznb.append('0'); } tznb.append(tzm); tzn = tznb.toString(); } } } while (false); if (!dateSpecified && !timeSpecified) { reportUnexpectedCharacterError( current ); } Calendar wallclockTime; if (tzSpecified) { int offset = (tzNegative ? -1 : 1) * (tzh * 3600000 + tzm * 60000); wallclockTime = Calendar.getInstance(new SimpleTimeZone(offset, tzn)); } else { wallclockTime = Calendar.getInstance(); } if (dateSpecified && timeSpecified) { wallclockTime.set(y, M, d, h, m, s); } else if (dateSpecified) { wallclockTime.set(y, M, d, 0, 0, 0); } else { wallclockTime.set(Calendar.HOUR, h); wallclockTime.set(Calendar.MINUTE, m); wallclockTime.set(Calendar.SECOND, s); } if (frac == 0.0f) { wallclockTime.set(Calendar.MILLISECOND, (int) (frac * 1000)); } else { wallclockTime.set(Calendar.MILLISECOND, 0); } return wallclockTime; }
// in sources/org/apache/batik/parser/DefaultLengthListHandler.java
public void startLengthList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthListHandler.java
public void endLengthList() throws ParseException { }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public static AffineTransform createAffineTransform(Reader r) throws ParseException { TransformListParser p = new TransformListParser(); AWTTransformProducer th = new AWTTransformProducer(); p.setTransformListHandler(th); p.parse(r); return th.getAffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public static AffineTransform createAffineTransform(String s) throws ParseException { TransformListParser p = new TransformListParser(); AWTTransformProducer th = new AWTTransformProducer(); p.setTransformListHandler(th); p.parse(s); return th.getAffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void startTransformList() throws ParseException { affineTransform = new AffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { affineTransform.concatenate(new AffineTransform(a, b, c, d, e, f)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void rotate(float theta) throws ParseException { affineTransform.concatenate (AffineTransform.getRotateInstance( Math.toRadians( theta ) )); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void rotate(float theta, float cx, float cy) throws ParseException { AffineTransform at = AffineTransform.getRotateInstance( Math.toRadians( theta ), cx, cy); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void translate(float tx) throws ParseException { AffineTransform at = AffineTransform.getTranslateInstance(tx, 0); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void translate(float tx, float ty) throws ParseException { AffineTransform at = AffineTransform.getTranslateInstance(tx, ty); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void scale(float sx) throws ParseException { affineTransform.concatenate(AffineTransform.getScaleInstance(sx, sx)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void scale(float sx, float sy) throws ParseException { affineTransform.concatenate(AffineTransform.getScaleInstance(sx, sy)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void skewX(float skx) throws ParseException { affineTransform.concatenate (AffineTransform.getShearInstance(Math.tan( Math.toRadians( skx ) ), 0)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void skewY(float sky) throws ParseException { affineTransform.concatenate (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) ))); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public void endPoints() throws ParseException { path.closePath(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void startPoints() throws ParseException { path = new GeneralPath(windingRule); newPath = true; }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void point(float x, float y) throws ParseException { if (newPath) { newPath = false; path.moveTo(x, y); } else { path.lineTo(x, y); } }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void endPoints() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void startPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void none() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void meet() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void slice() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void endPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/parser/PathParser.java
protected void doParse() throws ParseException, IOException { pathHandler.startPath(); current = reader.read(); loop: for (;;) { try { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break; case 'z': case 'Z': current = reader.read(); pathHandler.closePath(); break; case 'm': parsem(); break; case 'M': parseM(); break; case 'l': parsel(); break; case 'L': parseL(); break; case 'h': parseh(); break; case 'H': parseH(); break; case 'v': parsev(); break; case 'V': parseV(); break; case 'c': parsec(); break; case 'C': parseC(); break; case 'q': parseq(); break; case 'Q': parseQ(); break; case 's': parses(); break; case 'S': parseS(); break; case 't': parset(); break; case 'T': parseT(); break; case 'a': parsea(); break; case 'A': parseA(); break; case -1: break loop; default: reportUnexpected(current); break; } } catch (ParseException e) { errorHandler.error(e); skipSubPath(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } pathHandler.endPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsem() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoRel(x, y); boolean expectNumber = skipCommaSpaces2(); _parsel(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseM() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoAbs(x, y); boolean expectNumber = skipCommaSpaces2(); _parseL(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsel() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parsel(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parsel(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseL() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parseL(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parseL(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseh() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseH() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsev() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseV() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsec() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicRel(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseC() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicAbs(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseq() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticRel(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseQ() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticAbs(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parses() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothRel(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseS() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothAbs(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parset() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseT() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsea() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcRel(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseA() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcAbs(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void skipSubPath() throws ParseException, IOException { for (;;) { switch (current) { case -1: case 'm': case 'M': return; default: break; } current = reader.read(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void reportUnexpected(int ch) throws ParseException, IOException { reportUnexpectedCharacterError( current ); skipSubPath(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void doParse() throws ParseException, IOException { transformListHandler.startTransformList(); loop: for (;;) { try { current = reader.read(); switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; case -1: break loop; default: reportUnexpectedCharacterError( current ); skipTransform(); } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } transformListHandler.endTransformList(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError('i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError('x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError('o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError('n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError('s', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError('w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall through case 'Y': break; default: reportCharacterExpectedError('X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } if (skewX) { transformListHandler.skewX(sk); } else { transformListHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/TimingSpecifierParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); Object[] spec = parseTimingSpecifier(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } handleTimingSpecifier(spec); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ NumberListParser NumberListParser = new NumberListParser(); NumberListBuilder builder = new NumberListBuilder(handler); NumberListParser.setNumberListHandler(builder); NumberListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void startNumberList() throws ParseException{ listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void startNumber() throws ParseException { currentValue = 0.0f; }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void numberValue(float v) throws ParseException { currentValue = v; }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void endNumber() throws ParseException { listHandler.item(new SVGNumberItem(currentValue)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void endNumberList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
protected void parse(String s) { try { AngleParser angleParser = new AngleParser(); angleParser.setAngleHandler(new DefaultAngleHandler() { public void angleValue(float v) throws ParseException { value = v; } public void deg() throws ParseException { unitType = SVG_ANGLETYPE_DEG; } public void rad() throws ParseException { unitType = SVG_ANGLETYPE_RAD; } public void grad() throws ParseException { unitType = SVG_ANGLETYPE_GRAD; } }); unitType = SVG_ANGLETYPE_UNSPECIFIED; angleParser.parse(s); } catch (ParseException e) { unitType = SVG_ANGLETYPE_UNKNOWN; value = 0; } }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void angleValue(float v) throws ParseException { value = v; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void deg() throws ParseException { unitType = SVG_ANGLETYPE_DEG; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void rad() throws ParseException { unitType = SVG_ANGLETYPE_RAD; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void grad() throws ParseException { unitType = SVG_ANGLETYPE_GRAD; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void meet() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void slice() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
protected void revalidate() { if (valid) { return; } Attr attr = element.getAttributeNodeNS(namespaceURI, localName); final String s = attr == null ? defaultValue : attr.getValue(); final float[] numbers = new float[4]; NumberListParser p = new NumberListParser(); p.setNumberListHandler(new DefaultNumberListHandler() { protected int count; public void endNumberList() { if (count != 4) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } } public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; } }); p.parse(s); x = numbers[0]; y = numbers[1]; w = numbers[2]; h = numbers[3]; valid = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ PathParser pathParser = new PathParser(); PathSegListBuilder builder = new PathSegListBuilder(handler); pathParser.setPathHandler(builder); pathParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void startPath() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void endPath() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void movetoRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_REL,PATHSEG_MOVETO_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void movetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_ABS,PATHSEG_MOVETO_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void closePath() throws ParseException { listHandler.item(new SVGPathSegItem (SVGPathSeg.PATHSEG_CLOSEPATH,PATHSEG_CLOSEPATH_LETTER)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_REL,PATHSEG_LINETO_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_ABS,PATHSEG_LINETO_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoHorizontalRel(float x) throws ParseException { listHandler.item(new SVGPathSegLinetoHorizontalItem (SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,PATHSEG_LINETO_HORIZONTAL_REL_LETTER, x)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoHorizontalAbs(float x) throws ParseException { listHandler.item(new SVGPathSegLinetoHorizontalItem (SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,PATHSEG_LINETO_HORIZONTAL_ABS_LETTER, x)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoVerticalRel(float y) throws ParseException { listHandler.item(new SVGPathSegLinetoVerticalItem (SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,PATHSEG_LINETO_VERTICAL_REL_LETTER, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoVerticalAbs(float y) throws ParseException { listHandler.item(new SVGPathSegLinetoVerticalItem (SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,PATHSEG_LINETO_VERTICAL_ABS_LETTER, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,PATHSEG_CURVETO_CUBIC_REL_LETTER, x1,y1,x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,PATHSEG_CURVETO_CUBIC_ABS_LETTER, x1,y1,x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicSmoothItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,PATHSEG_CURVETO_CUBIC_SMOOTH_REL_LETTER, x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicSmoothItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,PATHSEG_CURVETO_CUBIC_SMOOTH_ABS_LETTER, x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,PATHSEG_CURVETO_QUADRATIC_REL_LETTER, x1,y1,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,PATHSEG_CURVETO_QUADRATIC_ABS_LETTER, x1,y1,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticSmoothItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticSmoothItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { listHandler.item(new SVGPathSegArcItem (SVGPathSeg.PATHSEG_ARC_REL,PATHSEG_ARC_REL_LETTER, rx,ry,xAxisRotation,largeArcFlag,sweepFlag,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { listHandler.item(new SVGPathSegArcItem (SVGPathSeg.PATHSEG_ARC_ABS,PATHSEG_ARC_ABS_LETTER, rx,ry,xAxisRotation,largeArcFlag,sweepFlag,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
protected void doParse(String value, ListHandler handler) throws ParseException { PointsParser pointsParser = new PointsParser(); PointsListBuilder builder = new PointsListBuilder(handler); pointsParser.setPointsHandler(builder); pointsParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void startPoints() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void point(float x, float y) throws ParseException { listHandler.item(new SVGPointItem(x, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void endPoints() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
protected void doParse(String value, ListHandler handler) throws ParseException { TransformListParser transformListParser = new TransformListParser(); TransformListBuilder builder = new TransformListBuilder(handler); transformListParser.setTransformListHandler(builder); transformListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void startTransformList() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.matrix(a, b, c, d, e, f); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void rotate(float theta) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.rotate(theta); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void rotate(float theta, float cx, float cy) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setRotate(theta, cx, cy); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void translate(float tx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.translate(tx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void translate(float tx, float ty) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setTranslate(tx, ty); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void scale(float sx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.scale(sx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void scale(float sx, float sy) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setScale(sx, sy); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void skewX(float skx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setSkewX(skx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void skewY(float sky) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setSkewY(sky); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void endTransformList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
protected void doParse(String value, ListHandler handler) throws ParseException { PathParser pathParser = new PathParser(); NormalizedPathSegListBuilder builder = new NormalizedPathSegListBuilder(handler); pathParser.setPathHandler(builder); pathParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void startPath() throws ParseException { listHandler.startList(); lastAbs = new SVGPathSegGenericItem(SVGPathSeg.PATHSEG_MOVETO_ABS, PATHSEG_MOVETO_ABS_LETTER, 0,0,0,0,0,0); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void endPath() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void movetoRel(float x, float y) throws ParseException { movetoAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void movetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_ABS,PATHSEG_MOVETO_ABS_LETTER, x,y)); lastAbs.setX(x); lastAbs.setY(y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_MOVETO_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void closePath() throws ParseException { listHandler.item(new SVGPathSegItem (SVGPathSeg.PATHSEG_CLOSEPATH,PATHSEG_CLOSEPATH_LETTER)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoRel(float x, float y) throws ParseException { linetoAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_ABS,PATHSEG_LINETO_ABS_LETTER, x,y)); lastAbs.setX(x); lastAbs.setY(y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_LINETO_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoHorizontalRel(float x) throws ParseException { linetoAbs(lastAbs.getX() + x, lastAbs.getY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoHorizontalAbs(float x) throws ParseException { linetoAbs(x, lastAbs.getY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoVerticalRel(float y) throws ParseException { linetoAbs(lastAbs.getX(), lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoVerticalAbs(float y) throws ParseException { linetoAbs(lastAbs.getX(), y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { curvetoCubicAbs(lastAbs.getX() +x1, lastAbs.getY() + y1, lastAbs.getX() +x2, lastAbs.getY() + y2, lastAbs.getX() +x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,PATHSEG_CURVETO_CUBIC_ABS_LETTER, x1,y1,x2,y2,x,y)); lastAbs.setValue(x1,y1,x2,y2,x,y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { curvetoCubicSmoothAbs(lastAbs.getX() + x2, lastAbs.getY() + y2, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) { curvetoCubicAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX2()), lastAbs.getY() + (lastAbs.getY() - lastAbs.getY2()), x2, y2, x, y); } else { curvetoCubicAbs(lastAbs.getX(), lastAbs.getY(), x2, y2, x, y); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { curvetoQuadraticAbs(lastAbs.getX() + x1, lastAbs.getY() + y1, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { curvetoCubicAbs(lastAbs.getX() + 2 * (x1 - lastAbs.getX()) / 3, lastAbs.getY() + 2 * (y1 - lastAbs.getY()) / 3, x + 2 * (x1 - x) / 3, y + 2 * (y1 - y) / 3, x, y); lastAbs.setX1(x1); lastAbs.setY1(y1); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { curvetoQuadraticSmoothAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS) { curvetoQuadraticAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX1()), lastAbs.getY() + (lastAbs.getY() - lastAbs.getY1()), x, y); } else { curvetoQuadraticAbs(lastAbs.getX(), lastAbs.getY(), x, y); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { arcAbs(rx,ry,xAxisRotation, largeArcFlag, sweepFlag, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { // Ensure radii are valid if (rx == 0 || ry == 0) { linetoAbs(x, y); return; } // Get the current (x, y) coordinates of the path double x0 = lastAbs.getX(); double y0 = lastAbs.getY(); if (x0 == x && y0 == y) { // If the endpoints (x, y) and (x0, y0) are identical, then this // is equivalent to omitting the elliptical arc segment entirely. return; } Arc2D arc = ExtendedGeneralPath.computeArc(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y); if (arc == null) return; AffineTransform t = AffineTransform.getRotateInstance (Math.toRadians(xAxisRotation), arc.getCenterX(), arc.getCenterY()); Shape s = t.createTransformedShape(arc); PathIterator pi = s.getPathIterator(new AffineTransform()); float[] d = {0,0,0,0,0,0}; int i = -1; while (!pi.isDone()) { i = pi.currentSegment(d); switch (i) { case PathIterator.SEG_CUBICTO: curvetoCubicAbs(d[0],d[1],d[2],d[3],d[4],d[5]); break; } pi.next(); } lastAbs.setPathSegType(SVGPathSeg.PATHSEG_ARC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ LengthListParser lengthListParser = new LengthListParser(); LengthListBuilder builder = new LengthListBuilder(handler); lengthListParser.setLengthListHandler(builder); lengthListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void startLengthList() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void startLength() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_NUMBER; currentValue = 0.0f; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void lengthValue(float v) throws ParseException { currentValue = v; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void em() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void ex() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void in() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void cm() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void mm() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void pc() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void pt() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void px() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void percentage() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void endLength() throws ParseException { listHandler.item (new SVGLengthItem(currentType,currentValue,direction)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void endLengthList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = EOF; return; case ':': nextChar(); type = COLON; return; case '[': nextChar(); type = LEFT_SQUARE_BRACKET; return; case ']': nextChar(); type = RIGHT_SQUARE_BRACKET; return; case '(': nextChar(); type = LEFT_PARENTHESIS; return; case ')': nextChar(); type = RIGHT_PARENTHESIS; return; case '*': nextChar(); type = ASTERISK; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (XMLUtilities.isXMLSpace((char) current)); nextToken(); return; case '\'': type = string1(); return; case '"': type = string2(); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; default: if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { do { nextChar(); } while (current != -1 && current != ':' && XMLUtilities.isXMLNameCharacter((char) current)); type = NAME; return; } nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endTransformList() throws ParseException { super.endTransformList(); hasTransform = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void idReference(String s) throws ParseException { id = s; hasId = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void viewBox(float x, float y, float width, float height) throws ParseException { hasViewBox = true; viewBox = new float[4]; viewBox[0] = x; viewBox[1] = y; viewBox[2] = width; viewBox[3] = height; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startViewTarget() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void viewTarget(String name) throws ParseException { viewTargetParams = name; hasViewTargetParams = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endViewTarget() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void meet() throws ParseException { meet = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void slice() throws ParseException { meet = false; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endPreserveAspectRatio() throws ParseException { hasPreserveAspectRatio = true; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AbstractAnimation createAnimation(AnimationTarget target) { animationType = AnimationEngine.ANIM_TYPE_OTHER; attributeLocalName = "motion"; AnimatableValue from = parseLengthPair(SVG_FROM_ATTRIBUTE); AnimatableValue to = parseLengthPair(SVG_TO_ATTRIBUTE); AnimatableValue by = parseLengthPair(SVG_BY_ATTRIBUTE); boolean rotateAuto = false, rotateAutoReverse = false; float rotateAngle = 0; short rotateAngleUnit = SVGAngle.SVG_ANGLETYPE_UNKNOWN; String rotateString = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); if (rotateString.length() != 0) { if (rotateString.equals("auto")) { rotateAuto = true; } else if (rotateString.equals("auto-reverse")) { rotateAuto = true; rotateAutoReverse = true; } else { class Handler implements AngleHandler { float theAngle; short theUnit = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; public void startAngle() throws ParseException { } public void angleValue(float v) throws ParseException { theAngle = v; } public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; } public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; } public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; } public void endAngle() throws ParseException { } } AngleParser ap = new AngleParser(); Handler h = new Handler(); ap.setAngleHandler(h); try { ap.parse(rotateString); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); } rotateAngle = h.theAngle; rotateAngleUnit = h.theUnit; } } return new MotionAnimation(timedElement, this, parseCalcMode(), parseKeyTimes(), parseKeySplines(), parseAdditive(), parseAccumulate(), parseValues(), from, to, by, parsePath(), parseKeyPoints(), rotateAuto, rotateAutoReverse, rotateAngle, rotateAngleUnit); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void startAngle() throws ParseException { }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void angleValue(float v) throws ParseException { theAngle = v; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void endAngle() throws ParseException { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void startPreserveAspectRatio() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_UNKNOWN; meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void meet() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void slice() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void startLength() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_NUMBER; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void lengthValue(float v) throws ParseException { value = v; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void em() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void ex() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void in() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void cm() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void mm() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void pc() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void pt() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void px() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void percentage() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/css/parser/Scanner.java
public void scanAtRule() throws ParseException { try { // waiting for EOF, ';' or '{' loop: for (;;) { switch (current) { case '{': int brackets = 1; for (;;) { nextChar(); switch (current) { case '}': if (--brackets > 0) { break; } case -1: break loop; case '{': brackets++; } } case -1: case ';': break loop; } nextChar(); } end = position; } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
public int next() throws ParseException { blankCharacters = 0; start = position - 1; nextToken(); end = position - endGap(); return type; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = LexicalUnits.EOF; return; case '{': nextChar(); type = LexicalUnits.LEFT_CURLY_BRACE; return; case '}': nextChar(); type = LexicalUnits.RIGHT_CURLY_BRACE; return; case '=': nextChar(); type = LexicalUnits.EQUAL; return; case '+': nextChar(); type = LexicalUnits.PLUS; return; case ',': nextChar(); type = LexicalUnits.COMMA; return; case ';': nextChar(); type = LexicalUnits.SEMI_COLON; return; case '>': nextChar(); type = LexicalUnits.PRECEDE; return; case '[': nextChar(); type = LexicalUnits.LEFT_BRACKET; return; case ']': nextChar(); type = LexicalUnits.RIGHT_BRACKET; return; case '*': nextChar(); type = LexicalUnits.ANY; return; case '(': nextChar(); type = LexicalUnits.LEFT_BRACE; return; case ')': nextChar(); type = LexicalUnits.RIGHT_BRACE; return; case ':': nextChar(); type = LexicalUnits.COLON; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (ScannerUtilities.isCSSSpace((char)current)); type = LexicalUnits.SPACE; return; case '/': nextChar(); if (current != '*') { type = LexicalUnits.DIVIDE; return; } // Comment nextChar(); start = position - 1; do { while (current != -1 && current != '*') { nextChar(); } do { nextChar(); } while (current != -1 && current == '*'); } while (current != -1 && current != '/'); if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.COMMENT; return; case '\'': // String1 type = string1(); return; case '"': // String2 type = string2(); return; case '<': nextChar(); if (current != '!') { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (current == '-') { nextChar(); if (current == '-') { nextChar(); type = LexicalUnits.CDO; return; } } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '-': nextChar(); if (current != '-') { type = LexicalUnits.MINUS; return; } nextChar(); if (current == '>') { nextChar(); type = LexicalUnits.CDC; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '|': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.DASHMATCH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '~': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.INCLUDES; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '#': nextChar(); if (ScannerUtilities.isCSSNameCharacter((char)current)) { start = position - 1; do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); type = LexicalUnits.HASH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '@': nextChar(); switch (current) { case 'c': case 'C': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'h') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 's') && isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.CHARSET_SYMBOL; return; } break; case 'f': case 'F': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), '-') && isEqualIgnoreCase(nextChar(), 'f') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'c') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.FONT_FACE_SYMBOL; return; } break; case 'i': case 'I': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORT_SYMBOL; return; } break; case 'm': case 'M': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 'd') && isEqualIgnoreCase(nextChar(), 'i') && isEqualIgnoreCase(nextChar(), 'a')) { nextChar(); type = LexicalUnits.MEDIA_SYMBOL; return; } break; case 'p': case 'P': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'g') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.PAGE_SYMBOL; return; } break; default: if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } start = position - 1; } do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); type = LexicalUnits.AT_KEYWORD; return; case '!': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace((char)current)); if (isEqualIgnoreCase(current, 'i') && isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORTANT_SYMBOL; return; } if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } else { throw new ParseException("character", reader.getLine(), reader.getColumn()); } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = dotNumber(); return; default: type = LexicalUnits.DOT; return; } case 'u': case 'U': nextChar(); switch (current) { case '+': boolean range = false; for (int i = 0; i < 6; i++) { nextChar(); switch (current) { case '?': range = true; break; default: if (range && !ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); if (range) { type = LexicalUnits.UNICODE_RANGE; return; } if (current == '-') { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); type = LexicalUnits.UNICODE_RANGE; return; } case 'r': case 'R': nextChar(); switch (current) { case 'l': case 'L': nextChar(); switch (current) { case '(': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)); switch (current) { case '\'': string1(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case '"': string2(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case ')': throw new ParseException("character", reader.getLine(), reader.getColumn()); default: if (!ScannerUtilities.isCSSURICharacter ((char)current)) { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } start = position - 1; do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSURICharacter ((char)current)); blankCharacters++; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; } } } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; default: if (current == '\\') { do { nextChar(); escape(); } while(current == '\\'); } else if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } // Identifier while ((current != -1) && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); while (current == '\\') { nextChar(); escape(); } } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; } } catch (IOException e) { throw new ParseException(e); } }
(Lib) IndexOutOfBoundsException 35
              
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public Shape getDependencyRegion(int srcIndex, Rectangle outputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Return empty rect if they don't intersect. if ( ! outputRgn.intersects(bounds) ) return new Rectangle(); // We only depend on our source for stuff that is inside // our bounds... return outputRgn.intersection(bounds); }
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public Shape getDirtyRegion(int srcIndex, Rectangle inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Return empty rect if they don't intersect. if ( ! inputRgn.intersects(bounds) ) return new Rectangle(); // Changes in the input region don't propogate outside our // bounds. return inputRgn.intersection(bounds); }
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public WritableRaster makeTile(int tileX, int tileY) { if ((tileX < minTileX) || (tileX >= minTileX+numXTiles) || (tileY < minTileY) || (tileY >= minTileY+numYTiles)) throw new IndexOutOfBoundsException ("Requested Tile (" + tileX + ',' + tileY + ") lies outside the bounds of image"); Point pt = new Point(tileGridXOff+tileX*tileWidth, tileGridYOff+tileY*tileHeight); WritableRaster wr; wr = Raster.createWritableRaster(sm, pt); // if (!(sm instanceof SinglePixelPackedSampleModel)) // wr = Raster.createWritableRaster(sm, pt); // else { // SinglePixelPackedSampleModel sppsm; // sppsm = (SinglePixelPackedSampleModel)sm; // int stride = sppsm.getScanlineStride(); // int sz = stride*sppsm.getHeight(); // // int [] data = reclaim.request(sz); // DataBuffer db = new DataBufferInt(data, sz); // // reclaim.register(db); // // wr = Raster.createWritableRaster(sm, db, pt); // } // System.out.println("MT DB: " + wr.getDataBuffer().getSize()); int x0 = wr.getMinX(); int y0 = wr.getMinY(); int x1 = x0+wr.getWidth() -1; int y1 = y0+wr.getHeight()-1; if ((x0 < bounds.x) || (x1 >= (bounds.x+bounds.width)) || (y0 < bounds.y) || (y1 >= (bounds.y+bounds.height))) { // Part of this raster lies outside our bounds so subset // it so it only advertises the stuff inside our bounds. if (x0 < bounds.x) x0 = bounds.x; if (y0 < bounds.y) y0 = bounds.y; if (x1 >= (bounds.x+bounds.width)) x1 = bounds.x+bounds.width-1; if (y1 >= (bounds.y+bounds.height)) y1 = bounds.y+bounds.height-1; wr = wr.createWritableChild(x0, y0, x1-x0+1, y1-y0+1, x0, y0, null); } return wr; }
// in sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
public Shape getDependencyRegion(int srcIndex, Rectangle outputRgn) { throw new IndexOutOfBoundsException ("Nonexistant source requested."); }
// in sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
public Shape getDirtyRegion(int srcIndex, Rectangle inputRgn) { throw new IndexOutOfBoundsException ("Nonexistant source requested."); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); if (invAffine == null) return null; return invAffine.createTransformedShape(outputRgn); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); return affine.createTransformedShape(inputRgn); }
// in sources/org/apache/batik/ext/awt/image/renderable/PadRable8Bit.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); // We only depend on our source for stuff that is inside // our bounds and his bounds (remember our bounds may be // tighter than his in one or both directions). Rectangle2D srect = getSource().getBounds2D(); if ( ! srect.intersects(outputRgn) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, outputRgn, srect); Rectangle2D bounds = getBounds2D(); if ( ! srect.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
// in sources/org/apache/batik/ext/awt/image/renderable/PadRable8Bit.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); inputRgn = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Changes in the input region don't propogate outside our // bounds. if ( ! inputRgn.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(inputRgn, bounds, inputRgn); return inputRgn; }
// in sources/org/apache/batik/ext/awt/image/renderable/AbstractRable.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // We only depend on our source for stuff that is inside // our bounds... Rectangle2D srect = (Rectangle2D)outputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Return empty rect if they don't intersect. if ( ! bounds.intersects(srect) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
// in sources/org/apache/batik/ext/awt/image/renderable/AbstractRable.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Changes in the input region don't propogate outside our // bounds. Rectangle2D drect = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Return empty rect if they don't intersect. if ( ! bounds.intersects(drect) ) return new Rectangle2D.Float(); Rectangle2D.intersect(drect, bounds, drect); return drect; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } if (index > count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Insert the node to the children list ensureCapacity(count+1); // Increments modCount!! System.arraycopy(children, index, children, index+1, count-index); children[index] = node; count++; // Set parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public ListIterator listIterator(int index) { if (index < 0 || index > count) { throw new IndexOutOfBoundsException("Index: "+index); } return new ListItr(index); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
private void checkRange(int index) { if (index >= count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int getGlyphCode(int glyphIndex) throws IndexOutOfBoundsException { if (glyphIndex < 0 || glyphIndex > (glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex " + glyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } return glyphs[glyphIndex].getGlyphCode(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + "."); } return null; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public GVTGlyphMetrics getGlyphMetrics(int idx) { if (idx < 0 || (idx > glyphs.length-1)) throw new IndexOutOfBoundsException ("idx: " + idx + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); // check to see if we should kern this glyph // I return the kerning information in the glyph metrics // as a first pass at implementation (I don't want to // fiddle with layout too much right now). if (idx < glyphs.length - 1) { // check for kerning if (font != null) { float hkern = font.getHKern(glyphs[idx].getGlyphCode(), glyphs[idx+1].getGlyphCode()); float vkern = font.getVKern(glyphs[idx].getGlyphCode(), glyphs[idx+1].getGlyphCode()); return glyphs[idx].getGlyphMetrics(hkern, vkern); } } // get a normal metrics return glyphs[idx].getGlyphMetrics(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Shape getGlyphOutline(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + "."); } return glyphs[glyphIndex].getOutline(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Point2D getGlyphPosition(int glyphIndex) { if (glyphIndex == glyphs.length) return endPos; if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getPosition(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn) { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length+1) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + '+' + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (positionReturn == null) { positionReturn = new float[numEntries*2]; } if ((beginGlyphIndex+numEntries) == glyphs.length+1) { numEntries--; positionReturn[numEntries*2] = (float)endPos.getX(); positionReturn[numEntries*2+1] = (float)endPos.getY(); } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { Point2D glyphPos; glyphPos = glyphs[i].getPosition(); positionReturn[(i-beginGlyphIndex)*2] = (float)glyphPos.getX(); positionReturn[(i-beginGlyphIndex)*2 + 1] = (float)glyphPos.getY(); } return positionReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public AffineTransform getGlyphTransform(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getTransform(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Shape getGlyphVisualBounds(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getOutline(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphPosition(int glyphIndex, Point2D newPos) throws IndexOutOfBoundsException { if (glyphIndex == glyphs.length) { endPos = (Point2D)newPos.clone(); return; } if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setPosition(newPos); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphTransform(int glyphIndex, AffineTransform newTX) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setTransform(newTX); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
0 3
              
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int getGlyphCode(int glyphIndex) throws IndexOutOfBoundsException { if (glyphIndex < 0 || glyphIndex > (glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex " + glyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } return glyphs[glyphIndex].getGlyphCode(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphPosition(int glyphIndex, Point2D newPos) throws IndexOutOfBoundsException { if (glyphIndex == glyphs.length) { endPos = (Point2D)newPos.clone(); return; } if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setPosition(newPos); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
(Lib) CSSException 28
              
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/Parser.java
protected Scanner createScanner(InputSource source) { documentURI = source.getURI(); if (documentURI == null) { documentURI = ""; } Reader r = source.getCharacterStream(); if (r != null) { return new Scanner(r); } InputStream is = source.getByteStream(); if (is != null) { return new Scanner(is, source.getEncoding()); } String uri = source.getURI(); if (uri == null) { throw new CSSException(formatMessage("empty.source", null)); } try { ParsedURL purl = new ParsedURL(uri); is = purl.openStreamRaw(CSSConstants.CSS_MIME_TYPE); return new Scanner(is, source.getEncoding()); } catch (IOException e) { throw new CSSException(e); } }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
1
              
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
119
              
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createAndCondition(Condition first, Condition second) throws CSSException { return new DefaultAndCondition(first, second); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new DefaultAttributeCondition(localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createIdCondition(String value) throws CSSException { return new DefaultIdCondition(value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public LangCondition createLangCondition(String lang) throws CSSException { return new DefaultLangCondition(lang); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createOneOfAttributeCondition(String localName, String nsURI, boolean specified, String value) throws CSSException { return new DefaultOneOfAttributeCondition(localName, nsURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createBeginHyphenAttributeCondition (String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new DefaultBeginHyphenAttributeCondition (localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new DefaultClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createPseudoClassCondition(String namespaceURI, String value) throws CSSException { return new DefaultPseudoClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/Parser.java
public void setLocale(Locale locale) throws CSSException { localizableSupport.setLocale(locale); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { scanner = createScanner(source); try { documentHandler.startDocument(source); current = scanner.next(); switch (current) { case LexicalUnits.CHARSET_SYMBOL: if (nextIgnoreSpaces() != LexicalUnits.STRING) { reportError("charset.string"); } else { if (nextIgnoreSpaces() != LexicalUnits.SEMI_COLON) { reportError("semicolon"); } next(); } break; case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); } skipSpacesAndCDOCDC(); for (;;) { if (current == LexicalUnits.IMPORT_SYMBOL) { nextIgnoreSpaces(); parseImportRule(); nextIgnoreSpaces(); } else { break; } } loop: for (;;) { switch (current) { case LexicalUnits.PAGE_SYMBOL: nextIgnoreSpaces(); parsePageRule(); break; case LexicalUnits.MEDIA_SYMBOL: nextIgnoreSpaces(); parseMediaRule(); break; case LexicalUnits.FONT_FACE_SYMBOL: nextIgnoreSpaces(); parseFontFaceRule(); break; case LexicalUnits.AT_KEYWORD: nextIgnoreSpaces(); parseAtRule(); break; case LexicalUnits.EOF: break loop; default: parseRuleSet(); } skipSpacesAndCDOCDC(); } } finally { documentHandler.endDocument(source); scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parseStyleSheet(new InputSource(uri)); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclarationInternal() throws CSSException, IOException { nextIgnoreSpaces(); try { parseStyleDeclaration(false); } catch (CSSParseException e) { reportError(e); } finally { scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseRuleInternal() throws CSSException, IOException { nextIgnoreSpaces(); parseRule(); scanner = null; }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected SelectorList parseSelectorsInternal() throws CSSException, IOException { nextIgnoreSpaces(); SelectorList ret = parseSelectorList(); scanner = null; return ret; }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected boolean parsePriorityInternal() throws CSSException, IOException { nextIgnoreSpaces(); scanner = null; switch (current) { case LexicalUnits.EOF: return false; case LexicalUnits.IMPORT_SYMBOL: return true; default: reportError("token", new Object[] { new Integer(current) }); return false; } }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclaration(boolean inSheet) throws CSSException { for (;;) { switch (current) { case LexicalUnits.EOF: if (inSheet) { throw createCSSParseException("eof"); } return; case LexicalUnits.RIGHT_CURLY_BRACE: if (!inSheet) { throw createCSSParseException("eof.expected"); } nextIgnoreSpaces(); return; case LexicalUnits.SEMI_COLON: nextIgnoreSpaces(); continue; default: throw createCSSParseException("identifier"); case LexicalUnits.IDENTIFIER: } String name = scanner.getStringValue(); if (nextIgnoreSpaces() != LexicalUnits.COLON) { throw createCSSParseException("colon"); } nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); } if (exp != null) { boolean important = false; if (current == LexicalUnits.IMPORTANT_SYMBOL) { important = true; nextIgnoreSpaces(); } documentHandler.property(name, exp, important); } } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { scanner = new Scanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(String source) throws CSSException, IOException { scanner = new Scanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { scanner = new Scanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ConditionalSelector createConditionalSelector (SimpleSelector selector, Condition condition) throws CSSException { return new DefaultConditionalSelector(selector, condition); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ElementSelector createElementSelector(String namespaceURI, String tagName) throws CSSException { return new DefaultElementSelector(namespaceURI, tagName); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ElementSelector createPseudoElementSelector(String namespaceURI, String pseudoName) throws CSSException { return new DefaultPseudoElementSelector(namespaceURI, pseudoName); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public DescendantSelector createDescendantSelector (Selector parent, SimpleSelector descendant) throws CSSException { return new DefaultDescendantSelector(parent, descendant); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public DescendantSelector createChildSelector(Selector parent, SimpleSelector child) throws CSSException { return new DefaultChildSelector(parent, child); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SiblingSelector createDirectAdjacentSelector (short nodeType, Selector child, SimpleSelector directAdjacent) throws CSSException { return new DefaultDirectAdjacentSelector(nodeType, child, directAdjacent); }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void comment(String text) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void ignorableAtRule(String atRule) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void namespaceDeclaration(String prefix, String uri) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void importStyle(String uri, SACMediaList media, String defaultNamespaceURI) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startMedia(SACMediaList media) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endMedia(SACMediaList media) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startFontFace() throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endFontFace() throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startSelector(SelectorList selectors) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endSelector(SelectorList selectors) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void setLocale(Locale locale) throws CSSException { parser.setLocale(locale); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { parser.parseStyleDeclaration(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { parser.parseStyleDeclaration (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(InputSource source) throws CSSException, IOException { parser.parseRule(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(String source) throws CSSException, IOException { parser.parseRule(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { return parser.parseSelectors(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { return parser.parseSelectors (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { return parser.parsePropertyValue(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { return parser.parsePropertyValue (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { return parser.parsePriority(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(String source) throws CSSException, IOException { return parser.parsePriority(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); putAuthorProperty(styleMap, i, v, important, StyleMap.INLINE_AUTHOR_ORIGIN); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void ignorableAtRule(String atRule) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void importStyle(String uri, SACMediaList media, String defaultNamespaceURI) throws CSSException { ImportRule ir = new ImportRule(); ir.setMediaList(media); ir.setParent(styleSheet); ParsedURL base = getCSSBaseURI(); ParsedURL url; if (base == null) { url = new ParsedURL(uri); } else { url = new ParsedURL(base, uri); } ir.setURI(url); styleSheet.append(ir); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startMedia(SACMediaList media) throws CSSException { MediaRule mr = new MediaRule(); mr.setMediaList(media); mr.setParent(styleSheet); styleSheet.append(mr); styleSheet = mr; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endMedia(SACMediaList media) throws CSSException { styleSheet = styleSheet.getParent(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startFontFace() throws CSSException { styleDeclaration = new StyleDeclaration(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endFontFace() throws CSSException { StyleMap sm = new StyleMap(getNumberOfProperties()); int len = styleDeclaration.size(); for (int i=0; i<len; i++) { int idx = styleDeclaration.getIndex(i); sm.putValue(idx, styleDeclaration.getValue(i)); sm.putImportant(idx, styleDeclaration.getPriority(i)); // Not sure on this.. sm.putOrigin(idx, StyleMap.AUTHOR_ORIGIN); } styleDeclaration = null; int pidx = getPropertyIndex(CSSConstants.CSS_FONT_FAMILY_PROPERTY); Value fontFamily = sm.getValue(pidx); if (fontFamily == null) return; ParsedURL base = getCSSBaseURI(); fontFaces.add(new FontFaceRule(sm, base)); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startSelector(SelectorList selectors) throws CSSException { styleRule = new StyleRule(); styleRule.setSelectorList(selectors); styleDeclaration = new StyleDeclaration(); styleRule.setStyleDeclaration(styleDeclaration); styleSheet.append(styleRule); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endSelector(SelectorList selectors) throws CSSException { styleRule = null; styleDeclaration = null; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { if (styleMap.isImportant(i)) { // The previous value is important, and a value // from a style attribute cannot be important... return; } updatedProperties[i] = true; Value v = valueManagers[i].createValue(value, CSSEngine.this); styleMap.putMask(i, (short)0); styleMap.putValue(i, v); styleMap.putOrigin(i, StyleMap.INLINE_AUTHOR_ORIGIN); } }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ConditionalSelector createConditionalSelector (SimpleSelector selector, Condition condition) throws CSSException { return new CSSConditionalSelector(selector, condition); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ElementSelector createElementSelector(String namespaceURI, String tagName) throws CSSException { return new CSSElementSelector(namespaceURI, tagName); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ElementSelector createPseudoElementSelector(String namespaceURI, String pseudoName) throws CSSException { return new CSSPseudoElementSelector(namespaceURI, pseudoName); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public DescendantSelector createDescendantSelector (Selector parent, SimpleSelector descendant) throws CSSException { return new CSSDescendantSelector(parent, descendant); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public DescendantSelector createChildSelector(Selector parent, SimpleSelector child) throws CSSException { return new CSSChildSelector(parent, child); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SiblingSelector createDirectAdjacentSelector (short nodeType, Selector child, SimpleSelector directAdjacent) throws CSSException { return new CSSDirectAdjacentSelector(nodeType, child, directAdjacent); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createAndCondition(Condition first, Condition second) throws CSSException { return new CSSAndCondition(first, second); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new CSSAttributeCondition(localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createIdCondition(String value) throws CSSException { return new CSSIdCondition(idNamespaceURI, idLocalName, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public LangCondition createLangCondition(String lang) throws CSSException { return new CSSLangCondition(lang); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createOneOfAttributeCondition(String localName, String nsURI, boolean specified, String value) throws CSSException { return new CSSOneOfAttributeCondition(localName, nsURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createBeginHyphenAttributeCondition (String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new CSSBeginHyphenAttributeCondition (localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new CSSClassCondition(classLocalName, classNamespaceURI, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createPseudoClassCondition(String namespaceURI, String value) throws CSSException { return new CSSPseudoClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
(Lib) IOException 26
              
// in sources/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java
public File createNewFolder(File containingDir) throws IOException { if(containingDir == null) { throw new IOException(Resources.getString(EXCEPTION_CONTAINING_DIR_NULL)); } File newFolder = null; // Using NT's default folder name newFolder = createFileObject(containingDir, Resources.getString(NEW_FOLDER_NAME)); int i = 2; while (newFolder.exists() && (i < 100)) { newFolder = createFileObject (containingDir, Resources.getString(NEW_FOLDER_NAME) + " (" + i + ')' ); i++; } if(newFolder.exists()) { throw new IOException (Resources.formatMessage(EXCEPTION_DIRECTORY_ALREADY_EXISTS, new Object[]{newFolder.getAbsolutePath()})); } else { newFolder.mkdirs(); } return newFolder; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if ((page < 0) || (page >= getNumPages())) { throw new IOException("TIFFImageDecoder0"); } return new TIFFImage(input, (TIFFDecodeParam)param, page); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if (page != 0) { throw new IOException(PropertyUtil.getString("PNGImageDecoder19")); } return new PNGImage(input, (PNGDecodeParam)param); }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("MemoryCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("FileCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
public void read(DataInputStream is) throws IOException { reset(); setReading( true ); int dwIsAldus = readInt( is ); if ( dwIsAldus == WMFConstants.META_ALDUS_APM ) { // Read the aldus placeable header. int key = dwIsAldus; isAldus = true; readShort( is ); // metafile handle, always zero left = readShort( is ); top = readShort( is ); right = readShort( is ); bottom = readShort( is ); inch = readShort( is ); int reserved = readInt( is ); short checksum = readShort( is ); // inverse values if left > right or top > bottom if (left > right) { int _i = right; right = left; left = _i; xSign = -1; } if (top > bottom) { int _i = bottom; bottom = top; top = _i; ySign = -1; } width = right - left; height = bottom - top; // read the beginning of the header mtType = readShort( is ); mtHeaderSize = readShort( is ); } else { // read the beginning of the header, the first int corresponds to the first two parameters mtType = ((dwIsAldus << 16) >> 16); mtHeaderSize = dwIsAldus >> 16; } mtVersion = readShort( is ); mtSize = readInt( is ); mtNoObjects = readShort( is ); mtMaxRecord = readInt( is ); mtNoParameters = readShort( is ); numObjects = mtNoObjects; List tempList = new ArrayList( numObjects ); for ( int i = 0; i < numObjects; i++ ) { tempList.add( new GdiObject( i, false )); } objectVector.addAll( tempList ); boolean ret = readRecords(is); is.close(); if (!ret) throw new IOException("Unhandled exception while reading records"); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, InputStream inp) throws IOException { Document doc; InputSource is = new InputSource(inp); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { Document doc; InputSource is = new InputSource(r); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static void writeNode(Node n, Writer w, NSMap m, boolean isXML11) throws IOException { switch (n.getNodeType()) { case Node.ELEMENT_NODE: { if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); if (name.startsWith("xmlns")) { if (name.length() == 5) { m = m.declare("", a.getNodeValue()); } else { String prefix = name.substring(6); m = m.declare(prefix, a.getNodeValue()); } } } } w.write('<'); String ns = n.getNamespaceURI(); String tagName; if (ns == null) { tagName = n.getNodeName(); w.write(tagName); if (!"".equals(m.getNamespace(""))) { w.write(" xmlns=\"\""); m = m.declare("", ""); } } else { String prefix = n.getPrefix(); if (prefix == null) { prefix = ""; } if (ns.equals(m.getNamespace(prefix))) { tagName = n.getNodeName(); w.write(tagName); } else { prefix = m.getPrefixForElement(ns); if (prefix == null) { prefix = m.getNewPrefix(); tagName = prefix + ':' + n.getLocalName(); w.write(tagName + " xmlns:" + prefix + "=\"" + contentToString(ns, isXML11) + '"'); m = m.declare(prefix, ns); } else { if (prefix.equals("")) { tagName = n.getLocalName(); } else { tagName = prefix + ':' + n.getLocalName(); } w.write(tagName); } } } if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); String prefix = a.getPrefix(); String ans = a.getNamespaceURI(); if (ans != null && !("xmlns".equals(prefix) || name.equals("xmlns"))) { if (prefix != null && !ans.equals(m.getNamespace(prefix)) || prefix == null) { prefix = m.getPrefixForAttr(ans); if (prefix == null) { prefix = m.getNewPrefix(); m = m.declare(prefix, ans); w.write(" xmlns:" + prefix + "=\"" + contentToString(ans, isXML11) + '"'); } name = prefix + ':' + a.getLocalName(); } } w.write(' ' + name + "=\"" + contentToString(a.getNodeValue(), isXML11) + '"'); } } Node c = n.getFirstChild(); if (c != null) { w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null); w.write("</" + tagName + '>'); } else { w.write("/>"); } break; } case Node.TEXT_NODE: w.write(contentToString(n.getNodeValue(), isXML11)); break; case Node.CDATA_SECTION_NODE: { String data = n.getNodeValue(); if (data.indexOf("]]>") != -1) { throw new IOException("Unserializable CDATA section node"); } w.write("<![CDATA[" + assertValidCharacters(data, isXML11) + "]]>"); break; } case Node.ENTITY_REFERENCE_NODE: w.write('&' + n.getNodeName() + ';'); break; case Node.PROCESSING_INSTRUCTION_NODE: { String target = n.getNodeName(); String data = n.getNodeValue(); if (target.equalsIgnoreCase("xml") || target.indexOf(':') != -1 || data.indexOf("?>") != -1) { throw new IOException("Unserializable processing instruction node"); } w.write("<?" + target + ' ' + data + "?>"); break; } case Node.COMMENT_NODE: { w.write("<!--"); String data = n.getNodeValue(); int len = data.length(); if (len != 0 && data.charAt(len - 1) == '-' || data.indexOf("--") != -1) { throw new IOException("Unserializable comment node"); } w.write(data); w.write("-->"); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType dt = (DocumentType)n; w.write("<!DOCTYPE " + n.getOwnerDocument().getDocumentElement().getNodeName()); String pubID = dt.getPublicId(); if (pubID != null) { char q = getUsableQuote(pubID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } w.write(" PUBLIC " + q + pubID + q); } String sysID = dt.getSystemId(); if (sysID != null) { char q = getUsableQuote(sysID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } if (pubID == null) { w.write(" SYSTEM"); } w.write(" " + q + sysID + q); } String subset = dt.getInternalSubset(); if (subset != null) { w.write('[' + subset + ']'); } w.write('>'); break; } default: throw new IOException("Unknown DOM node type " + n.getNodeType()); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static String assertValidCharacters(String s, boolean isXML11) throws IOException { int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } } return s; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static String contentToString(String s, boolean isXML11) throws IOException { StringBuffer result = new StringBuffer(s.length()); int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; default: result.append(c); } } return result.toString(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(String ns, String root, String uri, InputSource is) throws IOException { Document ret = createDocument(is); Element docElem = ret.getDocumentElement(); String lname = root; String nsURI = ns; if (ns == null) { int idx = lname.indexOf(':'); String nsp = (idx == -1 || idx == lname.length()-1) ? "" : lname.substring(0, idx); nsURI = namespaces.get(nsp); if (idx != -1 && idx != lname.length()-1) { lname = lname.substring(idx+1); } } String docElemNS = docElem.getNamespaceURI(); if ((docElemNS != nsURI) && ((docElemNS == null) || (!docElemNS.equals(nsURI)))) throw new IOException ("Root element namespace does not match that requested:\n" + "Requested: " + nsURI + "\n" + "Found: " + docElemNS); if (docElemNS != null) { if (!docElem.getLocalName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getLocalName()); } else { if (!docElem.getNodeName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getNodeName()); } return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void reset() throws IOException { throw new IOException("Reset unsupported"); }
// in sources/org/apache/batik/util/ParsedURLData.java
protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { if (stream != null) return stream; hasBeenOpened = true; URL url = null; try { url = buildURL(); } catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); } if (url == null) return null; URLConnection urlC = url.openConnection(); if (urlC instanceof HttpURLConnection) { if (userAgent != null) urlC.setRequestProperty(HTTP_USER_AGENT_HEADER, userAgent); if (mimeTypes != null) { String acceptHeader = ""; while (mimeTypes.hasNext()) { acceptHeader += mimeTypes.next(); if (mimeTypes.hasNext()) acceptHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_HEADER, acceptHeader); } if (encodingTypes != null) { String encodingHeader = ""; while (encodingTypes.hasNext()) { encodingHeader += encodingTypes.next(); if (encodingTypes.hasNext()) encodingHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_ENCODING_HEADER, encodingHeader); } contentType = urlC.getContentType(); contentEncoding = urlC.getContentEncoding(); postConnectionURL = urlC.getURL(); } try { return (stream = urlC.getInputStream()); } catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void charError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("invalid.char", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void endOfStreamError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("end.of.stream", new Object[] { encoding })); }
4
              
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
518
              
// in sources/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java
public File createNewFolder(File containingDir) throws IOException { if(containingDir == null) { throw new IOException(Resources.getString(EXCEPTION_CONTAINING_DIR_NULL)); } File newFolder = null; // Using NT's default folder name newFolder = createFileObject(containingDir, Resources.getString(NEW_FOLDER_NAME)); int i = 2; while (newFolder.exists() && (i < 100)) { newFolder = createFileObject (containingDir, Resources.getString(NEW_FOLDER_NAME) + " (" + i + ')' ); i++; } if(newFolder.exists()) { throw new IOException (Resources.formatMessage(EXCEPTION_DIRECTORY_ALREADY_EXISTS, new Object[]{newFolder.getAbsolutePath()})); } else { newFolder.mkdirs(); } return newFolder; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public SquiggleInputHandler getInputHandler(ParsedURL purl) throws IOException { Iterator iter = getHandlers().iterator(); SquiggleInputHandler handler = null; while (iter.hasNext()) { SquiggleInputHandler curHandler = (SquiggleInputHandler)iter.next(); if (curHandler.accept(purl)) { handler = curHandler; break; } } // No handler found, use the default one. if (handler == null) { handler = defaultHandler; } return handler; }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
public void installCustomPolicyFile() throws IOException { String securityPolicyProperty = System.getProperty(PROPERTY_JAVA_SECURITY_POLICY); if (overrideSecurityPolicy || securityPolicyProperty == null || "".equals(securityPolicyProperty)) { // Access default policy file ParsedURL policyURL = new ParsedURL(securityEnforcer.getPolicyURL()); // Override the user policy String dir = System.getProperty(PROPERTY_USER_HOME); File batikConfigDir = new File(dir, BATIK_CONFIGURATION_SUBDIRECTORY); File policyFile = new File(batikConfigDir, SQUIGGLE_POLICY_FILE); // Copy original policy file into local policy file Reader r = new BufferedReader(new InputStreamReader(policyURL.openStream())); Writer w = new FileWriter(policyFile); char[] buf = new char[1024]; int n = 0; while ( (n=r.read(buf, 0, buf.length)) != -1 ) { w.write(buf, 0, n); } r.close(); // Now, append additional grants depending on the security // settings boolean grantScriptNetworkAccess = preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS); boolean grantScriptFileAccess = preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS); if (grantScriptNetworkAccess) { w.write(POLICY_GRANT_SCRIPT_NETWORK_ACCESS); } if (grantScriptFileAccess) { w.write(POLICY_GRANT_SCRIPT_FILE_ACCESS); } w.close(); // We now use the JAVA_SECURITY_POLICY property, so // we allow override on subsequent calls. overrideSecurityPolicy = true; System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, policyFile.toURL().toString()); } }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
private void setPreferences() throws IOException { Iterator it = viewerFrames.iterator(); while (it.hasNext()) { setPreferences((JSVGViewerFrame)it.next()); } System.setProperty("proxyHost", preferenceManager.getString (PreferenceDialog.PREFERENCE_KEY_PROXY_HOST)); System.setProperty("proxyPort", preferenceManager.getString (PreferenceDialog.PREFERENCE_KEY_PROXY_PORT)); installCustomPolicyFile(); securityEnforcer.enforceSecurity (preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING) ); }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
public synchronized void load(InputStream is) throws IOException { BufferedReader r; r = new BufferedReader(new InputStreamReader(is, PREFERENCE_ENCODING)); DocumentFactory df = new SAXDocumentFactory (GenericDOMImplementation.getDOMImplementation(), xmlParserClassName); Document doc = df.createDocument("http://xml.apache.org/batik/preferences", "preferences", null, r); Element elt = doc.getDocumentElement(); for (Node n = elt.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { if (n.getNodeName().equals("property")) { String name = ((Element)n).getAttributeNS(null, "name"); StringBuffer cont = new StringBuffer(); for (Node c = n.getFirstChild(); c != null; c = c.getNextSibling()) { if (c.getNodeType() == Node.TEXT_NODE) { cont.append(c.getNodeValue()); } else { break; } } String val = cont.toString(); put(name, val); } } } }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
public synchronized void store(OutputStream os, String header) throws IOException { BufferedWriter w; w = new BufferedWriter(new OutputStreamWriter(os, PREFERENCE_ENCODING)); Map m = new HashMap(); enumerate(m); w.write("<preferences xmlns=\"http://xml.apache.org/batik/preferences\">\n"); Iterator it = m.keySet().iterator(); while (it.hasNext()) { String n = (String)it.next(); String v = (String)m.get(n); w.write("<property name=\"" + n + "\">"); try { w.write(DOMUtilities.contentToString(v, false)); } catch (IOException ex) { // unlikely to happen } w.write("</property>\n"); } w.write("</preferences>\n"); w.flush(); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterURLSource.java
public InputStream openStream() throws IOException { return purl.openStream(); }
// in sources/org/apache/batik/svggen/CachedImageHandlerBase64Encoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { Base64EncoderStream b64Encoder = new Base64EncoderStream(os); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, b64Encoder); b64Encoder.close(); }
// in sources/org/apache/batik/svggen/CachedImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); }
// in sources/org/apache/batik/svggen/CachedImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); }
// in sources/org/apache/batik/svggen/font/table/ClassDef.java
protected static ClassDef read(RandomAccessFile raf) throws IOException { ClassDef c = null; int format = raf.readUnsignedShort(); if (format == 1) { c = new ClassDefFormat1(raf); } else if (format == 2) { c = new ClassDefFormat2(raf); } return c; }
// in sources/org/apache/batik/svggen/font/table/TableFactory.java
public static Table create(DirectoryEntry de, RandomAccessFile raf) throws IOException { Table t = null; switch (de.getTag()) { case Table.BASE: break; case Table.CFF: break; case Table.DSIG: break; case Table.EBDT: break; case Table.EBLC: break; case Table.EBSC: break; case Table.GDEF: break; case Table.GPOS: t = new GposTable(de, raf); break; case Table.GSUB: t = new GsubTable(de, raf); break; case Table.JSTF: break; case Table.LTSH: break; case Table.MMFX: break; case Table.MMSD: break; case Table.OS_2: t = new Os2Table(de, raf); break; case Table.PCLT: break; case Table.VDMX: break; case Table.cmap: t = new CmapTable(de, raf); break; case Table.cvt: t = new CvtTable(de, raf); break; case Table.fpgm: t = new FpgmTable(de, raf); break; case Table.fvar: break; case Table.gasp: break; case Table.glyf: t = new GlyfTable(de, raf); break; case Table.hdmx: break; case Table.head: t = new HeadTable(de, raf); break; case Table.hhea: t = new HheaTable(de, raf); break; case Table.hmtx: t = new HmtxTable(de, raf); break; case Table.kern: t = new KernTable(de, raf); break; case Table.loca: t = new LocaTable(de, raf); break; case Table.maxp: t = new MaxpTable(de, raf); break; case Table.name: t = new NameTable(de, raf); break; case Table.prep: t = new PrepTable(de, raf); break; case Table.post: t = new PostTable(de, raf); break; case Table.vhea: break; case Table.vmtx: break; } return t; }
// in sources/org/apache/batik/svggen/font/table/Coverage.java
protected static Coverage read(RandomAccessFile raf) throws IOException { Coverage c = null; int format = raf.readUnsignedShort(); if (format == 1) { c = new CoverageFormat1(raf); } else if (format == 2) { c = new CoverageFormat2(raf); } return c; }
// in sources/org/apache/batik/svggen/font/table/Program.java
protected void readInstructions(RandomAccessFile raf, int count) throws IOException { instructions = new short[count]; for (int i = 0; i < count; i++) { instructions[i] = (short) raf.readUnsignedByte(); } }
// in sources/org/apache/batik/svggen/font/table/GsubTable.java
public LookupSubtable read(int type, RandomAccessFile raf, int offset) throws IOException { LookupSubtable s = null; switch (type) { case 1: s = SingleSubst.read(raf, offset); break; case 2: // s = MultipleSubst.read(raf, offset); break; case 3: // s = AlternateSubst.read(raf, offset); break; case 4: s = LigatureSubst.read(raf, offset); break; case 5: // s = ContextSubst.read(raf, offset); break; case 6: // s = ChainingSubst.read(raf, offset); break; } return s; }
// in sources/org/apache/batik/svggen/font/table/CmapFormat.java
protected static CmapFormat create(int format, RandomAccessFile raf) throws IOException { switch(format) { case 0: return new CmapFormat0(raf); case 2: return new CmapFormat2(raf); case 4: return new CmapFormat4(raf); case 6: return new CmapFormat6(raf); } return null; }
// in sources/org/apache/batik/svggen/font/table/NameRecord.java
protected void loadString(RandomAccessFile raf, int stringStorageOffset) throws IOException { StringBuffer sb = new StringBuffer(); raf.seek(stringStorageOffset + stringOffset); if (platformId == Table.platformAppleUnicode) { // Unicode (big-endian) for (int i = 0; i < stringLength/2; i++) { sb.append(raf.readChar()); } } else if (platformId == Table.platformMacintosh) { // Macintosh encoding, ASCII for (int i = 0; i < stringLength; i++) { sb.append((char) raf.readByte()); } } else if (platformId == Table.platformISO) { // ISO encoding, ASCII for (int i = 0; i < stringLength; i++) { sb.append((char) raf.readByte()); } } else if (platformId == Table.platformMicrosoft) { // Microsoft encoding, Unicode char c; for (int i = 0; i < stringLength/2; i++) { c = raf.readChar(); sb.append(c); } } record = sb.toString(); }
// in sources/org/apache/batik/svggen/font/table/SingleSubst.java
public static SingleSubst read(RandomAccessFile raf, int offset) throws IOException { SingleSubst s = null; raf.seek(offset); int format = raf.readUnsignedShort(); if (format == 1) { s = new SingleSubstFormat1(raf, offset); } else if (format == 2) { s = new SingleSubstFormat2(raf, offset); } return s; }
// in sources/org/apache/batik/svggen/font/table/KernSubtable.java
public static KernSubtable read(RandomAccessFile raf) throws IOException { KernSubtable table = null; /* int version =*/ raf.readUnsignedShort(); /* int length =*/ raf.readUnsignedShort(); int coverage = raf.readUnsignedShort(); int format = coverage >> 8; switch (format) { case 0: table = new KernSubtableFormat0(raf); break; case 2: table = new KernSubtableFormat2(raf); break; default: break; } return table; }
// in sources/org/apache/batik/svggen/font/table/LigatureSubst.java
public static LigatureSubst read(RandomAccessFile raf, int offset) throws IOException { LigatureSubst ls = null; raf.seek(offset); int format = raf.readUnsignedShort(); if (format == 1) { ls = new LigatureSubstFormat1(raf, offset); } return ls; }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void printIndent() throws IOException{ proxied.write(EOL); int temp = indentLevel; while(temp > 0){ if (temp > SPACES_LEN) { proxied.write(SPACES, 0, SPACES_LEN); temp -= SPACES_LEN; } else { proxied.write(SPACES, 0, temp); break; } } column = indentLevel; }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(int c) throws IOException { column++; proxied.write(c); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(char[] cbuf) throws IOException { column+=cbuf.length; proxied.write(cbuf); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(char[] cbuf, int off, int len) throws IOException{ column+=len; proxied.write(cbuf, off, len); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(String str) throws IOException { column+=str.length(); proxied.write(str); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(String str, int off, int len) throws IOException { column+=len; proxied.write(str, off, len); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void flush() throws IOException{ proxied.flush(); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void close() throws IOException{ column = -1; proxied.close(); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Attr attr, IndentWriter out, boolean escaped) throws IOException{ String name = attr.getName(); out.write (name); out.write ("=\""); writeChildrenXml(attr, out, escaped); out.write ('"'); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Attr attr, IndentWriter out, boolean escaped) throws IOException { char[] data = attr.getValue().toCharArray(); if (data == null) return; int length = data.length; int start=0, last=0; while (last < length) { char c = data[last]; switch (c) { case '<': out.write (data, start, last - start); start = last + 1; out.write ("&lt;"); break; case '>': out.write (data, start, last - start); start = last + 1; out.write ("&gt;"); break; case '&': out.write (data, start, last - start); start = last + 1; out.write ("&amp;"); break; case '"': out.write (data, start, last - start); start = last + 1; out.write ("&quot;"); break; default: // to be able to escape characters if allowed if (escaped && (c > 0x007F)) { out.write (data, start, last - start); String hex = "0000"+Integer.toHexString(c); out.write("&#x"+hex.substring(hex.length()-4)+";"); start = last + 1; } break; } last++; } out.write (data, start, last - start); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Comment comment, IndentWriter out, boolean escaped) throws IOException { char[] data = comment.getData().toCharArray(); if (data == null) { out.write("<!---->"); return; } out.write ("<!--"); boolean sawDash = false; int length = data.length; int start=0, last=0; // "--" illegal in comments, insert a space. while (last < length) { char c = data[last]; if (c == '-') { if (sawDash) { out.write (data, start, last - start); start = last; out.write (' '); } sawDash = true; } else { sawDash = false; } last++; } out.write (data, start, last - start); if (sawDash) out.write (' '); out.write ("-->"); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Text text, IndentWriter out, boolean escaped) throws IOException { writeXml(text, out, false, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Text text, IndentWriter out, boolean trimWS, boolean escaped) throws IOException { char[] data = text.getData().toCharArray(); // XXX saw this once -- being paranoid if (data == null) { System.err.println ("Null text data??"); return; } int length = data.length; int start = 0, last = 0; if (trimWS) { while (last < length) { char c = data[last]; switch (c) { case ' ': case '\t': case '\n': case '\r': last++; continue; default: break; } break; } start = last; } while (last < length) { char c = data [last]; // escape markup delimiters only ... and do bulk // writes wherever possible, for best performance // // note that character data can't have the CDATA // termination "]]>"; escaping ">" suffices, and // doing it very generally helps simple parsers // that may not be quite correct. // switch(c) { case ' ': case '\t': case '\n': case '\r': if (trimWS) { int wsStart = last; last++; while (last < length) { switch(data[last]) { case ' ': case '\t': case '\n': case '\r': last++; continue; default: break; } break; } if (last == length) { out.write(data, start, wsStart-start); return; } else { continue; } } break; case '<': // not legal in char data out.write (data, start, last - start); start = last + 1; out.write ("&lt;"); break; case '>': // see above out.write (data, start, last - start); start = last + 1; out.write ("&gt;"); break; case '&': // not legal in char data out.write (data, start, last - start); start = last + 1; out.write ("&amp;"); break; default: // to be able to escape characters if allowed if (escaped && (c > 0x007F)) { out.write (data, start, last - start); String hex = "0000"+Integer.toHexString(c); out.write("&#x"+hex.substring(hex.length()-4)+";"); start = last + 1; } break; } last++; } out.write (data, start, last - start); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(CDATASection cdataSection, IndentWriter out, boolean escaped) throws IOException { char[] data = cdataSection.getData().toCharArray(); if (data == null) { out.write ("<![CDATA[]]>"); return; } out.write ("<![CDATA["); int length = data.length; int start = 0, last = 0; while (last < length) { char c = data [last]; // embedded "]]>" needs to be split into adjacent // CDATA blocks ... can be split at either point if (c == ']') { if (((last + 2) < data.length) && (data [last + 1] == ']') && (data [last + 2] == '>')) { out.write (data, start, last - start); start = last + 1; out.write ("]]]]><![CDATA[>"); continue; } } last++; } out.write (data, start, last - start); out.write ("]]>"); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { out.write (TAG_START, 0, 1); // "<" out.write (element.getTagName()); NamedNodeMap attributes = element.getAttributes(); if (attributes != null){ int nAttr = attributes.getLength(); for(int i=0; i<nAttr; i++){ Attr attr = (Attr)attributes.item(i); out.write(' '); writeXml(attr, out, escaped); } } boolean lastElem = (element.getParentNode().getLastChild()==element); // // Write empty nodes as "<EMPTY />" to make sure version 3 // and 4 web browsers can read empty tag output as HTML. // XML allows "<EMPTY/>" too, of course. // if (!element.hasChildNodes()) { if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write(TAG_END, 0, 2); // "/>" return; } Node child = element.getFirstChild(); out.printIndent (); out.write(TAG_END, 1, 1); // ">" if ((child.getNodeType() != Node.TEXT_NODE) || (element.getLastChild() != child)) { // one text node child.. out.setIndentLevel(out.getIndentLevel()+2); } writeChildrenXml(element, out, escaped); out.write (TAG_START, 0, 2); // "</" out.write (element.getTagName()); if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write (TAG_END, 1, 1); // ">" }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { Node child = element.getFirstChild(); while (child != null) { writeXml(child, out, escaped); child = child.getNextSibling(); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeDocumentHeader(IndentWriter out) throws IOException { String encoding = null; if (out.getProxied() instanceof OutputStreamWriter) { OutputStreamWriter osw = (OutputStreamWriter)out.getProxied(); encoding = java2std(osw.getEncoding()); } out.write ("<?xml version=\"1.0\""); if (encoding != null) { out.write (" encoding=\""); out.write (encoding); out.write ('\"'); } out.write ("?>"); out.write (EOL); // Write DOCTYPE declaration here. Skip until specification is released. out.write ("<!DOCTYPE svg PUBLIC '"); out.write (SVG_PUBLIC_ID); out.write ("'"); out.write (EOL); out.write (" '"); out.write (SVG_SYSTEM_ID); out.write ("'"); out.write (">"); out.write (EOL); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Document document, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { writeDocumentHeader(out); NodeList childList = document.getChildNodes(); writeXml(childList, out, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(NodeList childList, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { int length = childList.getLength (); if (length == 0) return; for (int i = 0; i < length; i++) { Node child = childList.item(i); writeXml(child, out, escaped); out.write (EOL); } }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, ""); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(Reader scriptreader, String description) throws IOException { // oops jacl doesn't accept reader in its eval method :-( StringBuffer sbuffer = new StringBuffer(); char[] buffer = new char[1024]; int val = 0; while ((val = scriptreader.read(buffer)) != -1) { sbuffer.append(buffer, 0, val); } String str = sbuffer.toString(); return evaluate(str); }
// in sources/org/apache/batik/script/ImportInfo.java
public void addImports(URL src) throws IOException { InputStream is = null; Reader r = null; BufferedReader br = null; try { is = src.openStream(); r = new InputStreamReader(is, "UTF-8"); br = new BufferedReader(r); String line; while ((line = br.readLine()) != null) { // First strip any comment... int idx = line.indexOf('#'); if (idx != -1) line = line.substring(0, idx); // Trim whitespace. line = line.trim(); // If nothing left then loop around... if (line.length() == 0) continue; // Line must start with 'class ' or 'package '. idx = line.indexOf(' '); if (idx == -1) continue; String prefix = line.substring(0,idx); line = line.substring(idx+1); boolean isPackage = packageStr.equals(prefix); boolean isClass = classStr.equals(prefix); if (!isPackage && !isClass) continue; while (line.length() != 0) { idx = line.indexOf(' '); String id; if (idx == -1) { id = line; line = ""; } else { id = line.substring(0, idx); line = line.substring(idx+1); } if (id.length() == 0) continue; if (isClass) addClass(id); else addPackage(id); } } } finally { // close and release all io-resources to avoid leaks if ( is != null ){ try { is.close(); } catch ( IOException ignored ){} is = null; } if ( r != null ){ try{ r.close(); } catch ( IOException ignored ){} r = null; } if ( br == null ){ try{ br.close(); } catch ( IOException ignored ){} br = null; } } }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, ""); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(Reader scriptreader, String description) throws IOException { // oups jpython doesn't accept reader in its eval method :-( StringBuffer sbuffer = new StringBuffer(); char[] buffer = new char[1024]; int val = 0; while ((val = scriptreader.read(buffer)) != -1) { sbuffer.append(buffer,0, val); } String str = sbuffer.toString(); return evaluate(str); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, SOURCE_NAME_SVG); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final Reader scriptReader, final String description) throws IOException { ContextAction evaluateAction = new ContextAction() { public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } } }; try { return contextFactory.call(evaluateAction); } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (InterruptedBridgeException ibe) { throw ibe; } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public TIFFDirectory getPrivateIFD(long offset) throws IOException { return new TIFFDirectory(stream, offset, 0); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
public void encode(RenderedImage im) throws IOException { // Write the file header (8 bytes). writeFileHeader(); // Get the encoding parameters. TIFFEncodeParam encodeParam = (TIFFEncodeParam)param; Iterator iter = encodeParam.getExtraImages(); if(iter != null) { int ifdOffset = 8; RenderedImage nextImage = im; TIFFEncodeParam nextParam = encodeParam; boolean hasNext; do { hasNext = iter.hasNext(); ifdOffset = encode(nextImage, nextParam, ifdOffset, !hasNext); if(hasNext) { Object obj = iter.next(); if(obj instanceof RenderedImage) { nextImage = (RenderedImage)obj; nextParam = encodeParam; } else if(obj instanceof Object[]) { Object[] o = (Object[])obj; nextImage = (RenderedImage)o[0]; nextParam = (TIFFEncodeParam)o[1]; } } } while(hasNext); } else { encode(im, encodeParam, 8, true); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeFileHeader() throws IOException { // 8 byte image file header // Byte order used within the file - Big Endian output.write('M'); output.write('M'); // Magic value output.write(0); output.write(42); // Offset in bytes of the first IFD. writeLong(8); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeDirectory(int thisIFDOffset, SortedSet fields, int nextIFDOffset) throws IOException { // 2 byte count of number of directory entries (fields) int numEntries = fields.size(); long offsetBeyondIFD = thisIFDOffset + 12 * numEntries + 4 + 2; List tooBig = new ArrayList(); // Write number of fields in the IFD writeUnsignedShort(numEntries); Iterator iter = fields.iterator(); while(iter.hasNext()) { // 12 byte field entry TIFFField TIFFField field = (TIFFField)iter.next(); // byte 0-1 Tag that identifies a field int tag = field.getTag(); writeUnsignedShort(tag); // byte 2-3 The field type int type = field.getType(); writeUnsignedShort(type); // bytes 4-7 the number of values of the indicated type except // ASCII-valued fields which require the total number of bytes. int count = field.getCount(); int valueSize = getValueSize(field); writeLong(type == TIFFField.TIFF_ASCII ? valueSize : count); // bytes 8 - 11 the value or value offset if (valueSize > 4) { // We need an offset as data won't fit into 4 bytes writeLong(offsetBeyondIFD); offsetBeyondIFD += valueSize; tooBig.add(field); } else { writeValuesAsFourBytes(field); } } // Address of next IFD writeLong(nextIFDOffset); // Write the tag values that did not fit into 4 bytes for (int i = 0; i < tooBig.size(); i++) { writeValues((TIFFField)tooBig.get(i)); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValuesAsFourBytes(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: byte[] bytes = field.getAsBytes(); if (count > 4) count =4; for (int i=0; i<count; i++) output.write(bytes[i]); for (int i = 0; i < (4 - count); i++) output.write(0); break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); if (count > 2) count=2; for (int i=0; i<count; i++) writeUnsignedShort(chars[i]); for (int i = 0; i < (2 - count); i++) writeUnsignedShort(0); break; // unsigned 32 bits case TIFFField.TIFF_LONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValues(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: byte[] bytes = field.getAsBytes(); for (int i=0; i<count; i++) { output.write(bytes[i]); } break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); for (int i=0; i<count; i++) { writeUnsignedShort(chars[i]); } break; case TIFFField.TIFF_SSHORT: short[] shorts = field.getAsShorts(); for (int i=0; i<count; i++) { writeUnsignedShort(shorts[i]); } break; // unsigned 32 bits case TIFFField.TIFF_LONG: case TIFFField.TIFF_SLONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; case TIFFField.TIFF_FLOAT: float[] floats = field.getAsFloats(); for (int i=0; i<count; i++) { int intBits = Float.floatToIntBits(floats[i]); writeLong(intBits); } break; case TIFFField.TIFF_DOUBLE: double[] doubles = field.getAsDoubles(); for (int i=0; i<count; i++) { long longBits = Double.doubleToLongBits(doubles[i]); writeLong(longBits >>> 32); // write upper 32 bits writeLong(longBits & 0xffffffffL); // write lower 32 bits } break; case TIFFField.TIFF_RATIONAL: case TIFFField.TIFF_SRATIONAL: long[][] rationals = field.getAsRationals(); for (int i=0; i<count; i++) { writeLong(rationals[i][0]); writeLong(rationals[i][1]); } break; case TIFFField.TIFF_ASCII: for (int i=0; i<count; i++) { byte[] stringBytes = field.getAsString(i).getBytes(); output.write(stringBytes); if(stringBytes[stringBytes.length-1] != (byte)0) { output.write((byte)0); } } break; default: throw new Error("TIFFImageEncoder10"); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeUnsignedShort(int s) throws IOException { output.write((s & 0xff00) >>> 8); output.write( s & 0x00ff); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeLong(long l) throws IOException { output.write( (int)((l & 0xff000000) >>> 24)); output.write( (int)((l & 0x00ff0000) >>> 16)); output.write( (int)((l & 0x0000ff00) >>> 8)); output.write( (int) (l & 0x000000ff) ); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private long getOffset(OutputStream out) throws IOException { if(out instanceof ByteArrayOutputStream) { return ((ByteArrayOutputStream)out).size(); } else if(out instanceof SeekableOutputStream) { return ((SeekableOutputStream)out).getFilePointer(); } else { // Shouldn't happen. throw new IllegalStateException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private void initialize(SeekableStream stream) throws IOException { long nextTagOffset; int i, j; IFDOffset = stream.getFilePointer(); numEntries = readUnsignedShort(stream); fields = new TIFFField[numEntries]; for (i = 0; i < numEntries; i++) { int tag = readUnsignedShort(stream); int type = readUnsignedShort(stream); int count = (int)(readUnsignedInt(stream)); int value = 0; // The place to return to to read the next tag nextTagOffset = stream.getFilePointer() + 4; try { // If the tag data can't fit in 4 bytes, the next 4 bytes // contain the starting offset of the data if (count*sizeOfType[type] > 4) { value = (int)(readUnsignedInt(stream)); stream.seek(value); } } catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; } fieldIndex.put(new Integer(tag), new Integer(i)); Object obj = null; switch (type) { case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: case TIFFField.TIFF_ASCII: byte[] bvalues = new byte[count]; stream.readFully(bvalues, 0, count); if (type == TIFFField.TIFF_ASCII) { // Can be multiple strings int index = 0, prevIndex = 0; List v = new ArrayList(); while (index < count) { while ((index < count) && (bvalues[index++] != 0)); // When we encountered zero, means one string has ended v.add(new String(bvalues, prevIndex, (index - prevIndex)) ); prevIndex = index; } count = v.size(); String[] strings = new String[count]; v.toArray( strings ); obj = strings; } else { obj = bvalues; } break; case TIFFField.TIFF_SHORT: char[] cvalues = new char[count]; for (j = 0; j < count; j++) { cvalues[j] = (char)(readUnsignedShort(stream)); } obj = cvalues; break; case TIFFField.TIFF_LONG: long[] lvalues = new long[count]; for (j = 0; j < count; j++) { lvalues[j] = readUnsignedInt(stream); } obj = lvalues; break; case TIFFField.TIFF_RATIONAL: long[][] llvalues = new long[count][2]; for (j = 0; j < count; j++) { llvalues[j][0] = readUnsignedInt(stream); llvalues[j][1] = readUnsignedInt(stream); } obj = llvalues; break; case TIFFField.TIFF_SSHORT: short[] svalues = new short[count]; for (j = 0; j < count; j++) { svalues[j] = readShort(stream); } obj = svalues; break; case TIFFField.TIFF_SLONG: int[] ivalues = new int[count]; for (j = 0; j < count; j++) { ivalues[j] = readInt(stream); } obj = ivalues; break; case TIFFField.TIFF_SRATIONAL: int[][] iivalues = new int[count][2]; for (j = 0; j < count; j++) { iivalues[j][0] = readInt(stream); iivalues[j][1] = readInt(stream); } obj = iivalues; break; case TIFFField.TIFF_FLOAT: float[] fvalues = new float[count]; for (j = 0; j < count; j++) { fvalues[j] = readFloat(stream); } obj = fvalues; break; case TIFFField.TIFF_DOUBLE: double[] dvalues = new double[count]; for (j = 0; j < count; j++) { dvalues[j] = readDouble(stream); } obj = dvalues; break; default: System.err.println("TIFFDirectory0"); break; } fields[i] = new TIFFField(tag, type, count, obj); stream.seek(nextTagOffset); } // Read the offset of the next IFD. nextIFDOffset = readUnsignedInt(stream); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private short readShort(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readShort(); } else { return stream.readShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private int readUnsignedShort(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readUnsignedShort(); } else { return stream.readUnsignedShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private int readInt(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readInt(); } else { return stream.readIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private long readUnsignedInt(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readUnsignedInt(); } else { return stream.readUnsignedIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private long readLong(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readLong(); } else { return stream.readLongLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private float readFloat(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readFloat(); } else { return stream.readFloatLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private double readDouble(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readDouble(); } else { return stream.readDoubleLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private static int readUnsignedShort(SeekableStream stream, boolean isBigEndian) throws IOException { if (isBigEndian) { return stream.readUnsignedShort(); } else { return stream.readUnsignedShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private static long readUnsignedInt(SeekableStream stream, boolean isBigEndian) throws IOException { if (isBigEndian) { return stream.readUnsignedInt(); } else { return stream.readUnsignedIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
public static int getNumDirectories(SeekableStream stream) throws IOException{ long pointer = stream.getFilePointer(); // Save stream pointer stream.seek(0L); int endian = stream.readUnsignedShort(); if (!isValidEndianTag(endian)) { throw new IllegalArgumentException("TIFFDirectory1"); } boolean isBigEndian = (endian == 0x4d4d); int magic = readUnsignedShort(stream, isBigEndian); if (magic != 42) { throw new IllegalArgumentException("TIFFDirectory2"); } stream.seek(4L); long offset = readUnsignedInt(stream, isBigEndian); int numDirectories = 0; while (offset != 0L) { ++numDirectories; stream.seek(offset); long entries = readUnsignedShort(stream, isBigEndian); stream.skip(12*entries); offset = readUnsignedInt(stream, isBigEndian); } stream.seek(pointer); // Reset stream pointer return numDirectories; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public int getNumPages() throws IOException { return TIFFDirectory.getNumDirectories(input); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if ((page < 0) || (page >= getNumPages())) { throw new IOException("TIFFImageDecoder0"); } return new TIFFImage(input, (TIFFDecodeParam)param, page); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out) throws IOException { writeImage(image, out, null); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { Iterator iter; iter = ImageIO.getImageWritersByMIMEType(getMIMEType()); javax.imageio.ImageWriter iiowriter = null; try { iiowriter = (javax.imageio.ImageWriter)iter.next(); if (iiowriter != null) { iiowriter.addIIOWriteWarningListener(this); ImageOutputStream imgout = null; try { imgout = ImageIO.createImageOutputStream(out); ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params); ImageTypeSpecifier type; if (iwParam.getDestinationType() != null) { type = iwParam.getDestinationType(); } else { type = ImageTypeSpecifier.createFromRenderedImage(image); } //Handle metadata IIOMetadata meta = iiowriter.getDefaultImageMetadata( type, iwParam); //meta might be null for some JAI codecs as they don't support metadata if (params != null && meta != null) { meta = updateMetadata(meta, params); } //Write image iiowriter.setOutput(imgout); IIOImage iioimg = new IIOImage(image, null, meta); iiowriter.write(null, iioimg, iwParam); } finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } } } else { throw new UnsupportedOperationException("No ImageIO codec for writing " + getMIMEType() + " is available!"); } } finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b) throws IOException { dos.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b, int off, int len) throws IOException { dos.write(b, off, len); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(int b) throws IOException { dos.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeBoolean(boolean v) throws IOException { dos.writeBoolean(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeByte(int v) throws IOException { dos.writeByte(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeBytes(String s) throws IOException { dos.writeBytes(s); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeChar(int v) throws IOException { dos.writeChar(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeChars(String s) throws IOException { dos.writeChars(s); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeDouble(double v) throws IOException { dos.writeDouble(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeFloat(float v) throws IOException { dos.writeFloat(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeInt(int v) throws IOException { dos.writeInt(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeLong(long v) throws IOException { dos.writeLong(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeShort(int v) throws IOException { dos.writeShort(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeUTF(String str) throws IOException { dos.writeUTF(str); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeToStream(DataOutputStream output) throws IOException { byte[] typeSignature = new byte[4]; typeSignature[0] = (byte)type.charAt(0); typeSignature[1] = (byte)type.charAt(1); typeSignature[2] = (byte)type.charAt(2); typeSignature[3] = (byte)type.charAt(3); dos.flush(); baos.flush(); byte[] data = baos.toByteArray(); int len = data.length; output.writeInt(len); output.write(typeSignature); output.write(data, 0, len); int crc = 0xffffffff; crc = CRC.updateCRC(crc, typeSignature, 0, 4); crc = CRC.updateCRC(crc, data, 0, len); output.writeInt(crc ^ 0xffffffff); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void close() throws IOException { if ( baos != null ) { baos.close(); baos = null; } if( dos != null ) { dos.close(); dos= null; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void close() throws IOException { flush(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeInt(int x) throws IOException { out.write(x >> 24); out.write((x >> 16) & 0xff); out.write((x >> 8) & 0xff); out.write(x & 0xff); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void flush() throws IOException { if (bytesWritten == 0) return; // Length writeInt(bytesWritten); // 'IDAT' signature out.write(typeSignature); // Data out.write(buffer, 0, bytesWritten); int crc = 0xffffffff; crc = CRC.updateCRC(crc, typeSignature, 0, 4); crc = CRC.updateCRC(crc, buffer, 0, bytesWritten); // CRC writeInt(crc ^ 0xffffffff); // Reset buffer bytesWritten = 0; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b) throws IOException { this.write(b, 0, b.length); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int bytes = Math.min(segmentLength - bytesWritten, len); System.arraycopy(b, off, buffer, bytesWritten, bytes); off += bytes; len -= bytes; bytesWritten += bytes; if (bytesWritten == segmentLength) { flush(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(int b) throws IOException { buffer[bytesWritten++] = (byte)b; if (bytesWritten == segmentLength) { flush(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeMagic() throws IOException { dataOutput.write(magic); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void encodePass(OutputStream os, Raster ras, int xOffset, int yOffset, int xSkip, int ySkip) throws IOException { int minX = ras.getMinX(); int minY = ras.getMinY(); int width = ras.getWidth(); int height = ras.getHeight(); xOffset *= numBands; xSkip *= numBands; int samplesPerByte = 8/bitDepth; int numSamples = width*numBands; int[] samples = new int[numSamples]; int pixels = (numSamples - xOffset + xSkip - 1)/xSkip; int bytesPerRow = pixels*numBands; if (bitDepth < 8) { bytesPerRow = (bytesPerRow + samplesPerByte - 1)/samplesPerByte; } else if (bitDepth == 16) { bytesPerRow *= 2; } if (bytesPerRow == 0) { return; } currRow = new byte[bytesPerRow + bpp]; prevRow = new byte[bytesPerRow + bpp]; filteredRows = new byte[5][bytesPerRow + bpp]; int maxValue = (1 << bitDepth) - 1; for (int row = minY + yOffset; row < minY + height; row += ySkip) { ras.getPixels(minX, row, width, 1, samples); if (compressGray) { int shift = 8 - bitDepth; for (int i = 0; i < width; i++) { samples[i] >>= shift; } } int count = bpp; // leave first 'bpp' bytes zero int pos = 0; int tmp = 0; switch (bitDepth) { case 1: case 2: case 4: // Image can only have a single band int mask = samplesPerByte - 1; for (int s = xOffset; s < numSamples; s += xSkip) { int val = clamp(samples[s] >> bitShift, maxValue); tmp = (tmp << bitDepth) | val; if (pos++ == mask) { currRow[count++] = (byte)tmp; tmp = 0; pos = 0; } } // Left shift the last byte if (pos != 0) { tmp <<= (samplesPerByte - pos)*bitDepth; currRow[count++] = (byte)tmp; } break; case 8: for (int s = xOffset; s < numSamples; s += xSkip) { for (int b = 0; b < numBands; b++) { currRow[count++] = (byte)clamp(samples[s + b] >> bitShift, maxValue); } } break; case 16: for (int s = xOffset; s < numSamples; s += xSkip) { for (int b = 0; b < numBands; b++) { int val = clamp(samples[s + b] >> bitShift, maxValue); currRow[count++] = (byte)(val >> 8); currRow[count++] = (byte)(val & 0xff); } } break; } // Perform filtering int filterType = param.filterRow(currRow, prevRow, filteredRows, bytesPerRow, bpp); os.write(filterType); os.write(filteredRows[filterType], bpp, bytesPerRow); // Swap current and previous rows byte[] swap = currRow; currRow = prevRow; prevRow = swap; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIDAT() throws IOException { IDATOutputStream ios = new IDATOutputStream(dataOutput, 8192); DeflaterOutputStream dos = new DeflaterOutputStream(ios, new Deflater(9)); // Future work - don't convert entire image to a Raster It // might seem that you could just call image.getData() but // 'BufferedImage.subImage' doesn't appear to set the Width // and height properly of the Child Raster, so the Raster // you get back here appears larger than it should. // This solves that problem by bounding the raster to the // image's bounds... Raster ras = image.getData(new Rectangle(image.getMinX(), image.getMinY(), image.getWidth(), image.getHeight())); // System.out.println("Image: [" + // image.getMinY() + ", " + // image.getMinX() + ", " + // image.getWidth() + ", " + // image.getHeight() + "]"); // System.out.println("Ras: [" + // ras.getMinX() + ", " + // ras.getMinY() + ", " + // ras.getWidth() + ", " + // ras.getHeight() + "]"); if (skipAlpha) { int numBands = ras.getNumBands() - 1; int[] bandList = new int[numBands]; for (int i = 0; i < numBands; i++) { bandList[i] = i; } ras = ras.createChild(0, 0, ras.getWidth(), ras.getHeight(), 0, 0, bandList); } if (interlace) { // Interlacing pass 1 encodePass(dos, ras, 0, 0, 8, 8); // Interlacing pass 2 encodePass(dos, ras, 4, 0, 8, 8); // Interlacing pass 3 encodePass(dos, ras, 0, 4, 4, 8); // Interlacing pass 4 encodePass(dos, ras, 2, 0, 4, 4); // Interlacing pass 5 encodePass(dos, ras, 0, 2, 2, 4); // Interlacing pass 6 encodePass(dos, ras, 1, 0, 2, 2); // Interlacing pass 7 encodePass(dos, ras, 0, 1, 1, 2); } else { encodePass(dos, ras, 0, 0, 1, 1); } dos.finish(); dos.close(); ios.flush(); ios.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIEND() throws IOException { ChunkStream cs = new ChunkStream("IEND"); cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeCHRM() throws IOException { if (param.isChromaticitySet() || param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("cHRM"); float[] chroma; if (!param.isSRGBIntentSet()) { chroma = param.getChromaticity(); } else { chroma = srgbChroma; // SRGB chromaticities } for (int i = 0; i < 8; i++) { cs.writeInt((int)(chroma[i]*100000)); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeGAMA() throws IOException { if (param.isGammaSet() || param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("gAMA"); float gamma; if (!param.isSRGBIntentSet()) { gamma = param.getGamma(); } else { gamma = 1.0F/2.2F; // SRGB gamma } // TD should include the .5 but causes regard to say // everything is different. cs.writeInt((int)(gamma*100000/*+0.5*/)); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeICCP() throws IOException { if (param.isICCProfileDataSet()) { ChunkStream cs = new ChunkStream("iCCP"); byte[] ICCProfileData = param.getICCProfileData(); cs.write(ICCProfileData); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int i = 0; i < len; i++) { cs.writeByte(significantBits[i]); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSRGB() throws IOException { if (param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("sRGB"); int intent = param.getSRGBIntent(); cs.write(intent); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeBKGD() throws IOException { if (param.isBackgroundSet()) { ChunkStream cs = new ChunkStream("bKGD"); switch (colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAY_ALPHA: int gray = ((PNGEncodeParam.Gray)param).getBackgroundGray(); cs.writeShort(gray); break; case PNG_COLOR_PALETTE: int index = ((PNGEncodeParam.Palette)param).getBackgroundPaletteIndex(); cs.writeByte(index); break; case PNG_COLOR_RGB: case PNG_COLOR_RGB_ALPHA: int[] rgb = ((PNGEncodeParam.RGB)param).getBackgroundRGB(); cs.writeShort(rgb[0]); cs.writeShort(rgb[1]); cs.writeShort(rgb[2]); break; } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeHIST() throws IOException { if (param.isPaletteHistogramSet()) { ChunkStream cs = new ChunkStream("hIST"); int[] hist = param.getPaletteHistogram(); for (int i = 0; i < hist.length; i++) { cs.writeShort(hist[i]); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTRNS() throws IOException { if (param.isTransparencySet() && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { ChunkStream cs = new ChunkStream("tRNS"); if (param instanceof PNGEncodeParam.Palette) { byte[] t = ((PNGEncodeParam.Palette)param).getPaletteTransparency(); for (int i = 0; i < t.length; i++) { cs.writeByte(t[i]); } } else if (param instanceof PNGEncodeParam.Gray) { int t = ((PNGEncodeParam.Gray)param).getTransparentGray(); cs.writeShort(t); } else if (param instanceof PNGEncodeParam.RGB) { int[] t = ((PNGEncodeParam.RGB)param).getTransparentRGB(); cs.writeShort(t[0]); cs.writeShort(t[1]); cs.writeShort(t[2]); } cs.writeToStream(dataOutput); cs.close(); } else if (colorType == PNG_COLOR_PALETTE) { int lastEntry = Math.min(255, alphaPalette.length - 1); int nonOpaque; for (nonOpaque = lastEntry; nonOpaque >= 0; nonOpaque--) { if (alphaPalette[nonOpaque] != (byte)255) { break; } } if (nonOpaque >= 0) { ChunkStream cs = new ChunkStream("tRNS"); for (int i = 0; i <= nonOpaque; i++) { cs.writeByte(alphaPalette[i]); } cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSPLT() throws IOException { if (param.isSuggestedPaletteSet()) { ChunkStream cs = new ChunkStream("sPLT"); System.out.println("sPLT not supported yet."); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTIME() throws IOException { if (param.isModificationTimeSet()) { ChunkStream cs = new ChunkStream("tIME"); Date date = param.getModificationTime(); TimeZone gmt = TimeZone.getTimeZone("GMT"); GregorianCalendar cal = new GregorianCalendar(gmt); cal.setTime(date); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); cs.writeShort(year); cs.writeByte(month + 1); cs.writeByte(day); cs.writeByte(hour); cs.writeByte(minute); cs.writeByte(second); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTEXT() throws IOException { if (param.isTextSet()) { String[] text = param.getText(); for (int i = 0; i < text.length/2; i++) { byte[] keyword = text[2*i].getBytes(); byte[] value = text[2*i + 1].getBytes(); ChunkStream cs = new ChunkStream("tEXt"); cs.write(keyword, 0, Math.min(keyword.length, 79)); cs.write(0); cs.write(value); cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeZTXT() throws IOException { if (param.isCompressedTextSet()) { String[] text = param.getCompressedText(); for (int i = 0; i < text.length/2; i++) { byte[] keyword = text[2*i].getBytes(); byte[] value = text[2*i + 1].getBytes(); ChunkStream cs = new ChunkStream("zTXt"); cs.write(keyword, 0, Math.min(keyword.length, 79)); cs.write(0); cs.write(0); DeflaterOutputStream dos = new DeflaterOutputStream(cs); dos.write(value); dos.finish(); dos.close(); cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePrivateChunks() throws IOException { int numChunks = param.getNumPrivateChunks(); for (int i = 0; i < numChunks; i++) { String type = param.getPrivateChunkType(i); byte[] data = param.getPrivateChunkData(i); ChunkStream cs = new ChunkStream(type); cs.write(data); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void encode(RenderedImage im) throws IOException { this.image = im; this.width = image.getWidth(); this.height = image.getHeight(); SampleModel sampleModel = image.getSampleModel(); int[] sampleSize = sampleModel.getSampleSize(); // Set bitDepth to a sentinel value this.bitDepth = -1; this.bitShift = 0; // Allow user to override the bit depth of gray images if (param instanceof PNGEncodeParam.Gray) { PNGEncodeParam.Gray paramg = (PNGEncodeParam.Gray)param; if (paramg.isBitDepthSet()) { this.bitDepth = paramg.getBitDepth(); } if (paramg.isBitShiftSet()) { this.bitShift = paramg.getBitShift(); } } // Get bit depth from image if not set in param if (this.bitDepth == -1) { // Get bit depth from channel 0 of the image this.bitDepth = sampleSize[0]; // Ensure all channels have the same bit depth for (int i = 1; i < sampleSize.length; i++) { if (sampleSize[i] != bitDepth) { throw new RuntimeException(); } } // Round bit depth up to a power of 2 if (bitDepth > 2 && bitDepth < 4) { bitDepth = 4; } else if (bitDepth > 4 && bitDepth < 8) { bitDepth = 8; } else if (bitDepth > 8 && bitDepth < 16) { bitDepth = 16; } else if (bitDepth > 16) { throw new RuntimeException(); } } this.numBands = sampleModel.getNumBands(); this.bpp = numBands*((bitDepth == 16) ? 2 : 1); ColorModel colorModel = image.getColorModel(); if (colorModel instanceof IndexColorModel) { if (bitDepth < 1 || bitDepth > 8) { throw new RuntimeException(); } if (sampleModel.getNumBands() != 1) { throw new RuntimeException(); } IndexColorModel icm = (IndexColorModel)colorModel; int size = icm.getMapSize(); redPalette = new byte[size]; greenPalette = new byte[size]; bluePalette = new byte[size]; alphaPalette = new byte[size]; icm.getReds(redPalette); icm.getGreens(greenPalette); icm.getBlues(bluePalette); icm.getAlphas(alphaPalette); this.bpp = 1; if (param == null) { param = createGrayParam(redPalette, greenPalette, bluePalette, alphaPalette); } // If param is still null, it can't be expressed as gray if (param == null) { param = new PNGEncodeParam.Palette(); } if (param instanceof PNGEncodeParam.Palette) { // If palette not set in param, create one from the ColorModel. PNGEncodeParam.Palette parami = (PNGEncodeParam.Palette)param; if (parami.isPaletteSet()) { int[] palette = parami.getPalette(); size = palette.length/3; int index = 0; for (int i = 0; i < size; i++) { redPalette[i] = (byte)palette[index++]; greenPalette[i] = (byte)palette[index++]; bluePalette[i] = (byte)palette[index++]; alphaPalette[i] = (byte)255; } } this.colorType = PNG_COLOR_PALETTE; } else if (param instanceof PNGEncodeParam.Gray) { redPalette = greenPalette = bluePalette = alphaPalette = null; this.colorType = PNG_COLOR_GRAY; } else { throw new RuntimeException(); } } else if (numBands == 1) { if (param == null) { param = new PNGEncodeParam.Gray(); } this.colorType = PNG_COLOR_GRAY; } else if (numBands == 2) { if (param == null) { param = new PNGEncodeParam.Gray(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 1; if ((sampleSize[0] == 8) && (bitDepth < 8)) { compressGray = true; } bpp = (bitDepth == 16) ? 2 : 1; this.colorType = PNG_COLOR_GRAY; } else { if (this.bitDepth < 8) { this.bitDepth = 8; } this.colorType = PNG_COLOR_GRAY_ALPHA; } } else if (numBands == 3) { if (param == null) { param = new PNGEncodeParam.RGB(); } this.colorType = PNG_COLOR_RGB; } else if (numBands == 4) { if (param == null) { param = new PNGEncodeParam.RGB(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 3; bpp = (bitDepth == 16) ? 6 : 3; this.colorType = PNG_COLOR_RGB; } else { this.colorType = PNG_COLOR_RGB_ALPHA; } } interlace = param.getInterlacing(); writeMagic(); writeIHDR(); writeCHRM(); writeGAMA(); writeICCP(); writeSBIT(); writeSRGB(); writePLTE(); writeHIST(); writeTRNS(); writeBKGD(); writePHYS(); writeSPLT(); writeTIME(); writeTEXT(); writeZTXT(); writePrivateChunks(); writeIDAT(); writeIEND(); dataOutput.flush(); dataOutput.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if (page != 0) { throw new IOException(PropertyUtil.getString("PNGImageDecoder19")); } return new PNGImage(input, (PNGDecodeParam)param); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java
public void writeImage(RenderedImage image, OutputStream out) throws IOException { writeImage(image, out, null); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { PNGImageEncoder encoder = new PNGImageEncoder(out, null); encoder.encode(image); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public int getNumPages() throws IOException { return 1; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public Raster decodeAsRaster() throws IOException { return decodeAsRaster(0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public Raster decodeAsRaster(int page) throws IOException { RenderedImage im = decodeAsRenderedImage(page); return im.getData(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public RenderedImage decodeAsRenderedImage() throws IOException { return decodeAsRenderedImage(0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageEncoderImpl.java
public void encode(Raster ras, ColorModel cm) throws IOException { RenderedImage im = new SingleTileRenderedImage(ras, cm); encode(im); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(int b) throws IOException { file.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(byte[] b) throws IOException { file.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(byte[] b, int off, int len) throws IOException { file.write(b, off, len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void flush() throws IOException { file.getFD().sync(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void close() throws IOException { file.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public long getFilePointer() throws IOException { return file.getFilePointer(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void seek(long pos) throws IOException { file.seek(pos); }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
private long readUntil(long pos) throws IOException { // We've already got enough data cached if (pos < length) { return pos; } // pos >= length but length isn't getting any bigger, so return it if (foundEOS) { return length; } int sector = (int)(pos >> SECTOR_SHIFT); // First unread sector int startSector = length >> SECTOR_SHIFT; // Read sectors until the desired sector for (int i = startSector; i <= sector; i++) { byte[] buf = new byte[SECTOR_SIZE]; data.add(buf); // Read up to SECTOR_SIZE bytes int len = SECTOR_SIZE; int off = 0; while (len > 0) { int nbytes = src.read(buf, off, len); // Found the end-of-stream if (nbytes == -1) { foundEOS = true; return length; } off += nbytes; len -= nbytes; // Record new data length length += nbytes; } } return length; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("MemoryCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read() throws IOException { long next = pointer + 1; long pos = readUntil(next); if (pos >= next) { byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); return buf[(int)(pointer++ & SECTOR_MASK)] & 0xff; } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public synchronized void reset() throws IOException { if (markPos != -1) { seek(markPos); } }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b) throws IOException { readFully(b, 0, b.length); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b, int off, int len) throws IOException { int n = 0; do { int count = this.read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public int skipBytes(int n) throws IOException { if (n <= 0) { return 0; } return (int)skip(n); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final boolean readBoolean() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (ch != 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final byte readByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 8) + (ch2 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch2 << 8) + (ch1 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readChar() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readCharLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readInt() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readIntLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedInt() throws IOException { long ch1 = this.read(); long ch2 = this.read(); long ch3 = this.read(); long ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedIntLE() throws IOException { this.readFully(ruileBuf); long ch1 = (ruileBuf[0] & 0xff); long ch2 = (ruileBuf[1] & 0xff); long ch3 = (ruileBuf[2] & 0xff); long ch4 = (ruileBuf[3] & 0xff); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readLong() throws IOException { return ((long)(readInt()) << 32) + (readInt() & 0xFFFFFFFFL); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readLongLE() throws IOException { int i1 = readIntLE(); int i2 = readIntLE(); return ((long)i2 << 32) + (i1 & 0xFFFFFFFFL); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final float readFloatLE() throws IOException { return Float.intBitsToFloat(readIntLE()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final double readDoubleLE() throws IOException { return Double.longBitsToDouble(readLongLE()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final String readLine() throws IOException { StringBuffer input = new StringBuffer(); int c = -1; boolean eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; break; case '\r': eol = true; long cur = getFilePointer(); if ((read()) != '\n') { seek(cur); } break; default: input.append((char)c); break; } } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final String readUTF() throws IOException { return DataInputStream.readUTF(this); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int read() throws IOException { int result = src.read(); if (result != -1) { ++pointer; } return result; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int read(byte[] b, int off, int len) throws IOException { int result = src.read(b, off, len); if (result != -1) { pointer += result; } return result; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final long skip(long n) throws IOException { long skipped = src.skip(n); pointer += skipped; return skipped; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int available() throws IOException { return src.available(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final void close() throws IOException { src.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final synchronized void reset() throws IOException { if (markPos != -1) { pointer = markPos; } src.reset(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final void seek(long pos) throws IOException { while (pos - pointer > 0) { pointer += src.skip(pos - pointer); } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
private long readUntil(long pos) throws IOException { // We've already got enough data cached if (pos < length) { return pos; } // pos >= length but length isn't getting any bigger, so return it if (foundEOF) { return length; } long len = pos - length; cache.seek(length); while (len > 0) { // Copy a buffer's worth of data from the source to the cache // bufLen will always fit into an int so this is safe int nbytes = stream.read(buf, 0, (int)Math.min(len, bufLen)); if (nbytes == -1) { foundEOF = true; return length; } cache.setLength(cache.length() + nbytes); cache.write(buf, 0, nbytes); len -= nbytes; length += nbytes; } return pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("FileCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read() throws IOException { long next = pointer + 1; long pos = readUntil(next); if (pos >= next) { cache.seek(pointer++); return cache.read(); } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void close() throws IOException { super.close(); cache.close(); cacheFile.delete(); }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDocumentStart() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.S; case '<': switch (nextChar()) { case '?': int c1 = nextChar(); if (c1 == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)c1)) { throw createXMLException("invalid.pi.target"); } context = PI_CONTEXT; int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if (c1 == 'x' && c2 == 'm' && c3 == 'l') { context = XML_DECL_CONTEXT; return LexicalUnits.XML_DECL_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.doctype"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: if (depth == 0) { throw createXMLException("invalid.character"); } else { return nextInContent(); } } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInTopLevel() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.character"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInPI() throws IOException, XMLException { if (piEndRead) { piEndRead = false; context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.PI_END; } switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '?': if (nextChar() != '>') { throw createXMLException("pi.end.expected"); } nextChar(); if (inDTD) { context = DTD_DECLARATIONS_CONTEXT; } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } return LexicalUnits.PI_END; default: do { do { nextChar(); } while (current != -1 && current != '?'); nextChar(); } while (current != -1 && current != '>'); nextChar(); piEndRead = true; return LexicalUnits.PI_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInStartTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '/': if (nextChar() != '>') { throw createXMLException("malformed.tag.end"); } nextChar(); context = (--depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.EMPTY_ELEMENT_END; case '>': nextChar(); context = CONTENT_CONTEXT; return LexicalUnits.END_CHAR; case '=': nextChar(); return LexicalUnits.EQ; case '"': attrDelimiter = '"'; nextChar(); for (;;) { switch (current) { case '"': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } case '\'': attrDelimiter = '\''; nextChar(); for (;;) { switch (current) { case '\'': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttributeValue() throws IOException, XMLException { if (current == -1) { return LexicalUnits.EOF; } if (current == '&') { return readReference(); } else { loop: for (;;) { switch (current) { case '&': case '<': case -1: break loop; case '"': case '\'': if (current == attrDelimiter) { break loop; } } nextChar(); } switch (current) { case -1: break; case '<': throw createXMLException("invalid.character"); case '&': return LexicalUnits.ATTRIBUTE_FRAGMENT; case '\'': case '"': nextChar(); if (inDTD) { context = ATTLIST_CONTEXT; } else { context = START_TAG_CONTEXT; } } return LexicalUnits.LAST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInContent() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier("CDATA[", LexicalUnits.CDATA_START, -1); default: throw createXMLException("invalid.character"); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEndTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': if (--depth < 0) { throw createXMLException("unexpected.end.tag"); } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } nextChar(); return LexicalUnits.END_CHAR; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInCDATASection() throws IOException, XMLException { if (cdataEndRead) { cdataEndRead = false; context = CONTENT_CONTEXT; return LexicalUnits.SECTION_END; } while (current != -1) { while (current != ']' && current != -1) { nextChar(); } if (current != -1) { nextChar(); if (current == ']') { nextChar(); if (current == '>') { break; } } } } if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); cdataEndRead = true; return LexicalUnits.CHARACTER_DATA; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInXMLDecl() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case 'v': return readIdentifier("ersion", LexicalUnits.VERSION_IDENTIFIER, -1); case 'e': return readIdentifier("ncoding", LexicalUnits.ENCODING_IDENTIFIER, -1); case 's': return readIdentifier("tandalone", LexicalUnits.STANDALONE_IDENTIFIER, -1); case '=': nextChar(); return LexicalUnits.EQ; case '?': nextChar(); if (current != '>') { throw createXMLException("pi.end.expected"); } nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.PI_END; case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDoctype() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.END_CHAR; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); case '[': nextChar(); context = DTD_DECLARATIONS_CONTEXT; inDTD = true; return LexicalUnits.LSQUARE_BRACKET; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDTDDeclarations() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case ']': nextChar(); context = DOCTYPE_CONTEXT; inDTD = false; return LexicalUnits.RSQUARE_BRACKET; case '%': return readPEReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'E': switch (nextChar()) { case 'L': context = ELEMENT_DECLARATION_CONTEXT; return readIdentifier ("EMENT", LexicalUnits.ELEMENT_DECLARATION_START, -1); case 'N': context = ENTITY_CONTEXT; return readIdentifier("TITY", LexicalUnits.ENTITY_START, -1); default: throw createXMLException("invalid.character"); } case 'A': context = ATTLIST_CONTEXT; return readIdentifier("TTLIST", LexicalUnits.ATTLIST_START, -1); case 'N': context = NOTATION_CONTEXT; return readIdentifier("OTATION", LexicalUnits.NOTATION_START, -1); default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readString() throws IOException, XMLException { do { nextChar(); } while (current != -1 && current != attrDelimiter); if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readComment() throws IOException, XMLException { if (nextChar() != '-') { throw createXMLException("malformed.comment"); } int c = nextChar(); while (c != -1) { while (c != -1 && c != '-') { c = nextChar(); } c = nextChar(); if (c == '-') { break; } } if (c == -1) { throw createXMLException("unexpected.eof"); } c = nextChar(); if (c != '>') { throw createXMLException("malformed.comment"); } nextChar(); return LexicalUnits.COMMENT; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readIdentifier(String s, int type, int ntype) throws IOException, XMLException { int len = s.length(); for (int i = 0; i < len; i++) { nextChar(); if (current != s.charAt(i)) { if (ntype == -1) { throw createXMLException("invalid.character"); } else { while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return ntype; } } } nextChar(); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readName(int type) throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.name"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPIStart() throws IOException, XMLException { int c1 = nextChar(); if (c1 == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("malformed.pi.target"); } int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInElementDeclaration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'E': return readIdentifier("MPTY", LexicalUnits.EMPTY_IDENTIFIER, LexicalUnits.NAME); case 'A': return readIdentifier("NY", LexicalUnits.ANY_IDENTIFIER, LexicalUnits.NAME); case '?': nextChar(); return LexicalUnits.QUESTION; case '+': nextChar(); return LexicalUnits.PLUS; case '*': nextChar(); return LexicalUnits.STAR; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); return LexicalUnits.RIGHT_BRACE; case '|': nextChar(); return LexicalUnits.PIPE; case ',': nextChar(); return LexicalUnits.COMMA; case '#': return readIdentifier("PCDATA", LexicalUnits.PCDATA_IDENTIFIER, -1); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttList() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return type = LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'C': return readIdentifier("DATA", LexicalUnits.CDATA_IDENTIFIER, LexicalUnits.NAME); case 'I': nextChar(); if (current != 'D') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ID_IDENTIFIER; } if (current != 'R') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'F') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREF_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREFS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; case 'N': switch (nextChar()) { default: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'O': context = NOTATION_TYPE_CONTEXT; return readIdentifier("TATION", LexicalUnits.NOTATION_IDENTIFIER, LexicalUnits.NAME); case 'M': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'O') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'K') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKEN_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKENS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case 'E': nextChar(); if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'I') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } switch (current) { case 'Y': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ENTITY_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'I': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } return LexicalUnits.ENTITIES_IDENTIFIER; default: if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&') { do { nextChar(); } while (current != -1 && current != '"' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '"': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '#': switch (nextChar()) { case 'R': return readIdentifier("EQUIRED", LexicalUnits.REQUIRED_IDENTIFIER, -1); case 'I': return readIdentifier("MPLIED", LexicalUnits.IMPLIED_IDENTIFIER, -1); case 'F': return readIdentifier("IXED", LexicalUnits.FIXED_IDENTIFIER, -1); default: throw createXMLException("invalid.character"); } case '(': nextChar(); context = ENUMERATION_CONTEXT; return LexicalUnits.LEFT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotation() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntity() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); return LexicalUnits.PERCENT; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case 'N': return readIdentifier("DATA", LexicalUnits.NDATA_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '"' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '"': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '\'': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntityValue() throws IOException, XMLException { switch (current) { case '&': return readReference(); case '%': int t = nextChar(); readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return t; default: while (current != -1 && current != attrDelimiter && current != '&' && current != '%') { nextChar(); } switch (current) { case -1: throw createXMLException("unexpected.eof"); case '\'': case '"': nextChar(); context = ENTITY_CONTEXT; return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotationType() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEnumeration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readNmtoken(); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readReference() throws IOException, XMLException { nextChar(); if (current == '#') { nextChar(); int i = 0; switch (current) { case 'x': do { i++; nextChar(); } while ((current >= '0' && current <= '9') || (current >= 'a' && current <= 'f') || (current >= 'A' && current <= 'F')); break; default: do { i++; nextChar(); } while (current >= '0' && current <= '9'); break; case -1: throw createXMLException("unexpected.eof"); } if (i == 1 || current != ';') { throw createXMLException("character.reference"); } nextChar(); return LexicalUnits.CHARACTER_REFERENCE; } else { int t = readName(LexicalUnits.ENTITY_REFERENCE); if (current != ';') { throw createXMLException("character.reference"); } nextChar(); return t; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPEReference() throws IOException, XMLException { nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.parameter.entity"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return LexicalUnits.PARAMETER_ENTITY_REFERENCE; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readNmtoken() throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } while (XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return LexicalUnits.NMTOKEN; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { char[] t = new char[ 1+ position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/xml/XMLUtilities.java
public static Reader createXMLDocumentReader(InputStream is) throws IOException { PushbackInputStream pbis = new PushbackInputStream(is, 128); byte[] buf = new byte[4]; int len = pbis.read(buf); if (len > 0) { pbis.unread(buf, 0, len); } if (len == 4) { switch (buf[0] & 0x00FF) { case 0: if (buf[1] == 0x003c && buf[2] == 0x0000 && buf[3] == 0x003f) { return new InputStreamReader(pbis, "UnicodeBig"); } break; case '<': switch (buf[1] & 0x00FF) { case 0: if (buf[2] == 0x003f && buf[3] == 0x0000) { return new InputStreamReader(pbis, "UnicodeLittle"); } break; case '?': if (buf[2] == 'x' && buf[3] == 'm') { Reader r = createXMLDeclarationReader(pbis, "UTF8"); String enc = getXMLDeclarationEncoding(r, "UTF8"); return new InputStreamReader(pbis, enc); } } break; case 0x004C: if (buf[1] == 0x006f && (buf[2] & 0x00FF) == 0x00a7 && (buf[3] & 0x00FF) == 0x0094) { Reader r = createXMLDeclarationReader(pbis, "CP037"); String enc = getXMLDeclarationEncoding(r, "CP037"); return new InputStreamReader(pbis, enc); } break; case 0x00FE: if ((buf[1] & 0x00FF) == 0x00FF) { return new InputStreamReader(pbis, "Unicode"); } break; case 0x00FF: if ((buf[1] & 0x00FF) == 0x00FE) { return new InputStreamReader(pbis, "Unicode"); } } } return new InputStreamReader(pbis, "UTF8"); }
// in sources/org/apache/batik/xml/XMLUtilities.java
protected static Reader createXMLDeclarationReader(PushbackInputStream pbis, String enc) throws IOException { byte[] buf = new byte[128]; int len = pbis.read(buf); if (len > 0) { pbis.unread(buf, 0, len); } return new InputStreamReader(new ByteArrayInputStream(buf, 4, len), enc); }
// in sources/org/apache/batik/xml/XMLUtilities.java
protected static String getXMLDeclarationEncoding(Reader r, String e) throws IOException { int c; if ((c = r.read()) != 'l') { return e; } if (!isXMLSpace((char)(c = r.read()))) { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != 'v') { return e; } if ((c = r.read()) != 'e') { return e; } if ((c = r.read()) != 'r') { return e; } if ((c = r.read()) != 's') { return e; } if ((c = r.read()) != 'i') { return e; } if ((c = r.read()) != 'o') { return e; } if ((c = r.read()) != 'n') { return e; } c = r.read(); while (isXMLSpace((char)c)) { c = r.read(); } if (c != '=') { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != '"' && c != '\'') { return e; } char sc = (char)c; for (;;) { c = r.read(); if (c == sc) { break; } if (!isXMLVersionCharacter((char)c)) { return e; } } if (!isXMLSpace((char)(c = r.read()))) { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != 'e') { return e; } if ((c = r.read()) != 'n') { return e; } if ((c = r.read()) != 'c') { return e; } if ((c = r.read()) != 'o') { return e; } if ((c = r.read()) != 'd') { return e; } if ((c = r.read()) != 'i') { return e; } if ((c = r.read()) != 'n') { return e; } if ((c = r.read()) != 'g') { return e; } c = r.read(); while (isXMLSpace((char)c)) { c = r.read(); } if (c != '=') { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != '"' && c != '\'') { return e; } sc = (char)c; StringBuffer enc = new StringBuffer(); for (;;) { c = r.read(); if (c == -1) { return e; } if (c == sc) { return encodingToJavaEncoding(enc.toString(), e); } enc.append((char)c); } }
// in sources/org/apache/batik/parser/PointsParser.java
protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); }
// in sources/org/apache/batik/parser/TimingSpecifierListParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); ((TimingSpecifierListHandler) timingSpecifierHandler) .startTimingSpecifierList(); skipSpaces(); if (current != -1) { for (;;) { Object[] spec = parseTimingSpecifier(); handleTimingSpecifier(spec); skipSpaces(); if (current == -1) { break; } if (current == ';') { current = reader.read(); continue; } reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportUnexpectedCharacterError( current ); } ((TimingSpecifierListHandler) timingSpecifierHandler) .endTimingSpecifierList(); }
// in sources/org/apache/batik/parser/NumberListParser.java
protected void doParse() throws ParseException, IOException { numberListHandler.startNumberList(); current = reader.read(); skipSpaces(); try { for (;;) { numberListHandler.startNumber(); float f = parseFloat(); numberListHandler.numberValue(f); numberListHandler.endNumber(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } numberListHandler.endNumberList(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PathParser p = new PathParser(); AWTPathProducer ph = new AWTPathProducer(); ph.setWindingRule(wr); p.setPathHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/LengthListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler)lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler)lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void skipSpaces() throws IOException { for (;;) { switch (current) { default: return; case 0x20: case 0x09: case 0x0D: case 0x0A: } current = reader.read(); } }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void skipCommaSpaces() throws IOException { wsp1: for (;;) { switch (current) { default: break wsp1; case 0x20: case 0x9: case 0xD: case 0xA: } current = reader.read(); } if (current == ',') { wsp2: for (;;) { switch (current = reader.read()) { default: break wsp2; case 0x20: case 0x9: case 0xD: case 0xA: } } } }
// in sources/org/apache/batik/parser/NumberParser.java
protected float parseFloat() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; switch (current) { case '-': mantPos = false; // fallthrough case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return 0.0f; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; case '.': case 'e': case 'E': break m1; default: return 0.0f; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return 0.0f; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: if (!mantRead) { return 0.0f; } break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } switch (current) { case 'e': case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } return buildFloat(mant, exp); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } lengthHandler.endLength(); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void parseLength() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; int unitState = 0; switch (current) { case '-': mantPos = false; case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m1; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } boolean le = false; es: switch (current) { case 'e': le = true; case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 1; break es; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 2; break es; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } lengthHandler.lengthValue(NumberParser.buildFloat(mant, exp)); switch (unitState) { case 1: lengthHandler.em(); current = reader.read(); return; case 2: lengthHandler.ex(); current = reader.read(); return; } switch (current) { case 'e': current = reader.read(); switch (current) { case 'm': lengthHandler.em(); current = reader.read(); break; case 'x': lengthHandler.ex(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'p': current = reader.read(); switch (current) { case 'c': lengthHandler.pc(); current = reader.read(); break; case 't': lengthHandler.pt(); current = reader.read(); break; case 'x': lengthHandler.px(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'i': current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break; } lengthHandler.in(); current = reader.read(); break; case 'c': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.cm(); current = reader.read(); break; case 'm': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.mm(); current = reader.read(); break; case '%': lengthHandler.percentage(); current = reader.read(); break; } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void doParse() throws ParseException, IOException { bufferSize = 0; current = reader.read(); fragmentIdentifierHandler.startFragmentIdentifier(); ident: { String id = null; switch (current) { case 'x': bufferize(); current = reader.read(); if (current != 'p') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'o') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'n') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 't') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'r') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break ident; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break ident; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break ident; } current = reader.read(); if (current != '"' && current != '\'') { reportCharacterExpectedError( '\'', current ); break ident; } char q = (char)current; current = reader.read(); parseIdentifier(); id = getBufferContent(); bufferSize = 0; fragmentIdentifierHandler.idReference(id); if (current != q) { reportCharacterExpectedError( q, current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; case 's': bufferize(); current = reader.read(); if (current != 'v') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'g') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'V') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'w') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); parseViewAttributes(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; default: if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { break ident; } bufferize(); current = reader.read(); parseIdentifier(); } id = getBufferContent(); fragmentIdentifierHandler.idReference(id); } fragmentIdentifierHandler.endFragmentIdentifier(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseViewAttributes() throws ParseException, IOException { boolean first = true; loop: for (;;) { switch (current) { case -1: case ')': if (first) { reportUnexpectedCharacterError( current ); break loop; } // fallthrough default: break loop; case ';': if (first) { reportUnexpectedCharacterError( current ); break loop; } current = reader.read(); break; case 'v': first = false; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); break loop; } current = reader.read(); switch (current) { case 'B': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); float x = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float y = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float w = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float h = parseFloat(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.viewBox(x, y, w, h); if (current != ')' && current != ';') { reportCharacterExpectedError( ')', current ); break loop; } break; case 'T': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.startViewTarget(); id: for (;;) { bufferSize = 0; if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { reportUnexpectedCharacterError( current ); break loop; } bufferize(); current = reader.read(); parseIdentifier(); String s = getBufferContent(); fragmentIdentifierHandler.viewTarget(s); bufferSize = 0; switch (current) { case ')': current = reader.read(); break id; case ',': case ';': current = reader.read(); break; default: reportUnexpectedCharacterError( current ); break loop; } } fragmentIdentifierHandler.endViewTarget(); break; default: reportUnexpectedCharacterError( current ); break loop; } break; case 'p': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'v') { reportCharacterExpectedError( 'v', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'p') { reportCharacterExpectedError( 'p', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'R') { reportCharacterExpectedError( 'R', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); parsePreserveAspectRatio(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); break; case 't': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } fragmentIdentifierHandler.startTransformList(); tloop: for (;;) { try { current = reader.read(); switch (current) { case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; default: break tloop; } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } fragmentIdentifierHandler.endTransformList(); break; case 'z': first = false; current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break loop; } current = reader.read(); if (current != 'P') { reportCharacterExpectedError( 'P', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); switch (current) { case 'm': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'y') { reportCharacterExpectedError( 'y', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(true); break; case 'd': current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'b') { reportCharacterExpectedError( 'b', current ); break loop; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(false); break; default: reportUnexpectedCharacterError( current ); break loop; } if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseIdentifier() throws ParseException, IOException { for (;;) { if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { break; } bufferize(); current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipSpaces() throws IOException { if (current == ',') { current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipCommaSpaces() throws IOException { if (current == ',') { current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall-through case 'Y': break; default: reportCharacterExpectedError( 'X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } if (skewX) { fragmentIdentifierHandler.skewX(sk); } else { fragmentIdentifierHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipTransform() throws IOException { loop: for (;;) { current = reader.read(); switch (current) { case ')': break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { fragmentIdentifierHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); fragmentIdentifierHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMaxYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMidYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMinYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipIdentifier(); break; } fragmentIdentifierHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } fragmentIdentifierHandler.slice(); current = reader.read(); } fragmentIdentifierHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipIdentifier() throws IOException { loop: for (;;) { current = reader.read(); switch(current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); case -1: break loop; } } }
// in sources/org/apache/batik/parser/LengthPairListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler) lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipSpaces(); if (current == -1) { break; } if (current != ';') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler) lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/ClockParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); float clockValue = parseOffset ? parseOffset() : parseClockValue(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } if (clockHandler != null) { clockHandler.clockValue(clockValue); } }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); skipSpaces(); parsePreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { preserveAspectRatioHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); preserveAspectRatioHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMaxYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMidYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMinYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't',current ); skipIdentifier(); break; } preserveAspectRatioHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } preserveAspectRatioHandler.slice(); current = reader.read(); break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } preserveAspectRatioHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void skipIdentifier() throws IOException { loop: for (;;) { current = reader.read(); switch(current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/AngleParser.java
protected void doParse() throws ParseException, IOException { angleHandler.startAngle(); current = reader.read(); skipSpaces(); try { float f = parseFloat(); angleHandler.angleValue(f); s: if (current != -1) { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: break s; } switch (current) { case 'd': current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); break; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError('g', current ); break; } angleHandler.deg(); current = reader.read(); break; case 'g': current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); break; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.grad(); current = reader.read(); break; case 'r': current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.rad(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } angleHandler.endAngle(); }
// in sources/org/apache/batik/parser/AbstractScanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { char[] t = new char[ 1 + position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseTimingSpecifier() throws ParseException, IOException { skipSpaces(); boolean escaped = false; if (current == '\\') { escaped = true; current = reader.read(); } Object[] ret = null; if (current == '+' || (current == '-' && !escaped) || (current >= '0' && current <= '9')) { float offset = parseOffset(); ret = new Object[] { new Integer(TIME_OFFSET), new Float(offset) }; } else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { ret = parseIDValue(escaped); } else { reportUnexpectedCharacterError( current ); } return ret; }
// in sources/org/apache/batik/parser/TimingParser.java
protected String parseName() throws ParseException, IOException { StringBuffer sb = new StringBuffer(); boolean midEscaped = false; do { sb.append((char) current); current = reader.read(); midEscaped = false; if (current == '\\') { midEscaped = true; current = reader.read(); } } while (XMLUtilities.isXMLNameCharacter((char) current) && (midEscaped || (current != '-' && current != '.'))); return sb.toString(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseIDValue(boolean escaped) throws ParseException, IOException { String id = parseName(); if ((id.equals("accessKey") && useSVG11AccessKeys || id.equals("accesskey")) && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); if (current == -1) { reportError("end.of.stream", new Object[0]); } char key = (char) current; current = reader.read(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY), new Float(offset), new Character(key) }; } else if (id.equals("accessKey") && useSVG12AccessKeys && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); StringBuffer keyName = new StringBuffer(); while (current >= 'A' && current <= 'Z' || current >= 'a' && current <= 'z' || current >= '0' && current <= '9' || current == '+') { keyName.append((char) current); current = reader.read(); } if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY_SVG12), new Float(offset), keyName.toString() }; } else if (id.equals("wallclock") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); Calendar wallclockValue = parseWallclockValue(); skipSpaces(); if (current != ')') { reportError("character.unexpected", new Object[] { new Integer(current) }); } current = reader.read(); return new Object[] { new Integer(TIME_WALLCLOCK), wallclockValue }; } else if (id.equals("indefinite") && !escaped) { return new Object[] { new Integer(TIME_INDEFINITE) }; } else { if (current == '.') { current = reader.read(); if (current == '\\') { escaped = true; current = reader.read(); } if (!XMLUtilities.isXMLNameFirstCharacter((char) current)) { reportUnexpectedCharacterError( current ); } String id2 = parseName(); if ((id2.equals("begin") || id2.equals("end")) && !escaped) { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_SYNCBASE), new Float(offset), id, id2 }; } else if (id2.equals("repeat") && !escaped) { Integer repeatIteration = null; if (current == '(') { current = reader.read(); repeatIteration = new Integer(parseDigits()); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); } skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_REPEAT), new Float(offset), id, repeatIteration }; } else if (id2.equals("marker") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } String markerName = parseName(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); return new Object[] { new Integer(TIME_MEDIA_MARKER), id, markerName }; } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), id, id2 }; } } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), null, id }; } } }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseClockValue() throws ParseException, IOException { int d1 = parseDigits(); float offset; if (current == ':') { current = reader.read(); int d2 = parseDigits(); if (current == ':') { current = reader.read(); int d3 = parseDigits(); offset = d1 * 3600 + d2 * 60 + d3; } else { offset = d1 * 60 + d2; } if (current == '.') { current = reader.read(); offset += parseFraction(); } } else if (current == '.') { current = reader.read(); offset = (parseFraction() + d1) * parseUnit(); } else { offset = d1 * parseUnit(); } return offset; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseOffset() throws ParseException, IOException { boolean offsetNegative = false; if (current == '-') { offsetNegative = true; current = reader.read(); skipSpaces(); } else if (current == '+') { current = reader.read(); skipSpaces(); } if (offsetNegative) { return -parseClockValue(); } return parseClockValue(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected int parseDigits() throws ParseException, IOException { int value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } do { value = value * 10 + (current - '0'); current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseFraction() throws ParseException, IOException { float value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } float weight = 0.1f; do { value += weight * (current - '0'); weight *= 0.1f; current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseUnit() throws ParseException, IOException { if (current == 'h') { current = reader.read(); return 3600; } else if (current == 'm') { current = reader.read(); if (current == 'i') { current = reader.read(); if (current != 'n') { reportUnexpectedCharacterError( current ); } current = reader.read(); return 60; } else if (current == 's') { current = reader.read(); return 0.001f; } else { reportUnexpectedCharacterError( current ); } } else if (current == 's') { current = reader.read(); } return 1; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Calendar parseWallclockValue() throws ParseException, IOException { int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0, tzh = 0, tzm = 0; float frac = 0; boolean dateSpecified = false; boolean timeSpecified = false; boolean tzSpecified = false; boolean tzNegative = false; String tzn = null; int digits1 = parseDigits(); do { if (current == '-') { dateSpecified = true; y = digits1; current = reader.read(); M = parseDigits(); if (current != '-') { reportUnexpectedCharacterError( current ); } current = reader.read(); d = parseDigits(); if (current != 'T') { break; } current = reader.read(); digits1 = parseDigits(); if (current != ':') { reportUnexpectedCharacterError( current ); } } if (current == ':') { timeSpecified = true; h = digits1; current = reader.read(); m = parseDigits(); if (current == ':') { current = reader.read(); s = parseDigits(); if (current == '.') { current = reader.read(); frac = parseFraction(); } } if (current == 'Z') { tzSpecified = true; tzn = "UTC"; current = reader.read(); } else if (current == '+' || current == '-') { StringBuffer tznb = new StringBuffer(); tzSpecified = true; if (current == '-') { tzNegative = true; tznb.append('-'); } else { tznb.append('+'); } current = reader.read(); tzh = parseDigits(); if (tzh < 10) { tznb.append('0'); } tznb.append(tzh); if (current != ':') { reportUnexpectedCharacterError( current ); } tznb.append(':'); current = reader.read(); tzm = parseDigits(); if (tzm < 10) { tznb.append('0'); } tznb.append(tzm); tzn = tznb.toString(); } } } while (false); if (!dateSpecified && !timeSpecified) { reportUnexpectedCharacterError( current ); } Calendar wallclockTime; if (tzSpecified) { int offset = (tzNegative ? -1 : 1) * (tzh * 3600000 + tzm * 60000); wallclockTime = Calendar.getInstance(new SimpleTimeZone(offset, tzn)); } else { wallclockTime = Calendar.getInstance(); } if (dateSpecified && timeSpecified) { wallclockTime.set(y, M, d, h, m, s); } else if (dateSpecified) { wallclockTime.set(y, M, d, 0, 0, 0); } else { wallclockTime.set(Calendar.HOUR, h); wallclockTime.set(Calendar.MINUTE, m); wallclockTime.set(Calendar.SECOND, s); } if (frac == 0.0f) { wallclockTime.set(Calendar.MILLISECOND, (int) (frac * 1000)); } else { wallclockTime.set(Calendar.MILLISECOND, 0); } return wallclockTime; }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void doParse() throws ParseException, IOException { pathHandler.startPath(); current = reader.read(); loop: for (;;) { try { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break; case 'z': case 'Z': current = reader.read(); pathHandler.closePath(); break; case 'm': parsem(); break; case 'M': parseM(); break; case 'l': parsel(); break; case 'L': parseL(); break; case 'h': parseh(); break; case 'H': parseH(); break; case 'v': parsev(); break; case 'V': parseV(); break; case 'c': parsec(); break; case 'C': parseC(); break; case 'q': parseq(); break; case 'Q': parseQ(); break; case 's': parses(); break; case 'S': parseS(); break; case 't': parset(); break; case 'T': parseT(); break; case 'a': parsea(); break; case 'A': parseA(); break; case -1: break loop; default: reportUnexpected(current); break; } } catch (ParseException e) { errorHandler.error(e); skipSubPath(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } pathHandler.endPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsem() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoRel(x, y); boolean expectNumber = skipCommaSpaces2(); _parsel(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseM() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoAbs(x, y); boolean expectNumber = skipCommaSpaces2(); _parseL(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsel() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parsel(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parsel(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseL() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parseL(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parseL(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseh() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseH() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsev() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseV() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsec() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicRel(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseC() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicAbs(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseq() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticRel(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseQ() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticAbs(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parses() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothRel(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseS() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothAbs(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parset() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseT() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsea() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcRel(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseA() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcAbs(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void skipSubPath() throws ParseException, IOException { for (;;) { switch (current) { case -1: case 'm': case 'M': return; default: break; } current = reader.read(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void reportUnexpected(int ch) throws ParseException, IOException { reportUnexpectedCharacterError( current ); skipSubPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected boolean skipCommaSpaces2() throws IOException { wsp1: for (;;) { switch (current) { default: break wsp1; case 0x20: case 0x9: case 0xD: case 0xA: break; } current = reader.read(); } if (current != ',') return false; // no comma. wsp2: for (;;) { switch (current = reader.read()) { default: break wsp2; case 0x20: case 0x9: case 0xD: case 0xA: break; } } return true; // had comma }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void doParse() throws ParseException, IOException { transformListHandler.startTransformList(); loop: for (;;) { try { current = reader.read(); switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; case -1: break loop; default: reportUnexpectedCharacterError( current ); skipTransform(); } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } transformListHandler.endTransformList(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError('i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError('x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError('o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError('n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError('s', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError('w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall through case 'Y': break; default: reportCharacterExpectedError('X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } if (skewX) { transformListHandler.skewX(sk); } else { transformListHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void skipTransform() throws IOException { loop: for (;;) { current = reader.read(); switch (current) { case ')': break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/TimingSpecifierParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); Object[] spec = parseTimingSpecifier(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } handleTimingSpecifier(spec); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
public void setFile(File wmffile) throws IOException { stream = new DataInputStream(new BufferedInputStream(new FileInputStream(wmffile))); read(stream); stream.close(); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
protected boolean readRecords(DataInputStream is) throws IOException { // effective reading of the rest of the file short functionId = 1; int recSize = 0; int gdiIndex; // the last Object index int brushObject = -1; // the last brush int penObject = -1; // the last pen int fontObject = -1; // the last font GdiObject gdiObj; while (functionId > 0) { recSize = readInt( is ); // Subtract size in 16-bit words of recSize and functionId; recSize -= 3; functionId = readShort( is ); if ( functionId <= 0 ) break; switch ( functionId ) { case WMFConstants.META_SETMAPMODE: { int mapmode = readShort( is ); // change isotropic if mode is anisotropic if (mapmode == WMFConstants.MM_ANISOTROPIC) isotropic = false; } break; case WMFConstants.META_SETWINDOWORG: { vpY = readShort( is ); vpX = readShort( is ); } break; case WMFConstants.META_SETWINDOWEXT: { vpH = readShort( is ); vpW = readShort( is ); if (! isotropic) scaleXY = (float)vpW / (float)vpH; vpW = (int)(vpW * scaleXY); } break; case WMFConstants.META_CREATEPENINDIRECT: { int objIndex = 0; int penStyle = readShort( is ); readInt( is ); // width // color definition int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; Color color = new Color( red, green, blue); if (recSize == 6) readShort(is); // if size greater than 5 if ( penStyle == WMFConstants.META_PS_NULL ) { objIndex = addObjectAt( NULL_PEN, color, objIndex ); } else { objIndex = addObjectAt( PEN, color, objIndex ); } } break; case WMFConstants.META_CREATEBRUSHINDIRECT: { int objIndex = 0; int brushStyle = readShort( is ); // color definition int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; Color color = new Color( red, green, blue); readShort( is ); // hatch if ( brushStyle == WMFConstants.META_PS_NULL ) { objIndex = addObjectAt( NULL_BRUSH, color, objIndex); } else objIndex = addObjectAt(BRUSH, color, objIndex ); } break; case WMFConstants.META_SETTEXTALIGN: int align = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); currentHorizAlign = WMFUtilities.getHorizontalAlignment(align); currentVertAlign = WMFUtilities.getVerticalAlignment(align); break; case WMFConstants.META_EXTTEXTOUT: { int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); int lenText = readShort( is ); int flag = readShort( is ); int read = 4; // used to track the actual size really read boolean clipped = false; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; int len; // determination of clipping property if ((flag & WMFConstants.ETO_CLIPPED) != 0) { x1 = (int)(readShort( is ) * scaleXY); y1 = readShort( is ); x2 = (int)(readShort( is ) * scaleXY); y2 = readShort( is ); read += 4; clipped = true; } byte[] bstr = new byte[ lenText ]; int i = 0; for ( ; i < lenText; i++ ) { bstr[ i ] = is.readByte(); } String sr = WMFUtilities.decodeString(wf, bstr); read += (lenText + 1)/2; /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (lenText % 2 != 0) is.readByte(); // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); TextLayout layout = new TextLayout( sr, wf.font, fontCtx ); int lfWidth = (int)layout.getBounds().getWidth(); x = (int)layout.getBounds().getX(); int lfHeight = (int)getVerticalAlignmentValue(layout, currentVertAlign); resizeBounds(x, y); resizeBounds(x+lfWidth, y+lfHeight); firstEffectivePaint = false; } break; case WMFConstants.META_DRAWTEXT: case WMFConstants.META_TEXTOUT: { int len = readShort( is ); int read = 1; // used to track the actual size really read byte[] bstr = new byte[ len ]; for ( int i = 0; i < len; i++ ) { bstr[ i ] = is.readByte(); } String sr = WMFUtilities.decodeString(wf, bstr); /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (len % 2 != 0) is.readByte(); read += (len + 1) / 2; int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); read += 2; // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); TextLayout layout = new TextLayout( sr, wf.font, fontCtx ); int lfWidth = (int)layout.getBounds().getWidth(); x = (int)layout.getBounds().getX(); int lfHeight = (int)getVerticalAlignmentValue(layout, currentVertAlign); resizeBounds(x, y); resizeBounds(x+lfWidth, y+lfHeight); } break; case WMFConstants.META_CREATEFONTINDIRECT: { int lfHeight = readShort( is ); float size = (int)(scaleY * lfHeight); int lfWidth = readShort( is ); int escape = (int)readShort( is ); int orient = (int)readShort( is ); int weight = (int)readShort( is ); int italic = (int)is.readByte(); int underline = (int)is.readByte(); int strikeOut = (int)is.readByte(); int charset = (int)(is.readByte() & 0x00ff); int lfOutPrecision = is.readByte(); int lfClipPrecision = is.readByte(); int lfQuality = is.readByte(); int lfPitchAndFamily = is.readByte(); int style = italic > 0 ? Font.ITALIC : Font.PLAIN; style |= (weight > 400) ? Font.BOLD : Font.PLAIN; // don't need to read the end of the record, // because it will always be completely used int len = (2*(recSize-9)); byte[] lfFaceName = new byte[ len ]; byte ch; for ( int i = 0; i < len; i++ ) lfFaceName[ i ] = is.readByte(); String face = new String( lfFaceName ); // FIXED : management of font names int d = 0; while ((d < face.length()) && ((Character.isLetterOrDigit(face.charAt(d))) || (Character.isWhitespace(face.charAt(d))))) d++; if (d > 0) face = face.substring(0,d); else face = "System"; if ( size < 0 ) size = -size /* * -1.3 */; int objIndex = 0; Font f = new Font(face, style, (int)size); f = f.deriveFont(size); WMFFont wf = new WMFFont(f, charset, underline, strikeOut, italic, weight, orient, escape); objIndex = addObjectAt( FONT, wf , objIndex ); } break; case WMFConstants.META_CREATEREGION: { int objIndex = 0; for ( int j = 0; j < recSize; j++ ) readShort(is); // read all fields objIndex = addObjectAt( PALETTE, INTEGER_0, 0 ); } break; case WMFConstants.META_CREATEPALETTE: { int objIndex = 0; for ( int j = 0; j < recSize; j++ ) readShort(is); // read all fields objIndex = addObjectAt( OBJ_REGION, INTEGER_0, 0 ); } break; case WMFConstants.META_SELECTOBJECT: gdiIndex = readShort(is); if (( gdiIndex & 0x80000000 ) != 0 ) // Stock Object break; gdiObj = getObject( gdiIndex ); if ( !gdiObj.used ) break; switch( gdiObj.type ) { case PEN: penObject = gdiIndex; break; case BRUSH: brushObject = gdiIndex; break; case FONT: { this.wf = ((WMFFont)gdiObj.obj); fontObject = gdiIndex; } break; case NULL_PEN: penObject = -1; break; case NULL_BRUSH: brushObject = -1; break; } break; case WMFConstants.META_DELETEOBJECT: gdiIndex = readShort(is); gdiObj = getObject( gdiIndex ); if ( gdiIndex == brushObject ) brushObject = -1; else if ( gdiIndex == penObject ) penObject = -1; else if ( gdiIndex == fontObject ) fontObject = -1; gdiObj.clear(); break; case WMFConstants.META_LINETO: { int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); if (penObject >= 0) { resizeBounds(startX, startY); resizeBounds(x, y); firstEffectivePaint = false; } startX = x; startY = y; } break; case WMFConstants.META_MOVETO: { startY = readShort( is ); startX = (int)(readShort( is ) * scaleXY); } break; case WMFConstants.META_POLYPOLYGON: { int count = readShort( is ); int[] pts = new int[ count ]; int ptCount = 0; for ( int i = 0; i < count; i++ ) { pts[ i ] = readShort( is ); ptCount += pts[ i ]; } int offset = count+1; for ( int i = 0; i < count; i++ ) { for ( int j = 0; j < pts[ i ]; j++ ) { // FIXED 115 : correction preliminary images dimensions int x = (int)(readShort( is ) * scaleXY); int y = readShort( is ); if ((brushObject >= 0) || (penObject >= 0)) resizeBounds(x, y); } } firstEffectivePaint = false; } break; case WMFConstants.META_POLYGON: { int count = readShort( is ); float[] _xpts = new float[ count+1 ]; float[] _ypts = new float[ count+1 ]; for ( int i = 0; i < count; i++ ) { _xpts[i] = readShort( is ) * scaleXY; _ypts[i] = readShort( is ); } _xpts[count] = _xpts[0]; _ypts[count] = _ypts[0]; Polygon2D pol = new Polygon2D(_xpts, _ypts, count); paint(brushObject, penObject, pol); } break; case WMFConstants.META_POLYLINE: { int count = readShort( is ); float[] _xpts = new float[ count ]; float[] _ypts = new float[ count ]; for ( int i = 0; i < count; i++ ) { _xpts[i] = readShort( is ) * scaleXY; _ypts[i] = readShort( is ); } Polyline2D pol = new Polyline2D(_xpts, _ypts, count); paintWithPen(penObject, pol); } break; case WMFConstants.META_ELLIPSE: case WMFConstants.META_INTERSECTCLIPRECT: case WMFConstants.META_RECTANGLE: { int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_ROUNDRECT: { readShort( is ); readShort( is ); int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_ARC: case WMFConstants.META_CHORD: case WMFConstants.META_PIE: { readShort( is ); readShort( is ); readShort( is ); readShort( is ); int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_PATBLT : { readInt( is ); // rop int height = readShort( is ); int width = (int)(readShort( is ) * scaleXY); int left = (int)(readShort( is ) * scaleXY); int top = readShort( is ); if (penObject >= 0) resizeBounds(left, top); if (penObject >= 0) resizeBounds(left+width, top+height); } break; // UPDATED : META_DIBSTRETCHBLT added case WMFConstants.META_DIBSTRETCHBLT: { is.readInt(); // mode readShort( is ); // heightSrc readShort( is ); // widthSrc readShort( is ); // sy readShort( is ); // sx float heightDst = (float)readShort( is ); float widthDst = (float)readShort( is ) * scaleXY; float dy = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH; float dx = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH * scaleXY; widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH; heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst)); int len = 2*recSize - 20; for (int i = 0; i < len; i++) is.readByte(); } break; case WMFConstants.META_STRETCHDIB: { is.readInt(); // mode readShort( is ); // usage readShort( is ); // heightSrc readShort( is ); // widthSrc readShort( is ); // sy readShort( is ); // sx float heightDst = (float)readShort( is ); float widthDst = (float)readShort( is ) * scaleXY; float dy = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH; float dx = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH * scaleXY; widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH; heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst)); int len = 2*recSize - 22; byte bitmap[] = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); } break; case WMFConstants.META_DIBBITBLT: { is.readInt(); // mode readShort( is ); //sy readShort( is ); //sx readShort( is ); // hdc float height = readShort( is ) * (float)inch / PIXEL_PER_INCH * getVpHFactor(); float width = readShort( is ) * (float)inch / PIXEL_PER_INCH * getVpWFactor() * scaleXY; float dy = (float)inch / PIXEL_PER_INCH * getVpHFactor() * readShort( is ); float dx = (float)inch / PIXEL_PER_INCH * getVpWFactor() * readShort( is ) * scaleXY; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + width), (int)(dy + height)); } break; default: for ( int j = 0; j < recSize; j++ ) readShort(is); break; } } // sets the width, height, etc of the image if the file does not have an APM (in this case it is retrieved // from the viewport) if (! isAldus) { width = vpW; height = vpH; right = vpX; left = vpX + vpW; top = vpY; bottom = vpY + vpH; } resetBounds(); return true; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java
protected boolean readRecords( DataInputStream is ) throws IOException { short functionId = 1; int recSize = 0; short recData; numRecords = 0; while ( functionId > 0) { recSize = readInt( is ); // Subtract size in 16-bit words of recSize and functionId; recSize -= 3; functionId = readShort( is ); if ( functionId <= 0 ) break; MetaRecord mr = new MetaRecord(); switch ( functionId ) { case WMFConstants.META_SETMAPMODE: { mr.numPoints = recSize; mr.functionId = functionId; int mapmode = readShort( is ); if (mapmode == WMFConstants.MM_ANISOTROPIC) isotropic = false; mr.addElement(mapmode); records.add( mr ); } break; case WMFConstants.META_DRAWTEXT: { for ( int i = 0; i < recSize; i++ ) recData = readShort( is ); // todo shouldn't the read data be used for something?? numRecords--; } break; case WMFConstants.META_EXTTEXTOUT: { int yVal = readShort( is ) * ySign; int xVal = (int) (readShort( is ) * xSign * scaleXY); int lenText = readShort( is ); int flag = readShort( is ); int read = 4; // used to track the actual size really read boolean clipped = false; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; int len; // determination of clipping property if ((flag & WMFConstants.ETO_CLIPPED) != 0) { x1 = (int) (readShort( is ) * xSign * scaleXY); y1 = readShort( is ) * ySign; x2 = (int) (readShort( is ) * xSign * scaleXY); y2 = readShort( is ) * ySign; read += 4; clipped = true; } byte[] bstr = new byte[ lenText ]; int i = 0; for ( ; i < lenText; i++ ) { bstr[ i ] = is.readByte(); } read += (lenText + 1)/2; /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (lenText % 2 != 0) is.readByte(); // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); /* get the StringRecord, having decoded the String, using the current * charset (which was given by the last META_CREATEFONTINDIRECT) */ mr = new MetaRecord.ByteRecord(bstr); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( xVal ); mr.addElement( yVal ); mr.addElement( flag ); if (clipped) { mr.addElement( x1 ); mr.addElement( y1 ); mr.addElement( x2 ); mr.addElement( y2 ); } records.add( mr ); } break; case WMFConstants.META_TEXTOUT: { int len = readShort( is ); int read = 1; // used to track the actual size really read byte[] bstr = new byte[ len ]; for ( int i = 0; i < len; i++ ) { bstr[ i ] = is.readByte(); } /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (len % 2 != 0) is.readByte(); read += (len + 1) / 2; int yVal = readShort( is ) * ySign; int xVal = (int) (readShort( is ) * xSign * scaleXY); read += 2; // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); /* get the StringRecord, having decoded the String, using the current * charset (which was givben by the last META_CREATEFONTINDIRECT) */ mr = new MetaRecord.ByteRecord(bstr); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( xVal ); mr.addElement( yVal ); records.add( mr ); } break; case WMFConstants.META_CREATEFONTINDIRECT: { int lfHeight = readShort( is ); int lfWidth = readShort( is ); int lfEscapement = readShort( is ); int lfOrientation = readShort( is ); int lfWeight = readShort( is ); int lfItalic = is.readByte(); int lfUnderline = is.readByte(); int lfStrikeOut = is.readByte(); int lfCharSet = is.readByte() & 0x00ff; //System.out.println("lfCharSet: "+(lfCharSet & 0x00ff)); int lfOutPrecision = is.readByte(); int lfClipPrecision = is.readByte(); int lfQuality = is.readByte(); int lfPitchAndFamily = is.readByte(); // don't need to read the end of the record, // because it will always be completely used int len = (2*(recSize-9)); byte[] lfFaceName = new byte[ len ]; byte ch; for ( int i = 0; i < len; i++ ) lfFaceName[ i ] = is.readByte(); String str = new String( lfFaceName ); // what locale ?? ascii ?? platform ?? mr = new MetaRecord.StringRecord( str ); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( lfHeight ); mr.addElement( lfItalic ); mr.addElement( lfWeight ); mr.addElement( lfCharSet ); mr.addElement( lfUnderline ); mr.addElement( lfStrikeOut ); mr.addElement( lfOrientation ); // escapement is the orientation of the text in tenth of degrees mr.addElement( lfEscapement ); records.add( mr ); } break; case WMFConstants.META_SETVIEWPORTORG: case WMFConstants.META_SETVIEWPORTEXT: case WMFConstants.META_SETWINDOWORG: case WMFConstants.META_SETWINDOWEXT: { mr.numPoints = recSize; mr.functionId = functionId; int height = readShort( is ); int width = readShort( is ); // inverse the values signs if they are negative if (width < 0) { width = -width; xSign = -1; } if (height < 0) { height = -height; ySign = -1; } mr.addElement((int)(width * scaleXY)); mr.addElement( height ); records.add( mr ); if (_bext && functionId == WMFConstants.META_SETWINDOWEXT) { vpW = width; vpH = height; if (! isotropic) scaleXY = (float)vpW / (float)vpH; vpW = (int)(vpW * scaleXY); _bext = false; } // sets the width, height of the image if the file does not have an APM (in this case it is retrieved // from the viewport) if (! isAldus) { this.width = vpW; this.height = vpH; } } break; case WMFConstants.META_OFFSETVIEWPORTORG: case WMFConstants.META_OFFSETWINDOWORG: { mr.numPoints = recSize; mr.functionId = functionId; int y = readShort( is ) * ySign; int x = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( x ); mr.addElement( y ); records.add( mr ); } break; case WMFConstants.META_SCALEVIEWPORTEXT: case WMFConstants.META_SCALEWINDOWEXT: { mr.numPoints = recSize; mr.functionId = functionId; int ydenom = readShort( is ); int ynum = readShort( is ); int xdenom= readShort( is ); int xnum = readShort( is ); mr.addElement( xdenom ); mr.addElement( ydenom ); mr.addElement( xnum ); mr.addElement( ynum ); records.add( mr ); scaleX = scaleX * (float)xdenom / (float)xnum; scaleY = scaleY * (float)ydenom / (float)ynum; } break; case WMFConstants.META_CREATEBRUSHINDIRECT: { mr.numPoints = recSize; mr.functionId = functionId; // The style mr.addElement( readShort( is )); int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); // The hatch style mr.addElement( readShort( is ) ); records.add( mr ); } break; case WMFConstants.META_CREATEPENINDIRECT: { mr.numPoints = recSize; mr.functionId = functionId; // The style mr.addElement( readShort( is ) ); int width = readInt( is ); int colorref = readInt( is ); /** * sometimes records generated by PPT have a * recSize of 6 and not 5 => in this case only we have * to read a last short element **/ //int height = readShort( is ); if (recSize == 6) readShort(is); int red = colorref & 0xff; // format: fff.bbbbbbbb.gggggggg.rrrrrrrr int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); // The pen width mr.addElement( width ); records.add( mr ); } break; case WMFConstants.META_SETTEXTALIGN: { mr.numPoints = recSize; mr.functionId = functionId; int align = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); mr.addElement( align ); records.add( mr ); } break; case WMFConstants.META_SETTEXTCOLOR: case WMFConstants.META_SETBKCOLOR: { mr.numPoints = recSize; mr.functionId = functionId; int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); records.add( mr ); } break; case WMFConstants.META_LINETO: case WMFConstants.META_MOVETO: { mr.numPoints = recSize; mr.functionId = functionId; int y = readShort( is ) * ySign; int x = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( x ); mr.addElement( y ); records.add( mr ); } break; case WMFConstants.META_SETPOLYFILLMODE : { mr.numPoints = recSize; mr.functionId = functionId; int mode = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); mr.addElement( mode ); records.add( mr ); } break; case WMFConstants.META_POLYPOLYGON: { mr.numPoints = recSize; mr.functionId = functionId; int count = readShort( is ); // number of polygons int[] pts = new int[ count ]; int ptCount = 0; for ( int i = 0; i < count; i++ ) { pts[ i ] = readShort( is ); // number of points for the polygon ptCount += pts[ i ]; } mr.addElement( count ); for ( int i = 0; i < count; i++ ) mr.addElement( pts[ i ] ); int offset = count+1; for ( int i = 0; i < count; i++ ) { int nPoints = pts[ i ]; for ( int j = 0; j < nPoints; j++ ) { mr.addElement((int)(readShort( is ) * xSign * scaleXY)); // x position of the polygon mr.addElement( readShort( is ) * ySign ); // y position of the polygon } } records.add( mr ); } break; case WMFConstants.META_POLYLINE: case WMFConstants.META_POLYGON: { mr.numPoints = recSize; mr.functionId = functionId; int count = readShort( is ); mr.addElement( count ); for ( int i = 0; i < count; i++ ) { mr.addElement((int)(readShort( is ) * xSign * scaleXY)); mr.addElement( readShort( is ) * ySign ); } records.add( mr ); } break; case WMFConstants.META_ELLIPSE: case WMFConstants.META_INTERSECTCLIPRECT: case WMFConstants.META_RECTANGLE: { mr.numPoints = recSize; mr.functionId = functionId; int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); records.add( mr ); } break; case WMFConstants.META_CREATEREGION: { mr.numPoints = recSize; mr.functionId = functionId; int left = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); records.add( mr ); } break; case WMFConstants.META_ROUNDRECT: { mr.numPoints = recSize; mr.functionId = functionId; int el_height = readShort( is ) * ySign; int el_width = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); mr.addElement( el_width ); mr.addElement( el_height ); records.add( mr ); } break; case WMFConstants.META_ARC: case WMFConstants.META_PIE: { mr.numPoints = recSize; mr.functionId = functionId; int yend = readShort( is ) * ySign; int xend = (int)(readShort( is ) * xSign * scaleXY); int ystart = readShort( is ) * ySign; int xstart = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); mr.addElement( xstart ); mr.addElement( ystart ); mr.addElement( xend ); mr.addElement( yend ); records.add( mr ); } break; // META_PATBLT added case WMFConstants.META_PATBLT : { mr.numPoints = recSize; mr.functionId = functionId; int rop = readInt( is ); int height = readShort( is ) * ySign; int width = (int)(readShort( is ) * xSign * scaleXY); int left = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; mr.addElement( rop ); mr.addElement( height ); mr.addElement( width ); mr.addElement( top ); mr.addElement( left ); records.add( mr ); } break; case WMFConstants.META_SETBKMODE: { mr.numPoints = recSize; mr.functionId = functionId; int mode = readShort( is ); mr.addElement( mode ); //if (recSize > 1) readShort( is ); if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); records.add( mr ); } break; // UPDATED : META_SETROP2 added case WMFConstants.META_SETROP2: { mr.numPoints = recSize; mr.functionId = functionId; // rop should always be a short, but it is sometimes an int... int rop; if (recSize == 1) rop = readShort( is ); else rop = readInt( is ); mr.addElement( rop ); records.add( mr ); } break; // UPDATED : META_DIBSTRETCHBLT added case WMFConstants.META_DIBSTRETCHBLT: { int mode = is.readInt() & 0xff; int heightSrc = readShort( is ) * ySign; int widthSrc = readShort( is ) * xSign; int sy = readShort( is ) * ySign; int sx = readShort( is ) * xSign; int heightDst = readShort( is ) * ySign; int widthDst = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ) * ySign; int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 20; byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( mode ); mr.addElement( heightSrc ); mr.addElement( widthSrc ); mr.addElement( sy ); mr.addElement( sx ); mr.addElement( heightDst ); mr.addElement( widthDst ); mr.addElement( dy ); mr.addElement( dx ); records.add( mr ); } break; case WMFConstants.META_STRETCHDIB: { int mode = is.readInt() & 0xff; int usage = readShort( is ); int heightSrc = readShort( is ) * ySign; int widthSrc = readShort( is ) * xSign; int sy = readShort( is ) * ySign; int sx = readShort( is ) * xSign; int heightDst = readShort( is ) * ySign; int widthDst = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ) * ySign; int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 22; byte bitmap[] = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement(mode); mr.addElement(heightSrc); mr.addElement(widthSrc); mr.addElement(sy); mr.addElement(sx); mr.addElement(heightDst); mr.addElement(widthDst); mr.addElement(dy); mr.addElement(dx); records.add( mr ); } break; // UPDATED : META_DIBBITBLT added case WMFConstants.META_DIBBITBLT: { int mode = is.readInt() & 0xff; int sy = readShort( is ); int sx = readShort( is ); int hdc = readShort( is ); int height = readShort( is ); int width = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ); int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 18; if (len > 0) { byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; } else { // what does this mean?? len <= 0 ?? mr.numPoints = recSize; mr.functionId = functionId; for (int i = 0; i < len; i++) is.readByte(); } mr.addElement( mode ); mr.addElement( height ); mr.addElement( width ); mr.addElement( sy ); mr.addElement( sx ); mr.addElement( dy ); mr.addElement( dx ); records.add( mr ); } break; // UPDATED : META_CREATEPATTERNBRUSH added case WMFConstants.META_DIBCREATEPATTERNBRUSH: { int type = is.readInt() & 0xff; int len = 2*recSize - 4; byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( type ); records.add( mr ); } break; default: mr.numPoints = recSize; mr.functionId = functionId; for ( int j = 0; j < recSize; j++ ) mr.addElement( readShort( is ) ); records.add( mr ); break; } numRecords++; } // sets the characteristics of the image if the file does not have an APM (in this case it is retrieved // from the viewport). This is only useful if one wants to retrieve informations about the file after // decoding it. if (! isAldus) { right = (int)vpX; left = (int)(vpX + vpW); top = (int)vpY; bottom = (int)(vpY + vpH); } setReading( false ); return true; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
protected short readShort(DataInputStream is) throws IOException { byte js[] = new byte[ 2 ]; is.readFully(js); int iTemp = ((0xff) & js[ 1 ] ) << 8; short i = (short)(0xffff & iTemp); i |= ((0xff) & js[ 0 ] ); return i; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
protected int readInt( DataInputStream is) throws IOException { byte js[] = new byte[ 4 ]; is.readFully(js); int i = ((0xff) & js[ 3 ] ) << 24; i |= ((0xff) & js[ 2 ] ) << 16; i |= ((0xff) & js[ 1 ] ) << 8; i |= ((0xff) & js[ 0 ] ); return i; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
public void read(DataInputStream is) throws IOException { reset(); setReading( true ); int dwIsAldus = readInt( is ); if ( dwIsAldus == WMFConstants.META_ALDUS_APM ) { // Read the aldus placeable header. int key = dwIsAldus; isAldus = true; readShort( is ); // metafile handle, always zero left = readShort( is ); top = readShort( is ); right = readShort( is ); bottom = readShort( is ); inch = readShort( is ); int reserved = readInt( is ); short checksum = readShort( is ); // inverse values if left > right or top > bottom if (left > right) { int _i = right; right = left; left = _i; xSign = -1; } if (top > bottom) { int _i = bottom; bottom = top; top = _i; ySign = -1; } width = right - left; height = bottom - top; // read the beginning of the header mtType = readShort( is ); mtHeaderSize = readShort( is ); } else { // read the beginning of the header, the first int corresponds to the first two parameters mtType = ((dwIsAldus << 16) >> 16); mtHeaderSize = dwIsAldus >> 16; } mtVersion = readShort( is ); mtSize = readInt( is ); mtNoObjects = readShort( is ); mtMaxRecord = readInt( is ); mtNoParameters = readShort( is ); numObjects = mtNoObjects; List tempList = new ArrayList( numObjects ); for ( int i = 0; i < numObjects; i++ ) { tempList.add( new GdiObject( i, false )); } objectVector.addAll( tempList ); boolean ret = readRecords(is); is.close(); if (!ret) throw new IOException("Unhandled exception while reading records"); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/RecordStore.java
public boolean read( DataInputStream is ) throws IOException{ setReading( true ); reset(); int functionId = 0; numRecords = 0; numObjects = is.readShort(); objectVector.ensureCapacity( numObjects ); for ( int i = 0; i < numObjects; i++ ) { objectVector.add( new GdiObject( i, false )); } while ( functionId != -1 ) { functionId = is.readShort(); if ( functionId == -1 ){ break; } MetaRecord mr; switch ( functionId ) { case WMFConstants.META_TEXTOUT: case WMFConstants.META_DRAWTEXT: case WMFConstants.META_EXTTEXTOUT: case WMFConstants.META_CREATEFONTINDIRECT:{ short len = is.readShort(); byte[] b = new byte[ len ]; for ( int i = 0; i < len; i++ ) { b[ i ] = is.readByte(); } String str = new String( b ); mr = new MetaRecord.StringRecord( str ); } break; default: mr = new MetaRecord(); break; } int numPts = is.readShort(); mr.numPoints = numPts; mr.functionId = functionId; for ( int j = 0; j < numPts; j++ ){ mr.AddElement( new Integer( is.readShort())); } records.add( mr ); numRecords++; } setReading( false ); return true; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
public void print(Reader r, Writer w) throws TranscoderException, IOException { try { scanner = new XMLScanner(r); output = new OutputManager(this, w); writer = w; type = scanner.next(); printXMLDecl(); misc1: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc1; } } printDoctype(); misc2: for (;;) { scanner.clearBuffer(); switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc2; } } if (type != LexicalUnits.START_TAG) { throw fatalError("element", null); } printElement(); misc3: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc3; } } } catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacter(char c) throws IOException { if (c == 10) { printNewline(); } else { column++; writer.write(c); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printNewline() throws IOException { String nl = prettyPrinter.getNewline(); for (int i = 0; i < nl.length(); i++) { writer.write(nl.charAt(i)); } column = 0; line++; }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printString(String s) throws IOException { for (int i = 0; i < s.length(); i++) { printCharacter(s.charAt(i)); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacters(char[] ca) throws IOException { for (int i = 0; i < ca.length; i++) { printCharacter(ca[i]); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printSpaces(char[] text, boolean opt) throws IOException { if (prettyPrinter.getFormat()) { if (!opt) { printCharacter(' '); } } else { printCharacters(text); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printTopSpaces(char[] text) throws IOException { if (prettyPrinter.getFormat()) { int nl = newlines(text); for (int i = 0; i < nl; i++) { printNewline(); } } else { printCharacters(text); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printComment(char[] text) throws IOException { if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } printString("<!--"); if (column + text.length + 3 < prettyPrinter.getDocumentWidth()) { printCharacters(text); } else { formatText(text, margin.toString(), false); printCharacter(' '); } if (column + 3 > prettyPrinter.getDocumentWidth()) { printNewline(); printString(margin.toString()); } printString("-->"); } else { printString("<!--"); printCharacters(text); printString("-->"); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printXMLDecl(char[] space1, char[] space2, char[] space3, char[] version, char versionDelim, char[] space4, char[] space5, char[] space6, char[] encoding, char encodingDelim, char[] space7, char[] space8, char[] space9, char[] standalone, char standaloneDelim, char[] space10) throws IOException { printString("<?xml"); printSpaces(space1, false); printString("version"); if (space2 != null) { printSpaces(space2, true); } printCharacter('='); if (space3 != null) { printSpaces(space3, true); } printCharacter(versionDelim); printCharacters(version); printCharacter(versionDelim); if (space4 != null) { printSpaces(space4, false); if (encoding != null) { printString("encoding"); if (space5 != null) { printSpaces(space5, true); } printCharacter('='); if (space6 != null) { printSpaces(space6, true); } printCharacter(encodingDelim); printCharacters(encoding); printCharacter(encodingDelim); if (space7 != null) { printSpaces(space7, standalone == null); } } if (standalone != null) { printString("standalone"); if (space8 != null) { printSpaces(space8, true); } printCharacter('='); if (space9 != null) { printSpaces(space9, true); } printCharacter(standaloneDelim); printCharacters(standalone); printCharacter(standaloneDelim); if (space10 != null) { printSpaces(space10, true); } } } printString("?>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printPI(char[] target, char[] space, char[] data) throws IOException { if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } } printString("<?"); printCharacters(target); printSpaces(space, false); printCharacters(data); printString("?>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printDoctypeStart(char[] space1, char[] root, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException { if (prettyPrinter.getFormat()) { printString("<!DOCTYPE"); printCharacter(' '); printCharacters(root); if (space2 != null) { printCharacter(' '); printString(externalId); printCharacter(' '); printCharacter(string1Delim); printCharacters(string1); printCharacter(string1Delim); if (space4 != null) { if (string2 != null) { if (column + string2.length + 3 > prettyPrinter.getDocumentWidth()) { printNewline(); for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { printCharacter(' '); } } else { printCharacter(' '); } printCharacter(string2Delim); printCharacters(string2); printCharacter(string2Delim); printCharacter(' '); } } } } else { printString("<!DOCTYPE"); printSpaces(space1, false); printCharacters(root); if (space2 != null) { printSpaces(space2, false); printString(externalId); printSpaces(space3, false); printCharacter(string1Delim); printCharacters(string1); printCharacter(string1Delim); if (space4 != null) { printSpaces(space4, string2 == null); if (string2 != null) { printCharacter(string2Delim); printCharacters(string2); printCharacter(string2Delim); if (space5 != null) { printSpaces(space5, true); } } } } } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printDoctypeEnd(char[] space) throws IOException { if (space != null) { printSpaces(space, true); } printCharacter('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printParameterEntityReference(char[] name) throws IOException { printCharacter('%'); printCharacters(name); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printEntityReference(char[] name, boolean first) throws IOException { if ((prettyPrinter.getFormat()) && (xmlSpace.get(0) != Boolean.TRUE) && first) { printNewline(); printString(margin.toString()); } printCharacter('&'); printCharacters(name); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacterEntityReference (char[] code, boolean first, boolean preceedingSpace) throws IOException { if ((prettyPrinter.getFormat()) && (xmlSpace.get(0) != Boolean.TRUE)) { if (first) { printNewline(); printString(margin.toString()); } else if (preceedingSpace) { int endCol = column + code.length + 3; if (endCol > prettyPrinter.getDocumentWidth()){ printNewline(); printString(margin.toString()); } else { printCharacter(' '); } } } printString("&#"); printCharacters(code); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printElementStart(char[] name, List attributes, char[] space) throws IOException { xmlSpace.add(0, xmlSpace.get(0)); startingLines.add(0, new Integer(line)); if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } } printCharacter('<'); printCharacters(name); if (prettyPrinter.getFormat()) { Iterator it = attributes.iterator(); if (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } printCharacter(' '); printCharacters(ai.name); printCharacter('='); printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } while (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } int len = ai.name.length + ai.value.length() + 4; if (lineAttributes || len + column > prettyPrinter.getDocumentWidth()) { printNewline(); printString(margin.toString()); for (int i = 0; i < name.length + 2; i++) { printCharacter(' '); } } else { printCharacter(' '); } printCharacters(ai.name); printCharacter('='); printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } } else { Iterator it = attributes.iterator(); while (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } printSpaces(ai.space, false); printCharacters(ai.name); if (ai.space1 != null) { printSpaces(ai.space1, true); } printCharacter('='); if (ai.space2 != null) { printSpaces(ai.space2, true); } printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } } if (space != null) { printSpaces(space, true); } level++; for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { margin.append(' '); } canIndent = true; }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printElementEnd(char[] name, char[] space) throws IOException { for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { margin.deleteCharAt(0); } level--; if (name != null) { if (prettyPrinter.getFormat()) { if (xmlSpace.get(0) != Boolean.TRUE && (line != ((Integer)startingLines.get(0)).intValue() || column + name.length + 3 >= prettyPrinter.getDocumentWidth())) { printNewline(); printString(margin.toString()); } } printString("</"); printCharacters(name); if (space != null) { printSpaces(space, true); } printCharacter('>'); } else { printString("/>"); } startingLines.remove(0); xmlSpace.remove(0); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace) throws IOException { if (!prettyPrinter.getFormat()) { printCharacters(data); return false; } canIndent = true; if (isWhiteSpace(data)) { int nl = newlines(data); for (int i = 0; i < nl - 1; i++) { printNewline(); } return true; } if (xmlSpace.get(0) == Boolean.TRUE) { printCharacters(data); canIndent = false; return false; } if (first) { printNewline(); printString(margin.toString()); } return formatText(data, margin.toString(), preceedingSpace); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCDATASection(char[] data) throws IOException { printString("<![CDATA["); printCharacters(data); printString("]]>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printNotation(char[] space1, char[] name, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException { writer.write("<!NOTATION"); printSpaces(space1, false); writer.write(name); printSpaces(space2, false); writer.write(externalId); printSpaces(space3, false); writer.write(string1Delim); writer.write(string1); writer.write(string1Delim); if (space4 != null) { printSpaces(space4, false); if (string2 != null) { writer.write(string2Delim); writer.write(string2); writer.write(string2Delim); } } if (space5 != null) { printSpaces(space5, true); } writer.write('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttlistStart(char[] space, char[] name) throws IOException { writer.write("<!ATTLIST"); printSpaces(space, false); writer.write(name); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttlistEnd(char[] space) throws IOException { if (space != null) { printSpaces(space, false); } writer.write('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttName(char[] space1, char[] name, char[] space2) throws IOException { printSpaces(space1, false); writer.write(name); printSpaces(space2, false); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printEnumeration(List names) throws IOException { writer.write('('); Iterator it = names.iterator(); NameInfo ni = (NameInfo)it.next(); if (ni.space1 != null) { printSpaces(ni.space1, true); } writer.write(ni.name); if (ni.space2 != null) { printSpaces(ni.space2, true); } while (it.hasNext()) { writer.write('|'); ni = (NameInfo)it.next(); if (ni.space1 != null) { printSpaces(ni.space1, true); } writer.write(ni.name); if (ni.space2 != null) { printSpaces(ni.space2, true); } } writer.write(')'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
protected boolean formatText(char[] text, String margin, boolean preceedingSpace) throws IOException { int i = 0; boolean startsWithSpace = preceedingSpace; loop: while (i < text.length) { for (;;) { if (i >= text.length) { break loop; } if (!XMLUtilities.isXMLSpace(text[i])) { break; } startsWithSpace = true; i++; } StringBuffer sb = new StringBuffer(); for (;;) { if (i >= text.length || XMLUtilities.isXMLSpace(text[i])) { break; } sb.append(text[i++]); } if (sb.length() == 0) { return startsWithSpace; } if (startsWithSpace) { // Consider reformatting ws so things look nicer. int endCol = column + sb.length(); if ((endCol >= prettyPrinter.getDocumentWidth() - 1) && ((margin.length() + sb.length() < prettyPrinter.getDocumentWidth() - 1) || (margin.length() < column))) { printNewline(); printString(margin); } else if (column > margin.length()) { // Don't print space at start of new line. printCharacter(' '); } } printString(sb.toString()); startsWithSpace = false; } return startsWithSpace; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void close() throws IOException { if (os == null) return; try { os.close(); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void flush() throws IOException { if (os == null) return; try { os.flush(); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(byte[] b) throws IOException { if (os == null) return; try { os.write(b); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(byte[] b, int off, int len) throws IOException { if (os == null) return; try { os.write(b, off, len); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(int b) throws IOException { if (os == null) return; try { os.write(b); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/dom/AbstractDocument.java
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); s.writeObject(implementation.getClass().getName()); }
// in sources/org/apache/batik/dom/AbstractDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); Class c = Class.forName((String)s.readObject()); try { Method m = c.getMethod("getDOMImplementation", (Class[])null); implementation = (DOMImplementation)m.invoke(null, (Object[])null); } catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } } }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri) throws IOException { return (SVGDocument)createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri, InputStream inp) throws IOException { return (SVGDocument)createDocument(uri, inp); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri, Reader r) throws IOException { return (SVGDocument)createDocument(uri, r); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri) throws IOException { ParsedURL purl = new ParsedURL(uri); InputStream is = purl.openStream (MimeTypeConstants.MIME_TYPES_SVG_LIST.iterator()); uri = purl.getPostConnectionURL(); InputSource isrc = new InputSource(is); // now looking for a charset encoding in the content type such // as "image/svg+xml; charset=iso8859-1" this is not official // for image/svg+xml yet! only for text/xml and maybe // for application/xml String contentType = purl.getContentType(); int cindex = -1; if (contentType != null) { contentType = contentType.toLowerCase(); cindex = contentType.indexOf(HTTP_CHARSET); } String charset = null; if (cindex != -1) { int i = cindex + HTTP_CHARSET.length(); int eqIdx = contentType.indexOf('=', i); if (eqIdx != -1) { eqIdx++; // no one is interested in the equals sign... // The patch had ',' as the terminator but I suspect // that is the delimiter between possible charsets, // but if another 'attribute' were in the accept header // charset would be terminated by a ';'. So I look // for both and take to closer of the two. int idx = contentType.indexOf(',', eqIdx); int semiIdx = contentType.indexOf(';', eqIdx); if ((semiIdx != -1) && ((semiIdx < idx) || (idx == -1))) idx = semiIdx; if (idx != -1) charset = contentType.substring(eqIdx, idx); else charset = contentType.substring(eqIdx); charset = charset.trim(); isrc.setEncoding(charset); } } isrc.setSystemId(uri); SVGOMDocument doc = (SVGOMDocument) super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, isrc); doc.setParsedURL(new ParsedURL(uri)); doc.setDocumentInputEncoding(charset); doc.setXmlStandalone(isStandalone); doc.setXmlVersion(xmlVersion); return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, InputStream inp) throws IOException { Document doc; InputSource is = new InputSource(inp); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { Document doc; InputSource is = new InputSource(r); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, is); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, r); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static void writeNode(Node n, Writer w, NSMap m, boolean isXML11) throws IOException { switch (n.getNodeType()) { case Node.ELEMENT_NODE: { if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); if (name.startsWith("xmlns")) { if (name.length() == 5) { m = m.declare("", a.getNodeValue()); } else { String prefix = name.substring(6); m = m.declare(prefix, a.getNodeValue()); } } } } w.write('<'); String ns = n.getNamespaceURI(); String tagName; if (ns == null) { tagName = n.getNodeName(); w.write(tagName); if (!"".equals(m.getNamespace(""))) { w.write(" xmlns=\"\""); m = m.declare("", ""); } } else { String prefix = n.getPrefix(); if (prefix == null) { prefix = ""; } if (ns.equals(m.getNamespace(prefix))) { tagName = n.getNodeName(); w.write(tagName); } else { prefix = m.getPrefixForElement(ns); if (prefix == null) { prefix = m.getNewPrefix(); tagName = prefix + ':' + n.getLocalName(); w.write(tagName + " xmlns:" + prefix + "=\"" + contentToString(ns, isXML11) + '"'); m = m.declare(prefix, ns); } else { if (prefix.equals("")) { tagName = n.getLocalName(); } else { tagName = prefix + ':' + n.getLocalName(); } w.write(tagName); } } } if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); String prefix = a.getPrefix(); String ans = a.getNamespaceURI(); if (ans != null && !("xmlns".equals(prefix) || name.equals("xmlns"))) { if (prefix != null && !ans.equals(m.getNamespace(prefix)) || prefix == null) { prefix = m.getPrefixForAttr(ans); if (prefix == null) { prefix = m.getNewPrefix(); m = m.declare(prefix, ans); w.write(" xmlns:" + prefix + "=\"" + contentToString(ans, isXML11) + '"'); } name = prefix + ':' + a.getLocalName(); } } w.write(' ' + name + "=\"" + contentToString(a.getNodeValue(), isXML11) + '"'); } } Node c = n.getFirstChild(); if (c != null) { w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null); w.write("</" + tagName + '>'); } else { w.write("/>"); } break; } case Node.TEXT_NODE: w.write(contentToString(n.getNodeValue(), isXML11)); break; case Node.CDATA_SECTION_NODE: { String data = n.getNodeValue(); if (data.indexOf("]]>") != -1) { throw new IOException("Unserializable CDATA section node"); } w.write("<![CDATA[" + assertValidCharacters(data, isXML11) + "]]>"); break; } case Node.ENTITY_REFERENCE_NODE: w.write('&' + n.getNodeName() + ';'); break; case Node.PROCESSING_INSTRUCTION_NODE: { String target = n.getNodeName(); String data = n.getNodeValue(); if (target.equalsIgnoreCase("xml") || target.indexOf(':') != -1 || data.indexOf("?>") != -1) { throw new IOException("Unserializable processing instruction node"); } w.write("<?" + target + ' ' + data + "?>"); break; } case Node.COMMENT_NODE: { w.write("<!--"); String data = n.getNodeValue(); int len = data.length(); if (len != 0 && data.charAt(len - 1) == '-' || data.indexOf("--") != -1) { throw new IOException("Unserializable comment node"); } w.write(data); w.write("-->"); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType dt = (DocumentType)n; w.write("<!DOCTYPE " + n.getOwnerDocument().getDocumentElement().getNodeName()); String pubID = dt.getPublicId(); if (pubID != null) { char q = getUsableQuote(pubID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } w.write(" PUBLIC " + q + pubID + q); } String sysID = dt.getSystemId(); if (sysID != null) { char q = getUsableQuote(sysID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } if (pubID == null) { w.write(" SYSTEM"); } w.write(" " + q + sysID + q); } String subset = dt.getInternalSubset(); if (subset != null) { w.write('[' + subset + ']'); } w.write('>'); break; } default: throw new IOException("Unknown DOM node type " + n.getNodeType()); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeNode(Node n, Writer w) throws IOException { if (n.getNodeType() == Node.DOCUMENT_NODE) { writeDocument((Document) n, w); } else { AbstractDocument d = (AbstractDocument) n.getOwnerDocument(); writeNode(n, w, NSMap.create(), d == null ? false : "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static String assertValidCharacters(String s, boolean isXML11) throws IOException { int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } } return s; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static String contentToString(String s, boolean isXML11) throws IOException { StringBuffer result = new StringBuffer(s.length()); int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; default: result.append(c); } } return result.toString(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { return createDocument(ns, root, uri, new InputSource(uri)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri) throws IOException { return createDocument(new InputSource(uri)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { InputSource inp = new InputSource(is); inp.setSystemId(uri); return createDocument(ns, root, uri, inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri, InputStream is) throws IOException { InputSource inp = new InputSource(is); inp.setSystemId(uri); return createDocument(inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { InputSource inp = new InputSource(r); inp.setSystemId(uri); return createDocument(ns, root, uri, inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, XMLReader r) throws IOException { r.setContentHandler(this); r.setDTDHandler(this); r.setEntityResolver(this); try { r.parse(uri); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { InputSource inp = new InputSource(r); inp.setSystemId(uri); return createDocument(inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(String ns, String root, String uri, InputSource is) throws IOException { Document ret = createDocument(is); Element docElem = ret.getDocumentElement(); String lname = root; String nsURI = ns; if (ns == null) { int idx = lname.indexOf(':'); String nsp = (idx == -1 || idx == lname.length()-1) ? "" : lname.substring(0, idx); nsURI = namespaces.get(nsp); if (idx != -1 && idx != lname.length()-1) { lname = lname.substring(idx+1); } } String docElemNS = docElem.getNamespaceURI(); if ((docElemNS != nsURI) && ((docElemNS == null) || (!docElemNS.equals(nsURI)))) throw new IOException ("Root element namespace does not match that requested:\n" + "Requested: " + nsURI + "\n" + "Found: " + docElemNS); if (docElemNS != null) { if (!docElem.getLocalName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getLocalName()); } else { if (!docElem.getNodeName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getNodeName()); } return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string1() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string2() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '"': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int dotNumber() throws IOException { loop: for (;;) { switch (nextChar()) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/bridge/URIResolver.java
public Element getElement(String uri, Element ref) throws MalformedURLException, IOException { Node n = getNode(uri, ref); if (n == null) { return null; } else if (n.getNodeType() == Node.DOCUMENT_NODE) { throw new IllegalArgumentException(); } else { return (Element)n; } }
// in sources/org/apache/batik/bridge/URIResolver.java
public Node getNode(String uri, Element ref) throws MalformedURLException, IOException, SecurityException { String baseURI = getRefererBaseURI(ref); // System.err.println("baseURI: " + baseURI); // System.err.println("URI: " + uri); if (baseURI == null && uri.charAt(0) == '#') { return getNodeByFragment(uri.substring(1), ref); } ParsedURL purl = new ParsedURL(baseURI, uri); // System.err.println("PURL: " + purl); if (documentURI == null) documentURI = document.getURL(); String frag = purl.getRef(); if ((frag != null) && (documentURI != null)) { ParsedURL pDocURL = new ParsedURL(documentURI); // System.out.println("doc: " + pDocURL); // System.out.println("Purl: " + purl); if (pDocURL.sameFile(purl)) { // System.out.println("match"); return document.getElementById(frag); } } // uri is not a reference into this document, so load the // document it does reference after doing a security // check with the UserAgent ParsedURL pDocURL = null; if (documentURI != null) { pDocURL = new ParsedURL(documentURI); } UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); String purlStr = purl.toString(); if (frag != null) { purlStr = purlStr.substring(0, purlStr.length()-(frag.length()+1)); } Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag); return doc; }
// in sources/org/apache/batik/bridge/DocumentLoader.java
public Document loadDocument(String uri) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
// in sources/org/apache/batik/bridge/DocumentLoader.java
public Document loadDocument(String uri, InputStream is) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri, is); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void reset() throws IOException { throw new IOException("Reset unsupported"); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void retry() throws IOException { super.reset(); wasClosed = false; isTied = false; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void close() throws IOException { wasClosed = true; if (isTied) { super.close(); // System.err.println("Closing stream - from close"); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void tie() throws IOException { isTied = true; if (wasClosed) { super.close(); // System.err.println("Closing stream - from tie"); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected ProtectedStream openStream(Element e, ParsedURL purl) throws IOException { List mimeTypes = new ArrayList (ImageTagRegistry.getRegistry().getRegisteredMimeTypes()); mimeTypes.addAll(MimeTypeConstants.MIME_TYPES_SVG_LIST); InputStream reference = purl.openStream(mimeTypes.iterator()); return new ProtectedStream(reference); }
// in sources/org/apache/batik/util/ParsedURLData.java
public static InputStream checkGZIP(InputStream is) throws IOException { if (!is.markSupported()) is = new BufferedInputStream(is); byte[] data = new byte[2]; try { is.mark(2); is.read(data); is.reset(); } catch (Exception ex) { is.reset(); return is; } if ((data[0] == GZIP_MAGIC[0]) && (data[1] == GZIP_MAGIC[1])) return new GZIPInputStream(is); if (((data[0]&0x0F) == 8) && ((data[0]>>>4) <= 7)) { // Check for a zlib (deflate) stream int chk = ((((int)data[0])&0xFF)*256+ (((int)data[1])&0xFF)); if ((chk %31) == 0) { try { // I'm not really as certain of this check // as I would like so I want to force it // to decode part of the stream. is.mark(100); InputStream ret = new InflaterInputStream(is); if (!ret.markSupported()) ret = new BufferedInputStream(ret); ret.mark(2); ret.read(data); is.reset(); ret = new InflaterInputStream(is); return ret; } catch (ZipException ze) { is.reset(); return is; } } } return is; }
// in sources/org/apache/batik/util/ParsedURLData.java
public InputStream openStream(String userAgent, Iterator mimeTypes) throws IOException { InputStream raw = openStreamInternal(userAgent, mimeTypes, acceptedEncodings.iterator()); if (raw == null) return null; stream = null; return checkGZIP(raw); }
// in sources/org/apache/batik/util/ParsedURLData.java
public InputStream openStreamRaw(String userAgent, Iterator mimeTypes) throws IOException { InputStream ret = openStreamInternal(userAgent, mimeTypes, null); stream = null; return ret; }
// in sources/org/apache/batik/util/ParsedURLData.java
protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { if (stream != null) return stream; hasBeenOpened = true; URL url = null; try { url = buildURL(); } catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); } if (url == null) return null; URLConnection urlC = url.openConnection(); if (urlC instanceof HttpURLConnection) { if (userAgent != null) urlC.setRequestProperty(HTTP_USER_AGENT_HEADER, userAgent); if (mimeTypes != null) { String acceptHeader = ""; while (mimeTypes.hasNext()) { acceptHeader += mimeTypes.next(); if (mimeTypes.hasNext()) acceptHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_HEADER, acceptHeader); } if (encodingTypes != null) { String encodingHeader = ""; while (encodingTypes.hasNext()) { encodingHeader += encodingTypes.next(); if (encodingTypes.hasNext()) encodingHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_ENCODING_HEADER, encodingHeader); } contentType = urlC.getContentType(); contentEncoding = urlC.getContentEncoding(); postConnectionURL = urlC.getURL(); } try { return (stream = urlC.getInputStream()); } catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public InputStream getInputStream() throws IOException { return jar.jarFile.getInputStream(jar.jarFile.getEntry(name)); }
// in sources/org/apache/batik/util/ClassFileUtilities.java
private static void collectJars(File dir, Map jars, Map classFiles) throws IOException { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { String n = files[i].getName(); if (n.endsWith(".jar") && files[i].isFile()) { Jar j = new Jar(); j.name = files[i].getPath(); j.file = files[i]; j.jarFile = new JarFile(files[i]); jars.put(j.name, j); Enumeration entries = j.jarFile.entries(); while (entries.hasMoreElements()) { ZipEntry ze = (ZipEntry) entries.nextElement(); String name = ze.getName(); if (name.endsWith(".class")) { ClassFile cf = new ClassFile(); cf.name = name; cf.jar = j; classFiles.put(j.name + '!' + cf.name, cf); j.files.add(cf); } } } else if (files[i].isDirectory()) { collectJars(files[i], jars, classFiles); } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(String path, Set classpath, boolean rec) throws IOException { return getClassDependencies(new FileInputStream(path), classpath, rec); }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is, Set classpath, boolean rec) throws IOException { Set result = new HashSet(); Set done = new HashSet(); computeClassDependencies(is, classpath, done, result, rec); return result; }
// in sources/org/apache/batik/util/ClassFileUtilities.java
private static void computeClassDependencies(InputStream is, Set classpath, Set done, Set result, boolean rec) throws IOException { Iterator it = getClassDependencies(is).iterator(); while (it.hasNext()) { String s = (String)it.next(); if (!done.contains(s)) { done.add(s); Iterator cpit = classpath.iterator(); while (cpit.hasNext()) { InputStream depis = null; String path = null; Object cpEntry = cpit.next(); if (cpEntry instanceof JarFile) { JarFile jarFile = (JarFile) cpEntry; String classFileName = s + ".class"; ZipEntry ze = jarFile.getEntry(classFileName); if (ze != null) { path = jarFile.getName() + '!' + classFileName; depis = jarFile.getInputStream(ze); } } else { path = ((String) cpEntry) + '/' + s + ".class"; File f = new File(path); if (f.isFile()) { depis = new FileInputStream(f); } } if (depis != null) { result.add(path); if (rec) { computeClassDependencies (depis, classpath, done, result, rec); } } } } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
// in sources/org/apache/batik/util/io/ISO_8859_1Decoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return -1; } return buffer[position++] & 0xff; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public int read() throws IOException { int result = nextChar; if (result != -1) { nextChar = -1; if (result == 13) { column = 0; line++; } else { column++; } return result; } result = charDecoder.readChar(); switch (result) { case 13: column = 0; line++; int c = charDecoder.readChar(); if (c == 10) { return 10; } nextChar = c; return 10; case 10: column = 0; line++; } return result; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public void close() throws IOException { charDecoder.dispose(); charDecoder = null; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
protected CharDecoder createCharDecoder(InputStream is, String enc) throws IOException { CharDecoderFactory cdf = (CharDecoderFactory)charDecoderFactories.get(enc.toUpperCase()); if (cdf != null) { return cdf.createCharDecoder(is); } String e = EncodingUtilities.javaEncoding(enc); if (e == null) { e = enc; } return new GenericDecoder(is, e); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new ASCIIDecoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new ISO_8859_1Decoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new UTF8Decoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new UTF16Decoder(is); }
// in sources/org/apache/batik/util/io/StringDecoder.java
public int readChar() throws IOException { if (next == length) { return END_OF_STREAM; } return string.charAt(next++); }
// in sources/org/apache/batik/util/io/StringDecoder.java
public void dispose() throws IOException { string = null; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
public void dispose() throws IOException { inputStream.close(); inputStream = null; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void fillBuffer() throws IOException { count = inputStream.read(buffer, 0, BUFFER_SIZE); position = 0; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void charError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("invalid.char", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void endOfStreamError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("end.of.stream", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/ASCIIDecoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } int result = buffer[position++]; if (result < 0) { charError("ASCII"); } return result; }
// in sources/org/apache/batik/util/io/UTF16Decoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } byte b1 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-16"); } byte b2 = buffer[position++]; int c = (bigEndian) ? (((b1 & 0xff) << 8) | (b2 & 0xff)) : (((b2 & 0xff) << 8) | (b1 & 0xff)); if (c == 0xfffe) { charError("UTF-16"); } return c; }
// in sources/org/apache/batik/util/io/GenericDecoder.java
public int readChar() throws IOException { return reader.read(); }
// in sources/org/apache/batik/util/io/GenericDecoder.java
public void dispose() throws IOException { reader.close(); reader = null; }
// in sources/org/apache/batik/util/io/NormalizingReader.java
public int read(char[] cbuf, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } int result = 0; do { cbuf[result + off] = (char)c; result++; c = read(); } while (c != -1 && result < len); return result; }
// in sources/org/apache/batik/util/io/StringNormalizingReader.java
public int read() throws IOException { int result = (length == next) ? -1 : string.charAt(next++); if (result <= 13) { switch (result) { case 13: column = 0; line++; int c = (length == next) ? -1 : string.charAt(next); if (c == 10) { next++; } return 10; case 10: column = 0; line++; } } return result; }
// in sources/org/apache/batik/util/io/StringNormalizingReader.java
public void close() throws IOException { string = null; }
// in sources/org/apache/batik/util/io/UTF8Decoder.java
public int readChar() throws IOException { if (nextChar != -1) { int result = nextChar; nextChar = -1; return result; } if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } int b1 = buffer[position++] & 0xff; switch (UTF8_BYTES[b1]) { default: charError("UTF-8"); case 1: return b1; case 2: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } return ((b1 & 0x1f) << 6) | (buffer[position++] & 0x3f); case 3: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b2 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b3 = buffer[position++]; if ((b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80) { charError("UTF-8"); } return ((b1 & 0x1f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x1f); case 4: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } b2 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } b3 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b4 = buffer[position++]; if ((b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80 || (b4 & 0xc0) != 0x80) { charError("UTF-8"); } int c = ((b1 & 0x1f) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x1f) << 6) | (b4 & 0x1f); nextChar = (c - 0x10000) % 0x400 + 0xdc00; return (c - 0x10000) / 0x400 + 0xd800; } }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void close () throws IOException { if (out != null) { encodeAtom(); out.flush(); if (closeOutOnClose) out.close(); out=null; } }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void flush() throws IOException { out.flush(); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(int b) throws IOException { atom[atomLen++] = (byte)b; if (atomLen == 3) encodeAtom(); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(byte []data) throws IOException { encodeFromArray(data, 0, data.length); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(byte [] data, int off, int len) throws IOException { encodeFromArray(data, off, len); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
void encodeAtom() throws IOException { byte a, b, c; switch (atomLen) { case 0: return; case 1: a = atom[0]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[((a << 4) & 0x30)]; encodeBuf[2] = encodeBuf[3] = '='; break; case 2: a = atom[0]; b = atom[1]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[((b << 2) & 0x3C)]; encodeBuf[3] = '='; break; default: a = atom[0]; b = atom[1]; c = atom[2]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))]; encodeBuf[3] = pem_array[c & 0x3F]; } if (lineLen == 64) { out.println(); lineLen = 0; } out.write(encodeBuf); lineLen += 4; atomLen = 0; }
// in sources/org/apache/batik/util/Base64EncoderStream.java
void encodeFromArray(byte[] data, int offset, int len) throws IOException{ byte a, b, c; if (len == 0) return; // System.out.println("atomLen: " + atomLen + // " len: " + len + // " offset: " + offset); if (atomLen != 0) { switch(atomLen) { case 1: atom[1] = data[offset++]; len--; atomLen++; if (len == 0) return; atom[2] = data[offset++]; len--; atomLen++; break; case 2: atom[2] = data[offset++]; len--; atomLen++; break; default: } encodeAtom(); } while (len >=3) { a = data[offset++]; b = data[offset++]; c = data[offset++]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))]; encodeBuf[3] = pem_array[c & 0x3F]; out.write(encodeBuf); lineLen += 4; if (lineLen == 64) { out.println(); lineLen = 0; } len -=3; } switch (len) { case 1: atom[0] = data[offset]; break; case 2: atom[0] = data[offset]; atom[1] = data[offset+1]; break; default: } atomLen = len; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public void close() throws IOException { EOF = true; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int available() throws IOException { return 3-out_offset; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int read() throws IOException { if (out_offset == 3) { if (EOF || getNextAtom()) { EOF = true; return -1; } } return ((int)out_buffer[out_offset++])&0xFF; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int read(byte []out, int offset, int len) throws IOException { int idx = 0; while (idx < len) { if (out_offset == 3) { if (EOF || getNextAtom()) { EOF = true; if (idx == 0) return -1; else return idx; } } out[offset+idx] = out_buffer[out_offset++]; idx++; } return idx; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
final boolean getNextAtom() throws IOException { int count, a, b, c, d; int off = 0; while(off != 4) { count = src.read(decode_buffer, off, 4-off); if (count == -1) return true; int in=off, out=off; while(in < off+count) { if ((decode_buffer[in] != '\n') && (decode_buffer[in] != '\r') && (decode_buffer[in] != ' ')) decode_buffer[out++] = decode_buffer[in]; in++; } off = out; } a = pem_array[((int)decode_buffer[0])&0xFF]; b = pem_array[((int)decode_buffer[1])&0xFF]; c = pem_array[((int)decode_buffer[2])&0xFF]; d = pem_array[((int)decode_buffer[3])&0xFF]; out_buffer[0] = (byte)((a<<2) | (b>>>4)); out_buffer[1] = (byte)((b<<4) | (c>>>2)); out_buffer[2] = (byte)((c<<6) | d ); if (decode_buffer[3] != '=') { // All three bytes are good. out_offset=0; } else if (decode_buffer[2] == '=') { // Only one byte of output. out_buffer[2] = out_buffer[0]; out_offset = 2; EOF=true; } else { // Only two bytes of output. out_buffer[2] = out_buffer[1]; out_buffer[1] = out_buffer[0]; out_offset = 1; EOF=true; } return false; }
// in sources/org/apache/batik/util/ParsedURLDataProtocolHandler.java
protected InputStream openStreamInternal (String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { stream = decode(path); if (BASE64.equals(contentEncoding)) { stream = new Base64DecodeStream(stream); } return stream; }
// in sources/org/apache/batik/util/ParsedURL.java
public static InputStream checkGZIP(InputStream is) throws IOException { return ParsedURLData.checkGZIP(is); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream() throws IOException { return data.openStream(userAgent, null); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(String mimeType) throws IOException { List mt = new ArrayList(1); mt.add(mimeType); return data.openStream(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); for (int i=0; i<mimeTypes.length; i++) mt.add(mimeTypes[i]); return data.openStream(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(Iterator mimeTypes) throws IOException { return data.openStream(userAgent, mimeTypes); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw() throws IOException { return data.openStreamRaw(userAgent, null); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(String mimeType) throws IOException { List mt = new ArrayList(1); mt.add(mimeType); return data.openStreamRaw(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); mt.addAll(Arrays.asList(mimeTypes)); return data.openStreamRaw(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(Iterator mimeTypes) throws IOException { return data.openStreamRaw(userAgent, mimeTypes); }
// in sources/org/apache/batik/util/PreferenceManager.java
public void load() throws IOException { FileInputStream fis = null; if (fullName != null) try { fis = new FileInputStream(fullName); } catch (IOException e1) { fullName = null; } if (fullName == null) { if (PREF_DIR != null) { try { fis = new FileInputStream(fullName = PREF_DIR+FILE_SEP+prefFileName); } catch (IOException e2) { fullName = null; } } if (fullName == null) { try { fis = new FileInputStream(fullName = USER_HOME+FILE_SEP+prefFileName); } catch (IOException e3) { try { fis = new FileInputStream(fullName = USER_DIR+FILE_SEP+prefFileName); } catch (IOException e4) { fullName = null; } } } } if (fullName != null) { try { internal.load(fis); } finally { fis.close(); } } }
// in sources/org/apache/batik/util/PreferenceManager.java
public void save() throws IOException { FileOutputStream fos = null; if (fullName != null) try { fos = new FileOutputStream(fullName); } catch(IOException e1) { fullName = null; } if (fullName == null) { if (PREF_DIR != null) { try { fos = new FileOutputStream(fullName = PREF_DIR+FILE_SEP+prefFileName); } catch (IOException e2) { fullName = null; } } if (fullName == null) { try { fos = new FileOutputStream(fullName = USER_HOME+FILE_SEP+prefFileName); } catch (IOException e3) { fullName = null; throw e3; } } } try { internal.store(fos, prefFileName); } finally { fos.close(); } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { scanner = createScanner(source); try { documentHandler.startDocument(source); current = scanner.next(); switch (current) { case LexicalUnits.CHARSET_SYMBOL: if (nextIgnoreSpaces() != LexicalUnits.STRING) { reportError("charset.string"); } else { if (nextIgnoreSpaces() != LexicalUnits.SEMI_COLON) { reportError("semicolon"); } next(); } break; case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); } skipSpacesAndCDOCDC(); for (;;) { if (current == LexicalUnits.IMPORT_SYMBOL) { nextIgnoreSpaces(); parseImportRule(); nextIgnoreSpaces(); } else { break; } } loop: for (;;) { switch (current) { case LexicalUnits.PAGE_SYMBOL: nextIgnoreSpaces(); parsePageRule(); break; case LexicalUnits.MEDIA_SYMBOL: nextIgnoreSpaces(); parseMediaRule(); break; case LexicalUnits.FONT_FACE_SYMBOL: nextIgnoreSpaces(); parseFontFaceRule(); break; case LexicalUnits.AT_KEYWORD: nextIgnoreSpaces(); parseAtRule(); break; case LexicalUnits.EOF: break loop; default: parseRuleSet(); } skipSpacesAndCDOCDC(); } } finally { documentHandler.endDocument(source); scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parseStyleSheet(new InputSource(uri)); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclarationInternal() throws CSSException, IOException { nextIgnoreSpaces(); try { parseStyleDeclaration(false); } catch (CSSParseException e) { reportError(e); } finally { scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseRuleInternal() throws CSSException, IOException { nextIgnoreSpaces(); parseRule(); scanner = null; }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected SelectorList parseSelectorsInternal() throws CSSException, IOException { nextIgnoreSpaces(); SelectorList ret = parseSelectorList(); scanner = null; return ret; }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected boolean parsePriorityInternal() throws CSSException, IOException { nextIgnoreSpaces(); scanner = null; switch (current) { case LexicalUnits.EOF: return false; case LexicalUnits.IMPORT_SYMBOL: return true; default: reportError("token", new Object[] { new Integer(current) }); return false; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { scanner = new Scanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(String source) throws CSSException, IOException { scanner = new Scanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { scanner = new Scanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { parser.parseStyleDeclaration(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { parser.parseStyleDeclaration (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(InputSource source) throws CSSException, IOException { parser.parseRule(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(String source) throws CSSException, IOException { parser.parseRule(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { return parser.parseSelectors(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { return parser.parseSelectors (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { return parser.parsePropertyValue(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { return parser.parsePropertyValue (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { return parser.parsePriority(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(String source) throws CSSException, IOException { return parser.parsePriority(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string1() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; case '"': break; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string2() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break; case '"': break loop; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(true); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int dotNumber() throws IOException { loop: for (;;) { switch (nextChar()) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(false); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int numberUnit(boolean integer) throws IOException { switch (current) { case '%': nextChar(); return LexicalUnits.PERCENTAGE; case 'c': case 'C': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.CM; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'd': case 'D': switch(nextChar()) { case 'e': case 'E': switch(nextChar()) { case 'g': case 'G': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.DEG; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'e': case 'E': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.EM; case 'x': case 'X': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.EX; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'g': case 'G': switch(nextChar()) { case 'r': case 'R': switch(nextChar()) { case 'a': case 'A': switch(nextChar()) { case 'd': case 'D': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.GRAD; } } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'h': case 'H': nextChar(); switch(current) { case 'z': case 'Z': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.HZ; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'i': case 'I': switch(nextChar()) { case 'n': case 'N': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.IN; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'k': case 'K': switch(nextChar()) { case 'h': case 'H': switch(nextChar()) { case 'z': case 'Z': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.KHZ; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'm': case 'M': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.MM; case 's': case 'S': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.MS; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'p': case 'P': switch(nextChar()) { case 'c': case 'C': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PC; case 't': case 'T': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PT; case 'x': case 'X': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PX; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'r': case 'R': switch(nextChar()) { case 'a': case 'A': switch(nextChar()) { case 'd': case 'D': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.RAD; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 's': case 'S': nextChar(); return LexicalUnits.S; default: if (current != -1 && ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); return LexicalUnits.DIMENSION; } return (integer) ? LexicalUnits.INTEGER : LexicalUnits.REAL; } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void escape() throws IOException { if (ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } } if ((current >= ' ' && current <= '~') || current >= 128) { nextChar(); return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { // list is full, grow to 1.5 * size char[] t = new char[ 1 + position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
protected void parseStyleSheet(StyleSheet ss, InputSource is, ParsedURL uri) throws IOException { parser.setSelectorFactory(CSSSelectorFactory.INSTANCE); parser.setConditionFactory(cssConditionFactory); try { cssBaseURI = uri; styleSheetDocumentHandler.styleSheet = ss; parser.setDocumentHandler(styleSheetDocumentHandler); parser.parseStyleSheet(is); // Load the imported sheets. int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); if (r.getType() != ImportRule.TYPE) { // @import rules must be the first rules. break; } ImportRule ir = (ImportRule)r; parseStyleSheet(ir, ir.getURI()); } } finally { cssBaseURI = null; } }
(Domain) LiveAttributeException 18
              
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public float getCheckedValue() { if (hasAnimVal) { if (animVal == null) { animVal = new AnimSVGLength(direction); } if (nonNegative && animVal.value < 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE, animVal.getValueAsString()); } return animVal.getValue(); } else { if (baseVal == null) { baseVal = new BaseSVGLength(direction); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } else if (baseVal.unitType == SVGLength.SVG_LENGTHTYPE_UNKNOWN) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } if (nonNegative && baseVal.value < 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE, baseVal.getValueAsString()); } return baseVal.getValue(); } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
public short getCheckedVal() { if (hasAnimVal) { return animVal; } if (!valid) { update(); } if (baseVal == 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, getBaseValAsString()); } return baseVal; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void endNumberList() { if (count != 4) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGLengthList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGTransformList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGPointList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public void check() { if (!hasAnimVal) { if (pathSegs == null) { pathSegs = new BaseSVGPathSegList(); } pathSegs.revalidate(); if (pathSegs.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (pathSegs.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, pathSegs.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGNumberList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGPARValue(); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
0 0
(Domain) TranscoderException 15
              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); TIFFEncodeParam params = new TIFFEncodeParam(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 100 Meters int numPix = (int)(((1000 * 100) / PixSzMM) + 0.5); int denom = 100 * 100; // Centimeters per 100 Meters; long [] rational = {numPix, denom}; TIFFField [] fields = { new TIFFField(TIFFImageDecoder.TIFF_RESOLUTION_UNIT, TIFFField.TIFF_SHORT, 1, new char [] { (char)3 }), new TIFFField(TIFFImageDecoder.TIFF_X_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }), new TIFFField(TIFFImageDecoder.TIFF_Y_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }) }; params.setExtraFields(fields); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); if ("packbits".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS); } else if ("deflate".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE); /* TODO: NPE occurs when used. } else if ("jpeg".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2); */ } else { //nop } } try { int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); OutputStream ostream = output.getOutputStream(); TIFFImageEncoder tiffEncoder = new TIFFImageEncoder(ostream, params); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); tiffEncoder.encode(rimg); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n = -1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img, 1<<n); } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); ImageWriterParams params = new ImageWriterParams(); /* NYI!!!!! PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); }*/ // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. /* NYI!!!!!! if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); }*/ float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); try { OutputStream ostream = output.getOutputStream(); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/tiff"); ImageWriterParams params = new ImageWriterParams(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); //Values set here as defined in TIFFImageWriteParam of JAI Image I/O Tools if ("packbits".equals(method)) { params.setCompressionMethod("PackBits"); } else if ("deflate".equals(method)) { params.setCompressionMethod("Deflate"); } else if ("lzw".equals(method)) { params.setCompressionMethod("LZW"); } else if ("jpeg".equals(method)) { params.setCompressionMethod("JPEG"); } else { //nop } } try { OutputStream ostream = output.getOutputStream(); int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); writer.writeImage(rimg, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n=-1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img,1<<n); } PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); } // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); } float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 1 Meter int numPix = (int)((1000/PixSzMM)+0.5); params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter' try { OutputStream ostream = output.getOutputStream(); PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params); pngEncoder.encode(img); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { if ((document != null) && !(document.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); // impl = SVGDOMImplementation.getDOMImplementation(); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri); ((SVGOMDocument)document).setParsedURL(url); } } if (hints.containsKey(KEY_WIDTH)) width = ((Float)hints.get(KEY_WIDTH)).floatValue(); if (hints.containsKey(KEY_HEIGHT)) height = ((Float)hints.get(KEY_HEIGHT)).floatValue(); SVGOMDocument svgDoc = (SVGOMDocument)document; SVGSVGElement root = svgDoc.getRootElement(); ctx = createBridgeContext(svgDoc); // build the GVT tree builder = new GVTBuilder(); // flag that indicates if the document is dynamic boolean isDynamic = hints.containsKey(KEY_EXECUTE_ONLOAD) && ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue(); GraphicsNode gvtRoot; try { if (isDynamic) ctx.setDynamicState(BridgeContext.DYNAMIC); gvtRoot = builder.build(ctx, svgDoc); // dispatch an 'onload' event if needed if (ctx.isDynamic()) { BaseScriptingEnvironment se; se = new BaseScriptingEnvironment(ctx); se.loadScripts(); se.dispatchSVGLoadEvent(); if (hints.containsKey(KEY_SNAPSHOT_TIME)) { float t = ((Float) hints.get(KEY_SNAPSHOT_TIME)).floatValue(); ctx.getAnimationEngine().setCurrentTime(t); } else if (ctx.isSVG12()) { float t = SVGUtilities.convertSnapshotTime(root, null); ctx.getAnimationEngine().setCurrentTime(t); } } } catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); // compute the preserveAspectRatio matrix AffineTransform Px; // take the AOI into account if any if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); // transform the AOI into the image's coordinate system Px = new AffineTransform(); double sx = width / aoi.getWidth(); double sy = height / aoi.getHeight(); double scale = Math.min(sx,sy); Px.scale(scale, scale); double tx = -aoi.getX() + (width/scale - aoi.getWidth())/2; double ty = -aoi.getY() + (height/scale -aoi.getHeight())/2; Px.translate(tx, ty); // take the AOI transformation matrix into account // we apply first the preserveAspectRatio matrix curAOI = aoi; } else { String ref = new ParsedURL(uri).getRef(); // XXX Update this to use the animated value of 'viewBox' and // 'preserveAspectRatio'. String viewBox = root.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if ((ref != null) && (ref.length() != 0)) { Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else { // no viewBox has been specified, create a scale transform float xscale, yscale; xscale = width/docWidth; yscale = height/docHeight; float scale = Math.min(xscale,yscale); Px = AffineTransform.getScaleInstance(scale, scale); } curAOI = new Rectangle2D.Float(0, 0, width, height); } CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px); curTxf = new AffineTransform(); } else { curTxf = Px; } this.root = gvtRoot; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public static void main(String[] args) throws TranscoderException { if(args.length < 1){ System.out.println("Usage : WMFTranscoder.main <file 1> ... <file n>"); System.exit(1); } WMFTranscoder transcoder = new WMFTranscoder(); int nFiles = args.length; for(int i=0; i<nFiles; i++){ String fileName = args[i]; if(!fileName.toLowerCase().endsWith(WMF_EXTENSION)){ System.err.println(args[i] + " does not have the " + WMF_EXTENSION + " extension. It is ignored"); } else{ System.out.print("Processing : " + args[i] + "..."); String outputFileName = fileName.substring(0, fileName.toLowerCase().indexOf(WMF_EXTENSION)) + SVG_EXTENSION; File inputFile = new File(fileName); File outputFile = new File(outputFileName); try { TranscoderInput input = new TranscoderInput(inputFile.toURL().toString()); TranscoderOutput output = new TranscoderOutput(new FileOutputStream(outputFile)); transcoder.transcode(input, output); }catch(MalformedURLException e){ throw new TranscoderException(e); }catch(IOException e){ throw new TranscoderException(e); } System.out.println(".... Done"); } } System.exit(0); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
protected void writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output) throws TranscoderException { Document doc = output.getDocument(); if (doc != null) return; // XMLFilter XMLFilter xmlFilter = output.getXMLFilter(); if (xmlFilter != null) { handler.fatalError(new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE)); } try { boolean escaped = false; if (hints.containsKey(KEY_ESCAPED)) { escaped = ((Boolean)hints.get(KEY_ESCAPED)).booleanValue(); } // Output stream OutputStream os = output.getOutputStream(); if (os != null) { svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } // Writer Writer wr = output.getWriter(); if (wr != null) { svgGenerator.stream(svgRoot, wr, false, escaped); return; } // URI String uri = output.getURI(); if ( uri != null ){ try{ URL url = new URL(uri); URLConnection urlCnx = url.openConnection(); os = urlCnx.getOutputStream(); svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } } catch(IOException e){ throw new TranscoderException(e); } throw new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); // The outputstream wrapper protects the JPEG encoder from // exceptions due to stream closings. If it gets an exception // it nulls out the stream and just ignores any future calls. ostream = new OutputStreamWrapper(ostream); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("jpeg.badoutput", null)); } try { float quality; if (hints.containsKey(KEY_QUALITY)) { quality = ((Float)hints.get(KEY_QUALITY)).floatValue(); } else { TranscoderException te; te = new TranscoderException (Messages.formatMessage("jpeg.unspecifiedQuality", null)); handler.error(te); quality = 0.75f; } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(quality, true); float PixSzMM = userAgent.getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("png.badoutput", null)); } // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.png.PNGTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.PNGTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write PNG file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.tiff.TIFFTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.TIFFTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write TIFF file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { // Sets up root, curTxf & curAoi super.transcode(document, uri, output); // prepare the image to be painted int w = (int)(width+0.5); int h = (int)(height+0.5); // paint the SVG document using the bridge package // create the appropriate renderer ImageRenderer renderer = createRenderer(); renderer.updateOffScreen(w, h); // curTxf.translate(0.5, 0.5); renderer.setTransform(curTxf); renderer.setTree(this.root); this.root = null; // We're done with it... try { // now we are sure that the aoi is the image size Shape raoi = new Rectangle2D.Float(0, 0, width, height); // Warning: the renderer's AOI must be in user space renderer.repaint(curTxf.createInverse(). createTransformedShape(raoi)); BufferedImage rend = renderer.getOffScreen(); renderer = null; // We're done with it... BufferedImage dest = createImage(w, h); Graphics2D g2d = GraphicsUtil.createGraphics(dest); if (hints.containsKey(KEY_BACKGROUND_COLOR)) { Paint bgcolor = (Paint)hints.get(KEY_BACKGROUND_COLOR); g2d.setComposite(AlphaComposite.SrcOver); g2d.setPaint(bgcolor); g2d.fillRect(0, 0, w, h); } if (rend != null) { // might be null if the svg document is empty g2d.drawRenderedImage(rend, new AffineTransform()); } g2d.dispose(); rend = null; // We're done with it... writeImage(dest, output); } catch (Exception ex) { throw new TranscoderException(ex); } }
10
              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
36
              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); TIFFEncodeParam params = new TIFFEncodeParam(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 100 Meters int numPix = (int)(((1000 * 100) / PixSzMM) + 0.5); int denom = 100 * 100; // Centimeters per 100 Meters; long [] rational = {numPix, denom}; TIFFField [] fields = { new TIFFField(TIFFImageDecoder.TIFF_RESOLUTION_UNIT, TIFFField.TIFF_SHORT, 1, new char [] { (char)3 }), new TIFFField(TIFFImageDecoder.TIFF_X_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }), new TIFFField(TIFFImageDecoder.TIFF_Y_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }) }; params.setExtraFields(fields); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); if ("packbits".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS); } else if ("deflate".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE); /* TODO: NPE occurs when used. } else if ("jpeg".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2); */ } else { //nop } } try { int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); OutputStream ostream = output.getOutputStream(); TIFFImageEncoder tiffEncoder = new TIFFImageEncoder(ostream, params); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); tiffEncoder.encode(rimg); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n = -1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img, 1<<n); } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); ImageWriterParams params = new ImageWriterParams(); /* NYI!!!!! PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); }*/ // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. /* NYI!!!!!! if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); }*/ float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); try { OutputStream ostream = output.getOutputStream(); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/tiff"); ImageWriterParams params = new ImageWriterParams(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); //Values set here as defined in TIFFImageWriteParam of JAI Image I/O Tools if ("packbits".equals(method)) { params.setCompressionMethod("PackBits"); } else if ("deflate".equals(method)) { params.setCompressionMethod("Deflate"); } else if ("lzw".equals(method)) { params.setCompressionMethod("LZW"); } else if ("jpeg".equals(method)) { params.setCompressionMethod("JPEG"); } else { //nop } } try { OutputStream ostream = output.getOutputStream(); int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); writer.writeImage(rimg, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n=-1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img,1<<n); } PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); } // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); } float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 1 Meter int numPix = (int)((1000/PixSzMM)+0.5); params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter' try { OutputStream ostream = output.getOutputStream(); PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params); pngEncoder.encode(img); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { super.transcode(document, uri, output); // We do this to hide 'ctx' from the SVGAbstractTranscoder // otherwise it will dispose of the context before we can // print the document. theCtx = ctx; ctx = null; }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Document document = null; String uri = input.getURI(); if (input.getDocument() != null) { document = input.getDocument(); } else { String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME); String namespaceURI = (String)hints.get(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI); String documentElement = (String)hints.get(KEY_DOCUMENT_ELEMENT); DOMImplementation domImpl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); if (parserClassname == null) { parserClassname = XMLResourceDescriptor.getXMLParserClassName(); } if (domImpl == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOM_IMPLEMENTATION")); return; } if (namespaceURI == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT_NAMESPACE_URI")); return; } if (documentElement == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT")); return; } // parse the XML document DocumentFactory f = createDocumentFactory(domImpl, parserClassname); boolean b = ((Boolean)hints.get(KEY_XML_PARSER_VALIDATING)).booleanValue(); f.setValidating(b); try { if (input.getInputStream() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getInputStream()); } else if (input.getReader() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getReader()); } else if (input.getXMLReader() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getXMLReader()); } else if (uri != null) { document = f.createDocument(namespaceURI, documentElement, uri); } } catch (DOMException ex) { handler.fatalError(new TranscoderException(ex)); } catch (IOException ex) { handler.fatalError(new TranscoderException(ex)); } } // call the dedicated transcode method if (document != null) { try { transcode(document, uri, output); } catch(TranscoderException ex) { // at this time, all TranscoderExceptions are fatal errors handler.fatalError(ex); return; } } }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void error(TranscoderException ex) throws TranscoderException { System.err.println("ERROR: "+ex.getMessage()); }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void fatalError(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void warning(TranscoderException ex) throws TranscoderException { System.err.println("WARNING: "+ex.getMessage()); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { super.transcode(input, output); if (ctx != null) ctx.dispose(); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { if ((document != null) && !(document.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); // impl = SVGDOMImplementation.getDOMImplementation(); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri); ((SVGOMDocument)document).setParsedURL(url); } } if (hints.containsKey(KEY_WIDTH)) width = ((Float)hints.get(KEY_WIDTH)).floatValue(); if (hints.containsKey(KEY_HEIGHT)) height = ((Float)hints.get(KEY_HEIGHT)).floatValue(); SVGOMDocument svgDoc = (SVGOMDocument)document; SVGSVGElement root = svgDoc.getRootElement(); ctx = createBridgeContext(svgDoc); // build the GVT tree builder = new GVTBuilder(); // flag that indicates if the document is dynamic boolean isDynamic = hints.containsKey(KEY_EXECUTE_ONLOAD) && ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue(); GraphicsNode gvtRoot; try { if (isDynamic) ctx.setDynamicState(BridgeContext.DYNAMIC); gvtRoot = builder.build(ctx, svgDoc); // dispatch an 'onload' event if needed if (ctx.isDynamic()) { BaseScriptingEnvironment se; se = new BaseScriptingEnvironment(ctx); se.loadScripts(); se.dispatchSVGLoadEvent(); if (hints.containsKey(KEY_SNAPSHOT_TIME)) { float t = ((Float) hints.get(KEY_SNAPSHOT_TIME)).floatValue(); ctx.getAnimationEngine().setCurrentTime(t); } else if (ctx.isSVG12()) { float t = SVGUtilities.convertSnapshotTime(root, null); ctx.getAnimationEngine().setCurrentTime(t); } } } catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); // compute the preserveAspectRatio matrix AffineTransform Px; // take the AOI into account if any if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); // transform the AOI into the image's coordinate system Px = new AffineTransform(); double sx = width / aoi.getWidth(); double sy = height / aoi.getHeight(); double scale = Math.min(sx,sy); Px.scale(scale, scale); double tx = -aoi.getX() + (width/scale - aoi.getWidth())/2; double ty = -aoi.getY() + (height/scale -aoi.getHeight())/2; Px.translate(tx, ty); // take the AOI transformation matrix into account // we apply first the preserveAspectRatio matrix curAOI = aoi; } else { String ref = new ParsedURL(uri).getRef(); // XXX Update this to use the animated value of 'viewBox' and // 'preserveAspectRatio'. String viewBox = root.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if ((ref != null) && (ref.length() != 0)) { Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else { // no viewBox has been specified, create a scale transform float xscale, yscale; xscale = width/docWidth; yscale = height/docHeight; float scale = Math.min(xscale,yscale); Px = AffineTransform.getScaleInstance(scale, scale); } curAOI = new Rectangle2D.Float(0, 0, width, height); } CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px); curTxf = new AffineTransform(); } else { curTxf = Px; } this.root = gvtRoot; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { // // Extract the input // DataInputStream is = getCompatibleInput(input); // // Build a RecordStore from the input // WMFRecordStore currentStore = new WMFRecordStore(); try { currentStore.read(is); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); return; } // determines the width and height of output image float wmfwidth; // width in pixels float wmfheight; // height in pixels float conv = 1.0f; // conversion factor if (hints.containsKey(KEY_INPUT_WIDTH)) { wmfwidth = ((Integer)hints.get(KEY_INPUT_WIDTH)).intValue(); wmfheight = ((Integer)hints.get(KEY_INPUT_HEIGHT)).intValue(); } else { wmfwidth = currentStore.getWidthPixels(); wmfheight = currentStore.getHeightPixels(); } float width = wmfwidth; float height = wmfheight; // change the output width and height if required if (hints.containsKey(KEY_WIDTH)) { width = ((Float)hints.get(KEY_WIDTH)).floatValue(); conv = width / wmfwidth; height = height * width / wmfwidth; } // determine the offset values int xOffset = 0; int yOffset = 0; if (hints.containsKey(KEY_XOFFSET)) { xOffset = ((Integer)hints.get(KEY_XOFFSET)).intValue(); } if (hints.containsKey(KEY_YOFFSET)) { yOffset = ((Integer)hints.get(KEY_YOFFSET)).intValue(); } // Set the size and viewBox on the output document float sizeFactor = currentStore.getUnitsToPixels() * conv; int vpX = (int)(currentStore.getVpX() * sizeFactor); int vpY = (int)(currentStore.getVpY() * sizeFactor); int vpW; int vpH; // if we took only a part of the image, we use its dimension for computing if (hints.containsKey(KEY_INPUT_WIDTH)) { vpW = (int)(((Integer)hints.get(KEY_INPUT_WIDTH)).intValue() * conv); vpH = (int)(((Integer)hints.get(KEY_INPUT_HEIGHT)).intValue() * conv); // else we took the whole image dimension } else { vpW = (int)(currentStore.getWidthUnits() * sizeFactor); vpH = (int)(currentStore.getHeightUnits() * sizeFactor); } // Build a painter for the RecordStore WMFPainter painter = new WMFPainter(currentStore, xOffset, yOffset, conv); // Use SVGGraphics2D to generate SVG content Document doc = this.createDocument(output); svgGenerator = new SVGGraphics2D(doc); /** set precision ** otherwise Ellipses aren't working (for example) (because of Decimal format * modifications ins SVGGenerator Context */ svgGenerator.getGeneratorContext().setPrecision(4); painter.paint(svgGenerator); svgGenerator.setSVGCanvasSize(new Dimension(vpW, vpH)); Element svgRoot = svgGenerator.getRoot(); svgRoot.setAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE, String.valueOf( vpX ) + ' ' + vpY + ' ' + vpW + ' ' + vpH ); // Now, write the SVG content to the output writeSVGToOutput(svgGenerator, svgRoot, output); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
private DataInputStream getCompatibleInput(TranscoderInput input) throws TranscoderException { // Cannot deal with null input if (input == null){ handler.fatalError(new TranscoderException( String.valueOf( ERROR_NULL_INPUT ) )); } // Can deal with InputStream InputStream in = input.getInputStream(); if (in != null){ return new DataInputStream(new BufferedInputStream(in)); } // Can deal with URI String uri = input.getURI(); if (uri != null){ try{ URL url = new URL(uri); in = url.openStream(); return new DataInputStream(new BufferedInputStream(in)); } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } handler.fatalError(new TranscoderException( String.valueOf( ERROR_INCOMPATIBLE_INPUT_TYPE ) )); return null; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public static void main(String[] args) throws TranscoderException { if(args.length < 1){ System.out.println("Usage : WMFTranscoder.main <file 1> ... <file n>"); System.exit(1); } WMFTranscoder transcoder = new WMFTranscoder(); int nFiles = args.length; for(int i=0; i<nFiles; i++){ String fileName = args[i]; if(!fileName.toLowerCase().endsWith(WMF_EXTENSION)){ System.err.println(args[i] + " does not have the " + WMF_EXTENSION + " extension. It is ignored"); } else{ System.out.print("Processing : " + args[i] + "..."); String outputFileName = fileName.substring(0, fileName.toLowerCase().indexOf(WMF_EXTENSION)) + SVG_EXTENSION; File inputFile = new File(fileName); File outputFile = new File(outputFileName); try { TranscoderInput input = new TranscoderInput(inputFile.toURL().toString()); TranscoderOutput output = new TranscoderOutput(new FileOutputStream(outputFile)); transcoder.transcode(input, output); }catch(MalformedURLException e){ throw new TranscoderException(e); }catch(IOException e){ throw new TranscoderException(e); } System.out.println(".... Done"); } } System.exit(0); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void error(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void fatalError(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void warning(TranscoderException ex) throws TranscoderException { // Do nothing }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new Error("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new Error("Writer expected"); } prettyPrint(r, w); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
protected void prettyPrint(Reader in, Writer out) throws TranscoderException { try { PrettyPrinter pp = new PrettyPrinter(); NewlineValue nlv = (NewlineValue)hints.get(KEY_NEWLINE); if (nlv != null) { pp.setNewline(nlv.getValue()); } Boolean b = (Boolean)hints.get(KEY_FORMAT); if (b != null) { pp.setFormat(b.booleanValue()); } Integer i = (Integer)hints.get(KEY_TABULATION_WIDTH); if (i != null) { pp.setTabulationWidth(i.intValue()); } i = (Integer)hints.get(KEY_DOCUMENT_WIDTH); if (i != null) { pp.setDocumentWidth(i.intValue()); } DoctypeValue dtv = (DoctypeValue)hints.get(KEY_DOCTYPE); if (dtv != null) { pp.setDoctypeOption(dtv.getValue()); } String s = (String)hints.get(KEY_PUBLIC_ID); if (s != null) { pp.setPublicId(s); } s = (String)hints.get(KEY_SYSTEM_ID); if (s != null) { pp.setSystemId(s); } s = (String)hints.get(KEY_XML_DECLARATION); if (s != null) { pp.setXMLDeclaration(s); } pp.print(in, out); out.flush(); } catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
public void print(Reader r, Writer w) throws TranscoderException, IOException { try { scanner = new XMLScanner(r); output = new OutputManager(this, w); writer = w; type = scanner.next(); printXMLDecl(); misc1: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc1; } } printDoctype(); misc2: for (;;) { scanner.clearBuffer(); switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc2; } } if (type != LexicalUnits.START_TAG) { throw fatalError("element", null); } printElement(); misc3: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc3; } } } catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected TranscoderException fatalError(String key, Object[] params) throws TranscoderException { TranscoderException result = new TranscoderException(key); errorHandler.fatalError(result); return result; }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
protected void writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output) throws TranscoderException { Document doc = output.getDocument(); if (doc != null) return; // XMLFilter XMLFilter xmlFilter = output.getXMLFilter(); if (xmlFilter != null) { handler.fatalError(new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE)); } try { boolean escaped = false; if (hints.containsKey(KEY_ESCAPED)) { escaped = ((Boolean)hints.get(KEY_ESCAPED)).booleanValue(); } // Output stream OutputStream os = output.getOutputStream(); if (os != null) { svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } // Writer Writer wr = output.getWriter(); if (wr != null) { svgGenerator.stream(svgRoot, wr, false, escaped); return; } // URI String uri = output.getURI(); if ( uri != null ){ try{ URL url = new URL(uri); URLConnection urlCnx = url.openConnection(); os = urlCnx.getOutputStream(); svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } } catch(IOException e){ throw new TranscoderException(e); } throw new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); // The outputstream wrapper protects the JPEG encoder from // exceptions due to stream closings. If it gets an exception // it nulls out the stream and just ignores any future calls. ostream = new OutputStreamWrapper(ostream); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("jpeg.badoutput", null)); } try { float quality; if (hints.containsKey(KEY_QUALITY)) { quality = ((Float)hints.get(KEY_QUALITY)).floatValue(); } else { TranscoderException te; te = new TranscoderException (Messages.formatMessage("jpeg.unspecifiedQuality", null)); handler.error(te); quality = 0.75f; } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(quality, true); float PixSzMM = userAgent.getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("png.badoutput", null)); } // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.png.PNGTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.PNGTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write PNG file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.tiff.TIFFTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.TIFFTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write TIFF file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { // Sets up root, curTxf & curAoi super.transcode(document, uri, output); // prepare the image to be painted int w = (int)(width+0.5); int h = (int)(height+0.5); // paint the SVG document using the bridge package // create the appropriate renderer ImageRenderer renderer = createRenderer(); renderer.updateOffScreen(w, h); // curTxf.translate(0.5, 0.5); renderer.setTransform(curTxf); renderer.setTree(this.root); this.root = null; // We're done with it... try { // now we are sure that the aoi is the image size Shape raoi = new Rectangle2D.Float(0, 0, width, height); // Warning: the renderer's AOI must be in user space renderer.repaint(curTxf.createInverse(). createTransformedShape(raoi)); BufferedImage rend = renderer.getOffScreen(); renderer = null; // We're done with it... BufferedImage dest = createImage(w, h); Graphics2D g2d = GraphicsUtil.createGraphics(dest); if (hints.containsKey(KEY_BACKGROUND_COLOR)) { Paint bgcolor = (Paint)hints.get(KEY_BACKGROUND_COLOR); g2d.setComposite(AlphaComposite.SrcOver); g2d.setPaint(bgcolor); g2d.fillRect(0, 0, w, h); } if (rend != null) { // might be null if the svg document is empty g2d.drawRenderedImage(rend, new AffineTransform()); } g2d.dispose(); rend = null; // We're done with it... writeImage(dest, output); } catch (Exception ex) { throw new TranscoderException(ex); } }
(Lib) EOFException 13
              
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b, int off, int len) throws IOException { int n = 0; do { int count = this.read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final boolean readBoolean() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (ch != 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final byte readByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 8) + (ch2 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch2 << 8) + (ch1 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readChar() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readCharLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readInt() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readIntLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedInt() throws IOException { long ch1 = this.read(); long ch2 = this.read(); long ch3 = this.read(); long ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
0 0
(Domain) InterpreterException 12
              
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(String script) { try { interpreter.eval(script, 0); } catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } return interpreter.getResult(); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(String script) { try { interpreter.exec(script); } catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } return null; }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final Reader scriptReader, final String description) throws IOException { ContextAction evaluateAction = new ContextAction() { public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } } }; try { return contextFactory.call(evaluateAction); } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (InterruptedBridgeException ibe) { throw ibe; } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final String scriptStr) { ContextAction evalAction = new ContextAction() { public Object run(final Context cx) { Script script = null; Entry entry = null; Iterator it = compiledScripts.iterator(); // between nlog(n) and log(n) because it is // an AbstractSequentialList while (it.hasNext()) { if ((entry = (Entry) it.next()).str.equals(scriptStr)) { // if it is not at the end, remove it because // it will change from place (it is faster // to remove it now) script = entry.script; it.remove(); break; } } if (script == null) { // this script has not been compiled yet or has been // forgotten since the compilation: // compile it and store it for future use. PrivilegedAction compile = new PrivilegedAction() { public Object run() { try { return cx.compileReader (new StringReader(scriptStr), SOURCE_NAME_SVG, 1, rhinoClassLoader); } catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); } } }; script = (Script)AccessController.doPrivileged(compile); if (compiledScripts.size() + 1 > MAX_CACHED_SCRIPTS) { // too many cached items - we should delete the // oldest entry. all of this is very fast on // linkedlist compiledScripts.removeFirst(); } // storing is done here: compiledScripts.addLast(new Entry(scriptStr, script)); } else { // this script has been compiled before, // just update its index so it won't get deleted soon. compiledScripts.addLast(entry); } return script.exec(cx, globalObject); } }; try { return contextFactory.call(evalAction); } catch (InterpreterException ie) { throw ie; } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
12
              
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
0
(Domain) SVGConverterException 12
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void execute() throws SVGConverterException { // Compute the set of SVGConverterSource from the source properties // (srcDir and srcFile); // This throws an exception if there is not at least one src file. List sources = computeSources(); // Compute the destination files from dest List dstFiles = null; if(sources.size() == 1 && dst != null && isFile(dst)){ dstFiles = new ArrayList(); dstFiles.add(dst); } else{ dstFiles = computeDstFiles(sources); } // Now, get the transcoder to use for the operation Transcoder transcoder = destinationType.getTranscoder(); if(transcoder == null) { throw new SVGConverterException(ERROR_CANNOT_ACCESS_TRANSCODER, new Object[]{destinationType.toString()}, true /* fatal error */); } // Now, compute the set of transcoding hints to use Map hints = computeTranscodingHints(); transcoder.setTranscodingHints(hints); // Notify listener that task has been computed if(!controller.proceedWithComputedTask(transcoder, hints, sources, dstFiles)){ return; } // Convert files one by one for(int i = 0 ; i < sources.size() ; i++) { // Get the file from the vector. SVGConverterSource currentFile = (SVGConverterSource)sources.get(i); File outputFile = (File)dstFiles.get(i); createOutputDir(outputFile); transcode(currentFile, outputFile, transcoder); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeDstFiles(List sources) throws SVGConverterException { List dstFiles = new ArrayList(); if (dst != null) { if (dst.exists() && dst.isFile()) { throw new SVGConverterException(ERROR_CANNOT_USE_DST_FILE); } // // Either dst exist and is a directory or dst does not // exist and we may fail later on in createOutputDir // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); // Generate output filename from input filename. File outputName = new File(dst.getPath(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } else { // // No destination directory has been specified. // Try and create files in the same directory as the // sources. This only work if sources are files. // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); if (!(src instanceof SVGConverterFileSource)) { throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION, new Object[]{src}); } // Generate output filename from input filename. SVGConverterFileSource fs = (SVGConverterFileSource)src; File outputName = new File(fs.getFile().getParent(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } return dstFiles; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeSources() throws SVGConverterException{ List sources = new ArrayList(); // Check that at least one source has been specified. if (this.sources == null){ throw new SVGConverterException(ERROR_NO_SOURCES_SPECIFIED); } int n = this.sources.size(); for (int i=0; i<n; i++){ String sourceString = (String)(this.sources.get(i)); File file = new File(sourceString); if (file.exists()) { sources.add(new SVGConverterFileSource(file)); } else { String[] fileNRef = getFileNRef(sourceString); file = new File(fileNRef[0]); if (file.exists()){ sources.add(new SVGConverterFileSource(file, fileNRef[1])); } else{ sources.add(new SVGConverterURLSource(sourceString)); } } } return sources; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void transcode(SVGConverterSource inputFile, File outputFile, Transcoder transcoder) throws SVGConverterException { TranscoderInput input = null; TranscoderOutput output = null; OutputStream outputStream = null; if (!controller.proceedWithSourceTranscoding(inputFile, outputFile)){ return; } try { if (inputFile.isSameAs(outputFile.getPath())) { throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION, true /* fatal error */); } // Compute transcoder input. if (!inputFile.isReadable()) { throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE, new Object[]{inputFile.getName()}); } try { InputStream in = inputFile.openStream(); in.close(); } catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); } input = new TranscoderInput(inputFile.getURI()); // Compute transcoder output. if (!isWriteable(outputFile)) { throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE, new Object[] {outputFile.getName()}); } try { outputStream = new FileOutputStream(outputFile); } catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); } output = new TranscoderOutput(outputStream); } catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } } // Transcode now boolean success = false; try { transcoder.transcode(input, output); success = true; } catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } } // Close streams and clean up. try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) { return; } if (success){ controller.onSourceTranscodingSuccess(inputFile, outputFile); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void createOutputDir(File output) throws SVGConverterException { File outputDir; // Output directory object. boolean success = true; // false if the output directory // doesn't exist and it can't be created // true otherwise // Create object from output directory. String parentDir = output.getParent(); if (parentDir != null){ outputDir = new File(output.getParent()); if ( ! outputDir.exists() ) { // Output directory doesn't exist, so create it. success = outputDir.mkdirs(); } else { if ( ! outputDir.isDirectory() ) { // File, which have a same name as the output directory, exists. // Create output directory. success = outputDir.mkdirs(); } } } if (!success) { throw new SVGConverterException(ERROR_UNABLE_TO_CREATE_OUTPUT_DIR); } }
3
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
6
              
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void execute() throws SVGConverterException { // Compute the set of SVGConverterSource from the source properties // (srcDir and srcFile); // This throws an exception if there is not at least one src file. List sources = computeSources(); // Compute the destination files from dest List dstFiles = null; if(sources.size() == 1 && dst != null && isFile(dst)){ dstFiles = new ArrayList(); dstFiles.add(dst); } else{ dstFiles = computeDstFiles(sources); } // Now, get the transcoder to use for the operation Transcoder transcoder = destinationType.getTranscoder(); if(transcoder == null) { throw new SVGConverterException(ERROR_CANNOT_ACCESS_TRANSCODER, new Object[]{destinationType.toString()}, true /* fatal error */); } // Now, compute the set of transcoding hints to use Map hints = computeTranscodingHints(); transcoder.setTranscodingHints(hints); // Notify listener that task has been computed if(!controller.proceedWithComputedTask(transcoder, hints, sources, dstFiles)){ return; } // Convert files one by one for(int i = 0 ; i < sources.size() ; i++) { // Get the file from the vector. SVGConverterSource currentFile = (SVGConverterSource)sources.get(i); File outputFile = (File)dstFiles.get(i); createOutputDir(outputFile); transcode(currentFile, outputFile, transcoder); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeDstFiles(List sources) throws SVGConverterException { List dstFiles = new ArrayList(); if (dst != null) { if (dst.exists() && dst.isFile()) { throw new SVGConverterException(ERROR_CANNOT_USE_DST_FILE); } // // Either dst exist and is a directory or dst does not // exist and we may fail later on in createOutputDir // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); // Generate output filename from input filename. File outputName = new File(dst.getPath(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } else { // // No destination directory has been specified. // Try and create files in the same directory as the // sources. This only work if sources are files. // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); if (!(src instanceof SVGConverterFileSource)) { throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION, new Object[]{src}); } // Generate output filename from input filename. SVGConverterFileSource fs = (SVGConverterFileSource)src; File outputName = new File(fs.getFile().getParent(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } return dstFiles; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeSources() throws SVGConverterException{ List sources = new ArrayList(); // Check that at least one source has been specified. if (this.sources == null){ throw new SVGConverterException(ERROR_NO_SOURCES_SPECIFIED); } int n = this.sources.size(); for (int i=0; i<n; i++){ String sourceString = (String)(this.sources.get(i)); File file = new File(sourceString); if (file.exists()) { sources.add(new SVGConverterFileSource(file)); } else { String[] fileNRef = getFileNRef(sourceString); file = new File(fileNRef[0]); if (file.exists()){ sources.add(new SVGConverterFileSource(file, fileNRef[1])); } else{ sources.add(new SVGConverterURLSource(sourceString)); } } } return sources; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void transcode(SVGConverterSource inputFile, File outputFile, Transcoder transcoder) throws SVGConverterException { TranscoderInput input = null; TranscoderOutput output = null; OutputStream outputStream = null; if (!controller.proceedWithSourceTranscoding(inputFile, outputFile)){ return; } try { if (inputFile.isSameAs(outputFile.getPath())) { throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION, true /* fatal error */); } // Compute transcoder input. if (!inputFile.isReadable()) { throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE, new Object[]{inputFile.getName()}); } try { InputStream in = inputFile.openStream(); in.close(); } catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); } input = new TranscoderInput(inputFile.getURI()); // Compute transcoder output. if (!isWriteable(outputFile)) { throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE, new Object[] {outputFile.getName()}); } try { outputStream = new FileOutputStream(outputFile); } catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); } output = new TranscoderOutput(outputStream); } catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } } // Transcode now boolean success = false; try { transcoder.transcode(input, output); success = true; } catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } } // Close streams and clean up. try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) { return; } if (success){ controller.onSourceTranscodingSuccess(inputFile, outputFile); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void createOutputDir(File output) throws SVGConverterException { File outputDir; // Output directory object. boolean success = true; // false if the output directory // doesn't exist and it can't be created // true otherwise // Create object from output directory. String parentDir = output.getParent(); if (parentDir != null){ outputDir = new File(output.getParent()); if ( ! outputDir.exists() ) { // Output directory doesn't exist, so create it. success = outputDir.mkdirs(); } else { if ( ! outputDir.isDirectory() ) { // File, which have a same name as the output directory, exists. // Create output directory. success = outputDir.mkdirs(); } } } if (!success) { throw new SVGConverterException(ERROR_UNABLE_TO_CREATE_OUTPUT_DIR); } }
(Domain) SVGGraphics2DIOException 9
              
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try{ OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); } finally { os.close(); } } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try { OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } finally { os.close(); } } catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Setup Base64Encoder stream to byte array. // ByteArrayOutputStream os = new ByteArrayOutputStream(); Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { // // Now, encode the input image to the base 64 stream. // encodeImage(image, b64Encoder); // Close the b64 encoder stream (terminates the b64 streams). b64Encoder.close(); } catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // // Finally, write out url // imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, DATA_PROTOCOL_PNG_PREFIX + os.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void encodeImage(RenderedImage buf, OutputStream os) throws SVGGraphics2DIOException { try{ ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
boolean imagesMatch(Object o1, Object o2) throws SVGGraphics2DIOException { boolean match = false; try { FileInputStream imageStream = new FileInputStream((File) o1); int imageLen = imageStream.available(); byte[] imageBytes = new byte[imageLen]; byte[] candidateBytes = ((ByteArrayOutputStream) o2).toByteArray(); int bytesRead = 0; while (bytesRead != imageLen) { bytesRead += imageStream.read (imageBytes, bytesRead, imageLen-bytesRead); } match = Arrays.equals(imageBytes, candidateBytes); } catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); } return match; }
// in sources/org/apache/batik/svggen/ImageCacher.java
ImageCacheEntry createEntry(int checksum, Object data, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // Create a new file in image directory File imageFile = null; try { // While the files we are generating exist, try to create // another unique id. while (imageFile == null) { String fileId = ctx.idGenerator.generateID(prefix); imageFile = new File(imageDir, fileId + suffix); if (imageFile.exists()) imageFile = null; } // Write data to file OutputStream outputStream = new FileOutputStream(imageFile); ((ByteArrayOutputStream) data).writeTo(outputStream); ((ByteArrayOutputStream) data).close(); } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } // Create new cache entry return new ImageCacheEntry(checksum, imageFile, imageFile.getName()); // <<<<<<<<<< error ?? }
9
              
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
38
              
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try{ OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); } finally { os.close(); } } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/DefaultErrorHandler.java
public void handleError(SVGGraphics2DIOException ex) throws SVGGraphics2DIOException { throw ex; }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try { OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } finally { os.close(); } } catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = buf.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); } RenderedImage r = image.createDefaultRendering(); if (r == null) { handleEmptyImage(imageElement); } else { handleHREF(r, imageElement, generatorContext); } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Setup Base64Encoder stream to byte array. // ByteArrayOutputStream os = new ByteArrayOutputStream(); Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { // // Now, encode the input image to the base 64 stream. // encodeImage(image, b64Encoder); // Close the b64 encoder stream (terminates the b64 streams). b64Encoder.close(); } catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // // Finally, write out url // imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, DATA_PROTOCOL_PNG_PREFIX + os.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void encodeImage(RenderedImage buf, OutputStream os) throws SVGGraphics2DIOException { try{ ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(String svgFileName) throws SVGGraphics2DIOException { stream(svgFileName, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(String svgFileName, boolean useCss) throws SVGGraphics2DIOException { try { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(svgFileName), DEFAULT_XML_ENCODING); stream(writer, useCss); writer.flush(); writer.close(); } catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; } catch (IOException e) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(e)); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer) throws SVGGraphics2DIOException { stream(writer, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer, boolean useCss, boolean escaped) throws SVGGraphics2DIOException { Element svgRoot = getRoot(); stream(svgRoot, writer, useCss, escaped); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer, boolean useCss) throws SVGGraphics2DIOException { Element svgRoot = getRoot(); stream(svgRoot, writer, useCss, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Element svgRoot, Writer writer) throws SVGGraphics2DIOException { stream(svgRoot, writer, false, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Element svgRoot, Writer writer, boolean useCss, boolean escaped) throws SVGGraphics2DIOException { Node rootParent = svgRoot.getParentNode(); Node nextSibling = svgRoot.getNextSibling(); try { // // Enforce that the default and xlink namespace // declarations appear on the root element // svgRoot.setAttributeNS(XMLNS_NAMESPACE_URI, XMLNS_PREFIX, SVG_NAMESPACE_URI); svgRoot.setAttributeNS(XMLNS_NAMESPACE_URI, XMLNS_PREFIX + ":" + XLINK_PREFIX, XLINK_NAMESPACE_URI); DocumentFragment svgDocument = svgRoot.getOwnerDocument().createDocumentFragment(); svgDocument.appendChild(svgRoot); if (useCss) SVGCSSStyler.style(svgDocument); XmlWriter.writeXml(svgDocument, writer, escaped); writer.flush(); } catch (SVGGraphics2DIOException e) { // this catch prevents from catching an SVGGraphics2DIOException // and wrapping it again in another SVGGraphics2DIOException // as would do the second catch (XmlWriter throws SVGGraphics2DIO // Exception but flush throws IOException) generatorCtx.errorHandler. handleError(e); } catch (IOException io) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(io)); } finally { // Restore the svgRoot to its original tree position if (rootParent != null) { if (nextSibling == null) { rootParent.appendChild(svgRoot); } else { rootParent.insertBefore(svgRoot, nextSibling); } } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = buildBufferedImage(new Dimension(width, height)); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Create an buffered image if necessary // BufferedImage buf = null; if (image instanceof BufferedImage && ((BufferedImage)image).getType() == getBufferedImageType()){ buf = (BufferedImage)image; } else { Dimension size = new Dimension(image.getWidth(), image.getHeight()); buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderedImage(image, IDENTITY); g.dispose(); } // // Cache image and set xlink:href // cacheBufferedImage(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension((int)Math.ceil(image.getWidth()), (int)Math.ceil(image.getHeight())); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderableImage(image, IDENTITY); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { out.write (TAG_START, 0, 1); // "<" out.write (element.getTagName()); NamedNodeMap attributes = element.getAttributes(); if (attributes != null){ int nAttr = attributes.getLength(); for(int i=0; i<nAttr; i++){ Attr attr = (Attr)attributes.item(i); out.write(' '); writeXml(attr, out, escaped); } } boolean lastElem = (element.getParentNode().getLastChild()==element); // // Write empty nodes as "<EMPTY />" to make sure version 3 // and 4 web browsers can read empty tag output as HTML. // XML allows "<EMPTY/>" too, of course. // if (!element.hasChildNodes()) { if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write(TAG_END, 0, 2); // "/>" return; } Node child = element.getFirstChild(); out.printIndent (); out.write(TAG_END, 1, 1); // ">" if ((child.getNodeType() != Node.TEXT_NODE) || (element.getLastChild() != child)) { // one text node child.. out.setIndentLevel(out.getIndentLevel()+2); } writeChildrenXml(element, out, escaped); out.write (TAG_START, 0, 2); // "</" out.write (element.getTagName()); if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write (TAG_END, 1, 1); // ">" }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { Node child = element.getFirstChild(); while (child != null) { writeXml(child, out, escaped); child = child.getNextSibling(); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Document document, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { writeDocumentHeader(out); NodeList childList = document.getChildNodes(); writeXml(childList, out, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(NodeList childList, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { int length = childList.getLength (); if (length == 0) return; for (int i = 0; i < length; i++) { Node child = childList.item(i); writeXml(child, out, escaped); out.write (EOL); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
public String lookup(ByteArrayOutputStream os, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // We determine a checksum value for the byte data, and use it // as hash key for the image. This may not be unique, so we // need to check on actual byte-for-byte equality as well. // The checksum will be sufficient in most cases. int checksum = getChecksum(os.toByteArray()); Integer key = new Integer(checksum); String href = null; Object data = getCacheableData(os); LinkedList list = (LinkedList) imageCache.get(key); if(list == null) { // Key not found: make a new key/value pair list = new LinkedList(); imageCache.put(key, list); } else { // Key found: check if the image is already in the list for(ListIterator i = list.listIterator(0); i.hasNext(); ) { ImageCacheEntry entry = (ImageCacheEntry) i.next(); if(entry.checksum == checksum && imagesMatch(entry.src, data)) { href = entry.href; break; } } } if(href == null) { // Still no hit: add our own ImageCacheEntry newEntry = createEntry(checksum, data, width, height, ctx); list.add(newEntry); href = newEntry.href; } return href; }
// in sources/org/apache/batik/svggen/ImageCacher.java
boolean imagesMatch(Object o1, Object o2) throws SVGGraphics2DIOException { boolean match = false; try { FileInputStream imageStream = new FileInputStream((File) o1); int imageLen = imageStream.available(); byte[] imageBytes = new byte[imageLen]; byte[] candidateBytes = ((ByteArrayOutputStream) o2).toByteArray(); int bytesRead = 0; while (bytesRead != imageLen) { bytesRead += imageStream.read (imageBytes, bytesRead, imageLen-bytesRead); } match = Arrays.equals(imageBytes, candidateBytes); } catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); } return match; }
// in sources/org/apache/batik/svggen/ImageCacher.java
ImageCacheEntry createEntry(int checksum, Object data, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // Create a new file in image directory File imageFile = null; try { // While the files we are generating exist, try to create // another unique id. while (imageFile == null) { String fileId = ctx.idGenerator.generateID(prefix); imageFile = new File(imageDir, fileId + suffix); if (imageFile.exists()) imageFile = null; } // Write data to file OutputStream outputStream = new FileOutputStream(imageFile); ((ByteArrayOutputStream) data).writeTo(outputStream); ((ByteArrayOutputStream) data).close(); } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } // Create new cache entry return new ImageCacheEntry(checksum, imageFile, imageFile.getName()); // <<<<<<<<<< error ?? }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension(image.getWidth(null), image.getHeight(null)); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension(image.getWidth(), image.getHeight()); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderedImage(image, IDENTITY); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension((int)Math.ceil(image.getWidth()), (int)Math.ceil(image.getHeight())); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderableImage(image, IDENTITY); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
private void saveBufferedImageToFile(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); // Create a new file in image directory File imageFile = null; // While the files we are generating exist, try to create another // id that is unique. while (imageFile == null) { String fileId = generatorContext.idGenerator.generateID(getPrefix()); imageFile = new File(imageDir, fileId + getSuffix()); if (imageFile.exists()) imageFile = null; } // Encode image here encodeImage(buf, imageFile); // Update HREF imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, urlRoot + "/" + imageFile.getName()); }
(Lib) NullPointerException 8
              
// in sources/org/apache/batik/svggen/SVGCustomComposite.java
public SVGCompositeDescriptor toSVG(Composite composite) { if (composite == null) throw new NullPointerException(); SVGCompositeDescriptor compositeDesc = (SVGCompositeDescriptor)descMap.get(composite); if (compositeDesc == null) { // First time this composite is used. Request handler // to do the convertion SVGCompositeDescriptor desc = generatorContext. extensionHandler.handleComposite(composite, generatorContext); if (desc != null) { Element def = desc.getDef(); if(def != null) defSet.add(def); descMap.put(composite, desc); } } return compositeDesc; }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
public BufferedImage filter(BufferedImage src, BufferedImage dest){ if (src == null) throw new NullPointerException("Source image should not be null"); BufferedImage origSrc = src; BufferedImage finalDest = dest; if (!isCompatible(src.getColorModel(), src.getSampleModel())) { src = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE); GraphicsUtil.copyData(origSrc, src); } else if (!src.isAlphaPremultiplied()) { // Get a Premultipled CM. ColorModel srcCM, srcCMPre; srcCM = src.getColorModel(); srcCMPre = GraphicsUtil.coerceColorModel(srcCM, true); src = new BufferedImage(srcCMPre, src.getRaster(), true, null); GraphicsUtil.copyData(origSrc, src); } if (dest == null) { dest = createCompatibleDestImage(src, null); finalDest = dest; } else if (!isCompatible(dest.getColorModel(), dest.getSampleModel())) { dest = createCompatibleDestImage(src, null); } else if (!dest.isAlphaPremultiplied()) { // Get a Premultipled CM. ColorModel dstCM, dstCMPre; dstCM = dest.getColorModel(); dstCMPre = GraphicsUtil.coerceColorModel(dstCM, true); dest = new BufferedImage(dstCMPre, finalDest.getRaster(), true, null); } filter(src.getRaster(), dest.getRaster()); // Check to see if we need to 'fix' our source (divide out alpha). if ((src.getRaster() == origSrc.getRaster()) && (src.isAlphaPremultiplied() != origSrc.isAlphaPremultiplied())) { // Copy our source back the way it was... GraphicsUtil.copyData(src, origSrc); } // Check to see if we need to store our result... if ((dest.getRaster() != finalDest.getRaster()) || (dest.isAlphaPremultiplied() != finalDest.isAlphaPremultiplied())){ // Coerce our source back the way it was requested... GraphicsUtil.copyData(dest, finalDest); } return finalDest; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public URL getPolicyURL() { ClassLoader cl = appMainClass.getClassLoader(); URL policyURL = cl.getResource(securityPolicy); if (policyURL == null) { throw new NullPointerException (Messages.formatMessage(EXCEPTION_NO_POLICY_FILE, new Object[]{securityPolicy})); } return policyURL; }
0 0
(Domain) ResourceFormatException 7
              
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
1
              
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
23
              
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
(Lib) NoSuchElementException 6
              
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public Object next() { if (idx >= size) throw new NoSuchElementException("No Next Element"); forward = true; removeOk = true; return rects[idx++]; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public Object previous() { if (idx <= 0) throw new NoSuchElementException("No Previous Element"); forward = false; removeOk = true; return rects[--idx]; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object next() { try { Object next = get(cursor); checkForComodification(); lastRet = cursor++; return next; } catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object previous() { try { Object previous = get(--cursor); checkForComodification(); lastRet = cursor; return previous; } catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); } }
// in sources/org/apache/batik/util/DoublyIndexedTable.java
public Object next() { if (finished) { throw new NoSuchElementException(); } Entry ret = nextEntry; findNext(); return ret; }
// in sources/org/apache/batik/util/RunnableQueue.java
public Object next() { if (head == null || head == link) { throw new NoSuchElementException(); } if (link == null) { link = (Link)head.getNext(); return head.runnable; } Object result = link.runnable; link = (Link)link.getNext(); return result; }
2
              
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
0
(Lib) ClassCastException 4
              
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public int getAsInt(int index) { switch (type) { case TIFF_BYTE: case TIFF_UNDEFINED: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public long getAsLong(int index) { switch (type) { case TIFF_BYTE: case TIFF_UNDEFINED: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public float getAsFloat(int index) { switch (type) { case TIFF_BYTE: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; case TIFF_FLOAT: return ((float[])data)[index]; case TIFF_DOUBLE: return (float)((double[])data)[index]; case TIFF_SRATIONAL: int[] ivalue = getAsSRational(index); return (float)((double)ivalue[0]/ivalue[1]); case TIFF_RATIONAL: long[] lvalue = getAsRational(index); return (float)((double)lvalue[0]/lvalue[1]); default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public double getAsDouble(int index) { switch (type) { case TIFF_BYTE: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; case TIFF_FLOAT: return ((float[])data)[index]; case TIFF_DOUBLE: return ((double[])data)[index]; case TIFF_SRATIONAL: int[] ivalue = getAsSRational(index); return (double)ivalue[0]/ivalue[1]; case TIFF_RATIONAL: long[] lvalue = getAsRational(index); return (double)lvalue[0]/lvalue[1]; default: throw new ClassCastException(); } }
0 0
(Lib) ConcurrentModificationException 4
              
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void remove() { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.remove(lastRet); if (lastRet < cursor) { cursor--; } lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
final void checkForComodification() { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void set(Object o) { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.set(lastRet, o); expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(Object o) { checkForComodification(); try { CompositeGraphicsNode.this.add(cursor++, o); lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
3
              
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
0
(Lib) MissingResourceException 4
              
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public String getString(String key) throws MissingResourceException { setUsedLocale(); for (int i=0; hasNextResourceBundle(i); i++) { ResourceBundle rb = getResourceBundle(i); if (rb == null) continue; try { String ret = rb.getString(key); if (ret != null) return ret; } catch (MissingResourceException mre) { } } String classStr = (cls != null)?cls.toString():bundleName; throw new MissingResourceException("Unable to find resource: " + key, classStr, key); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getInteger(String key) throws MissingResourceException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); } }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getCharacter(String key) throws MissingResourceException { String s = getString(key); if(s == null || s.length() == 0){ throw new MissingResourceException ("Malformed character", bundleName, key); } return s.charAt(0); }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
protected static synchronized Properties getParserProps() { if (parserProps != null) return parserProps; parserProps = new Properties(); try { Class cls = XMLResourceDescriptor.class; InputStream is = cls.getResourceAsStream(RESOURCES); parserProps.load(is); } catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); } return parserProps; }
2
              
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
64
              
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static int getCharacter(String key) throws MissingResourceException { return resourceManager.getCharacter(key); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
public static String get(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/svggen/font/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static String getString(String key) throws MissingResourceException { return localizableSupport.getString(key); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static int getInteger(String key) throws MissingResourceException { return localizableSupport.getInteger(key); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static int getCharacter(String key) throws MissingResourceException { return localizableSupport.getCharacter(key); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Messages.java
public static String getString(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/xml/XMLScanner.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/parser/AbstractParser.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/transcoder/image/resources/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/AbstractDOMImplementation.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { try { return super.formatMessage(key, args); } catch (MissingResourceException e) { return localizableSupport.formatMessage(key, args); } }
// in sources/org/apache/batik/swing/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/swing/svg/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public String getString(String key) throws MissingResourceException { setUsedLocale(); for (int i=0; hasNextResourceBundle(i); i++) { ResourceBundle rb = getResourceBundle(i); if (rb == null) continue; try { String ret = rb.getString(key); if (ret != null) return ret; } catch (MissingResourceException mre) { } } String classStr = (cls != null)?cls.toString():bundleName; throw new MissingResourceException("Unable to find resource: " + key, classStr, key); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getInteger(String key) throws MissingResourceException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); } }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getCharacter(String key) throws MissingResourceException { String s = getString(key); if(s == null || s.length() == 0){ throw new MissingResourceException ("Malformed character", bundleName, key); } return s.charAt(0); }
// in sources/org/apache/batik/bridge/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/bridge/Messages.java
public static String getMessage(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/Messages.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/util/Messages.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/util/Messages.java
public static int getCharacter(String key) throws MissingResourceException { return resourceManager.getCharacter(key); }
// in sources/org/apache/batik/util/io/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/resources/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public String getString(String key) throws MissingResourceException { return bundle.getString(key); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key) throws MissingResourceException { return getStringList(key, " \t\n\r\f", false); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key, String delim) throws MissingResourceException { return getStringList(key, delim, false); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key, String delim, boolean returnDelims) throws MissingResourceException { List result = new ArrayList(); StringTokenizer st = new StringTokenizer(getString(key), delim, returnDelims); while (st.hasMoreTokens()) { result.add(st.nextToken()); } return result; }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
// in sources/org/apache/batik/css/parser/Parser.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/css/engine/value/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/css/engine/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
(Domain) XMLException 4
              
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
4
              
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
41
              
// in sources/org/apache/batik/xml/XMLScanner.java
public int next() throws XMLException { return next(context); }
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDocumentStart() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.S; case '<': switch (nextChar()) { case '?': int c1 = nextChar(); if (c1 == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)c1)) { throw createXMLException("invalid.pi.target"); } context = PI_CONTEXT; int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if (c1 == 'x' && c2 == 'm' && c3 == 'l') { context = XML_DECL_CONTEXT; return LexicalUnits.XML_DECL_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.doctype"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: if (depth == 0) { throw createXMLException("invalid.character"); } else { return nextInContent(); } } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInTopLevel() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.character"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInPI() throws IOException, XMLException { if (piEndRead) { piEndRead = false; context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.PI_END; } switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '?': if (nextChar() != '>') { throw createXMLException("pi.end.expected"); } nextChar(); if (inDTD) { context = DTD_DECLARATIONS_CONTEXT; } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } return LexicalUnits.PI_END; default: do { do { nextChar(); } while (current != -1 && current != '?'); nextChar(); } while (current != -1 && current != '>'); nextChar(); piEndRead = true; return LexicalUnits.PI_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInStartTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '/': if (nextChar() != '>') { throw createXMLException("malformed.tag.end"); } nextChar(); context = (--depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.EMPTY_ELEMENT_END; case '>': nextChar(); context = CONTENT_CONTEXT; return LexicalUnits.END_CHAR; case '=': nextChar(); return LexicalUnits.EQ; case '"': attrDelimiter = '"'; nextChar(); for (;;) { switch (current) { case '"': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } case '\'': attrDelimiter = '\''; nextChar(); for (;;) { switch (current) { case '\'': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttributeValue() throws IOException, XMLException { if (current == -1) { return LexicalUnits.EOF; } if (current == '&') { return readReference(); } else { loop: for (;;) { switch (current) { case '&': case '<': case -1: break loop; case '"': case '\'': if (current == attrDelimiter) { break loop; } } nextChar(); } switch (current) { case -1: break; case '<': throw createXMLException("invalid.character"); case '&': return LexicalUnits.ATTRIBUTE_FRAGMENT; case '\'': case '"': nextChar(); if (inDTD) { context = ATTLIST_CONTEXT; } else { context = START_TAG_CONTEXT; } } return LexicalUnits.LAST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInContent() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier("CDATA[", LexicalUnits.CDATA_START, -1); default: throw createXMLException("invalid.character"); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEndTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': if (--depth < 0) { throw createXMLException("unexpected.end.tag"); } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } nextChar(); return LexicalUnits.END_CHAR; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInCDATASection() throws IOException, XMLException { if (cdataEndRead) { cdataEndRead = false; context = CONTENT_CONTEXT; return LexicalUnits.SECTION_END; } while (current != -1) { while (current != ']' && current != -1) { nextChar(); } if (current != -1) { nextChar(); if (current == ']') { nextChar(); if (current == '>') { break; } } } } if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); cdataEndRead = true; return LexicalUnits.CHARACTER_DATA; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInXMLDecl() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case 'v': return readIdentifier("ersion", LexicalUnits.VERSION_IDENTIFIER, -1); case 'e': return readIdentifier("ncoding", LexicalUnits.ENCODING_IDENTIFIER, -1); case 's': return readIdentifier("tandalone", LexicalUnits.STANDALONE_IDENTIFIER, -1); case '=': nextChar(); return LexicalUnits.EQ; case '?': nextChar(); if (current != '>') { throw createXMLException("pi.end.expected"); } nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.PI_END; case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDoctype() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.END_CHAR; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); case '[': nextChar(); context = DTD_DECLARATIONS_CONTEXT; inDTD = true; return LexicalUnits.LSQUARE_BRACKET; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDTDDeclarations() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case ']': nextChar(); context = DOCTYPE_CONTEXT; inDTD = false; return LexicalUnits.RSQUARE_BRACKET; case '%': return readPEReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'E': switch (nextChar()) { case 'L': context = ELEMENT_DECLARATION_CONTEXT; return readIdentifier ("EMENT", LexicalUnits.ELEMENT_DECLARATION_START, -1); case 'N': context = ENTITY_CONTEXT; return readIdentifier("TITY", LexicalUnits.ENTITY_START, -1); default: throw createXMLException("invalid.character"); } case 'A': context = ATTLIST_CONTEXT; return readIdentifier("TTLIST", LexicalUnits.ATTLIST_START, -1); case 'N': context = NOTATION_CONTEXT; return readIdentifier("OTATION", LexicalUnits.NOTATION_START, -1); default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readString() throws IOException, XMLException { do { nextChar(); } while (current != -1 && current != attrDelimiter); if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readComment() throws IOException, XMLException { if (nextChar() != '-') { throw createXMLException("malformed.comment"); } int c = nextChar(); while (c != -1) { while (c != -1 && c != '-') { c = nextChar(); } c = nextChar(); if (c == '-') { break; } } if (c == -1) { throw createXMLException("unexpected.eof"); } c = nextChar(); if (c != '>') { throw createXMLException("malformed.comment"); } nextChar(); return LexicalUnits.COMMENT; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readIdentifier(String s, int type, int ntype) throws IOException, XMLException { int len = s.length(); for (int i = 0; i < len; i++) { nextChar(); if (current != s.charAt(i)) { if (ntype == -1) { throw createXMLException("invalid.character"); } else { while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return ntype; } } } nextChar(); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readName(int type) throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.name"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPIStart() throws IOException, XMLException { int c1 = nextChar(); if (c1 == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("malformed.pi.target"); } int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInElementDeclaration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'E': return readIdentifier("MPTY", LexicalUnits.EMPTY_IDENTIFIER, LexicalUnits.NAME); case 'A': return readIdentifier("NY", LexicalUnits.ANY_IDENTIFIER, LexicalUnits.NAME); case '?': nextChar(); return LexicalUnits.QUESTION; case '+': nextChar(); return LexicalUnits.PLUS; case '*': nextChar(); return LexicalUnits.STAR; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); return LexicalUnits.RIGHT_BRACE; case '|': nextChar(); return LexicalUnits.PIPE; case ',': nextChar(); return LexicalUnits.COMMA; case '#': return readIdentifier("PCDATA", LexicalUnits.PCDATA_IDENTIFIER, -1); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttList() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return type = LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'C': return readIdentifier("DATA", LexicalUnits.CDATA_IDENTIFIER, LexicalUnits.NAME); case 'I': nextChar(); if (current != 'D') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ID_IDENTIFIER; } if (current != 'R') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'F') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREF_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREFS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; case 'N': switch (nextChar()) { default: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'O': context = NOTATION_TYPE_CONTEXT; return readIdentifier("TATION", LexicalUnits.NOTATION_IDENTIFIER, LexicalUnits.NAME); case 'M': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'O') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'K') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKEN_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKENS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case 'E': nextChar(); if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'I') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } switch (current) { case 'Y': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ENTITY_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'I': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } return LexicalUnits.ENTITIES_IDENTIFIER; default: if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&') { do { nextChar(); } while (current != -1 && current != '"' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '"': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '#': switch (nextChar()) { case 'R': return readIdentifier("EQUIRED", LexicalUnits.REQUIRED_IDENTIFIER, -1); case 'I': return readIdentifier("MPLIED", LexicalUnits.IMPLIED_IDENTIFIER, -1); case 'F': return readIdentifier("IXED", LexicalUnits.FIXED_IDENTIFIER, -1); default: throw createXMLException("invalid.character"); } case '(': nextChar(); context = ENUMERATION_CONTEXT; return LexicalUnits.LEFT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotation() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntity() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); return LexicalUnits.PERCENT; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case 'N': return readIdentifier("DATA", LexicalUnits.NDATA_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '"' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '"': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '\'': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntityValue() throws IOException, XMLException { switch (current) { case '&': return readReference(); case '%': int t = nextChar(); readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return t; default: while (current != -1 && current != attrDelimiter && current != '&' && current != '%') { nextChar(); } switch (current) { case -1: throw createXMLException("unexpected.eof"); case '\'': case '"': nextChar(); context = ENTITY_CONTEXT; return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotationType() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEnumeration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readNmtoken(); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readReference() throws IOException, XMLException { nextChar(); if (current == '#') { nextChar(); int i = 0; switch (current) { case 'x': do { i++; nextChar(); } while ((current >= '0' && current <= '9') || (current >= 'a' && current <= 'f') || (current >= 'A' && current <= 'F')); break; default: do { i++; nextChar(); } while (current >= '0' && current <= '9'); break; case -1: throw createXMLException("unexpected.eof"); } if (i == 1 || current != ';') { throw createXMLException("character.reference"); } nextChar(); return LexicalUnits.CHARACTER_REFERENCE; } else { int t = readName(LexicalUnits.ENTITY_REFERENCE); if (current != ';') { throw createXMLException("character.reference"); } nextChar(); return t; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPEReference() throws IOException, XMLException { nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.parameter.entity"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return LexicalUnits.PARAMETER_ENTITY_REFERENCE; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readNmtoken() throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } while (XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return LexicalUnits.NMTOKEN; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
(Domain) InterruptedBridgeException 3
              
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl) { Rectangle2D bounds = getImageBounds(ctx, e); if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) { ShapeNode sn = new ShapeNode(); sn.setShape(bounds); return sn; } SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); String docURL = svgDoc.getURL(); ParsedURL pDocURL = null; if (docURL != null) pDocURL = new ParsedURL(docURL); UserAgent userAgent = ctx.getUserAgent(); try { userAgent.checkLoadExternalResource(purl, pDocURL); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } DocumentLoader loader = ctx.getDocumentLoader(); ImageTagRegistry reg = ImageTagRegistry.getRegistry(); ICCColorSpaceExt colorspace = extractColorSpace(e, ctx); { /** * Before we open the URL we see if we have the * URL already cached and parsed */ try { /* Check the document loader cache */ Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } } catch (BridgeException ex) { throw ex; } catch (Exception ex) { /* Nothing to do */ } /* Check the ImageTagRegistry Cache */ Filter img = reg.checkCache(purl, colorspace); if (img != null) { return createRasterImageNode(ctx, e, img, purl); } } /* The Protected Stream ensures that the stream doesn't * get closed unless we want it to. It is also based on * a Buffered Reader so in general we can mark the start * and reset rather than reopening the stream. Finally * it hides the mark/reset methods so only we get to * use them. */ ProtectedStream reference = null; try { reference = openStream(e, purl); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); } { /** * First see if we can id the file as a Raster via magic * number. This is probably the fastest mechanism. * We tell the registry what the source purl is but we * tell it not to open that url. */ Filter img = reg.readURL(reference, purl, colorspace, false, false); if (img != null) { try { reference.tie(); } catch (IOException ioe) { // This would be from a close, Let it slide... } // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } try { // Reset the stream for next try. reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { /** * Next see if it's an XML document. */ Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } catch (BridgeException ex) { reference.release(); throw ex; } catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); } catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; } catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); } try { reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { // Finally try to load the image as a raster image (JPG or // PNG) allowing the registry to open the url (so the // JDK readers can be checked). Filter img = reg.readURL(reference, purl, colorspace, true, true); if (img != null) { // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } finally { reference.release(); } return null; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Node getReferencedNode(Element e, String uri) { try { SVGDocument document = (SVGDocument)e.getOwnerDocument(); URIResolver ur = createURIResolver(document, documentLoader); Node ref = ur.getNode(uri, e); if (ref == null) { throw new BridgeException(this, e, ERR_URI_BAD_TARGET, new Object[] {uri}); } else { SVGOMDocument refDoc = (SVGOMDocument) (ref.getNodeType() == Node.DOCUMENT_NODE ? ref : ref.getOwnerDocument()); // This is new rather than attaching this BridgeContext // with the new document we now create a whole new // BridgeContext to go with the new document. // This means that the new document has it's own // world of stuff and it should avoid memory leaks // since the new document isn't 'tied into' this // bridge context. if (refDoc != document) { createSubBridgeContext(refDoc); } return ref; } } catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); } catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); } catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); } catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); } }
// in sources/org/apache/batik/bridge/GVTBuilder.java
protected void buildGraphicsNode(BridgeContext ctx, Element e, CompositeGraphicsNode parentNode) { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new InterruptedBridgeException(); } // get the appropriate bridge according to the specified element Bridge bridge = ctx.getBridge(e); if (bridge instanceof GenericBridge) { // If it is a GenericBridge just handle it and any GenericBridge // descendents and return. ((GenericBridge) bridge).handleElement(ctx, e); handleGenericBridges(ctx, e); return; } else if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) { handleGenericBridges(ctx, e); return; } // check the display property if (!CSSUtilities.convertDisplay(e)) { handleGenericBridges(ctx, e); return; } GraphicsNodeBridge gnBridge = (GraphicsNodeBridge)bridge; try { // create the associated graphics node GraphicsNode gn = gnBridge.createGraphicsNode(ctx, e); if (gn != null) { // attach the graphics node to the GVT tree now ! parentNode.getChildren().add(gn); // check if the element has children to build if (gnBridge.isComposite()) { buildComposite(ctx, e, (CompositeGraphicsNode)gn); } else { // if not then still handle the GenericBridges handleGenericBridges(ctx, e); } gnBridge.buildGraphicsNode(ctx, e, gn); } else { handleGenericBridges(ctx, e); } } catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; } }
2
              
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
0
(Domain) MissingListenerException 3
              
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public Action getAction(String key) throws MissingListenerException { Action result = (Action)listeners.get(key); //if (result == null) { //result = canvas.getAction(key); //} if (result == null) { throw new MissingListenerException("Can't find action.", RESOURCES, key); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
0 34
              
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action) listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action) listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public Action getAction(String key) throws MissingListenerException { Action result = (Action)listeners.get(key); //if (result == null) { //result = canvas.getAction(key); //} if (result == null) { throw new MissingListenerException("Can't find action.", RESOURCES, key); } return result; }
// in sources/org/apache/batik/apps/svgbrowser/FindDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/UserStyleDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/URIChooser.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/JErrorPane.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/MemoryMonitor.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
(Lib) SAXException 3
              
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public InputSource resolveEntity(String publicId, String systemId) throws SAXException { try { synchronized (LOCK) { // Bootstrap if needed - move to a static block??? if (dtdProps == null) { dtdProps = new Properties(); try { Class cls = SAXSVGDocumentFactory.class; InputStream is = cls.getResourceAsStream ("resources/dtdids.properties"); dtdProps.load(is); } catch (IOException ioe) { throw new SAXException(ioe); } } if (dtdids == null) dtdids = dtdProps.getProperty(KEY_PUBLIC_IDS); if (skippable_dtdids == null) skippable_dtdids = dtdProps.getProperty(KEY_SKIPPABLE_PUBLIC_IDS); if (skip_dtd == null) skip_dtd = dtdProps.getProperty(KEY_SKIP_DTD); } if (publicId == null) return null; // Let SAX Parser find it. if (!isValidating && (skippable_dtdids.indexOf(publicId) != -1)) { // We are not validating and this is a DTD we can // safely skip so do it... Here we provide just enough // of the DTD to keep stuff running (set svg and // xlink namespaces). return new InputSource(new StringReader(skip_dtd)); } if (dtdids.indexOf(publicId) != -1) { String localSystemId = dtdProps.getProperty(KEY_SYSTEM_ID + publicId.replace(' ', '_')); if (localSystemId != null && !"".equals(localSystemId)) { return new InputSource (getClass().getResource(localSystemId).toString()); } } } catch (MissingResourceException e) { throw new SAXException(e); } // Let the SAX parser find the entity. return null; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new SAXException(new InterruptedIOException()); } if (inProlog) { inProlog = false; if (parser != null) { try { isStandalone = parser.getFeature ("http://xml.org/sax/features/is-standalone"); } catch (SAXNotRecognizedException ex) { } try { xmlVersion = (String) parser.getProperty ("http://xml.org/sax/properties/document-xml-version"); } catch (SAXNotRecognizedException ex) { } } } // Namespaces resolution int len = attributes.getLength(); namespaces.push(); String version = null; for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); int slen = aname.length(); if (slen < 5) continue; if (aname.equals("version")) { version = attributes.getValue(i); continue; } if (!aname.startsWith("xmlns")) continue; if (slen == 5) { String ns = attributes.getValue(i); if (ns.length() == 0) ns = null; namespaces.put("", ns); } else if (aname.charAt(5) == ':') { String ns = attributes.getValue(i); if (ns.length() == 0) { ns = null; } namespaces.put(aname.substring(6), ns); } } // Add any collected String Data before element. appendStringData(); // Element creation Element e; int idx = rawName.indexOf(':'); String nsp = (idx == -1 || idx == rawName.length()-1) ? "" : rawName.substring(0, idx); String nsURI = namespaces.get(nsp); if (currentNode == null) { implementation = getDOMImplementation(version); document = implementation.createDocument(nsURI, rawName, doctype); Iterator i = preInfo.iterator(); currentNode = e = document.getDocumentElement(); while (i.hasNext()) { PreInfo pi = (PreInfo)i.next(); Node n = pi.createNode(document); document.insertBefore(n, e); } preInfo = null; } else { e = document.createElementNS(nsURI, rawName); currentNode.appendChild(e); currentNode = e; } // Storage of the line number. if (createDocumentDescriptor && locator != null) { documentDescriptor.setLocation(e, locator.getLineNumber(), locator.getColumnNumber()); } // Attributes creation for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); if (aname.equals("xmlns")) { e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, aname, attributes.getValue(i)); } else { idx = aname.indexOf(':'); nsURI = (idx == -1) ? null : namespaces.get(aname.substring(0, idx)); e.setAttributeNS(nsURI, aname, attributes.getValue(i)); } } }
2
              
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
21
              
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
private Element parseXml(String xmlString) { Document doc = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { javax.xml.parsers.DocumentBuilder parser = factory .newDocumentBuilder(); parser.setErrorHandler(new ErrorHandler() { public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { } public void warning(SAXParseException exception) throws SAXException { } }); doc = parser.parse(new InputSource(new StringReader(xmlString))); } catch (ParserConfigurationException e1) { } catch (SAXException e1) { } catch (IOException e1) { } if (doc != null) { return doc.getDocumentElement(); } return null; }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void error(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void fatalError(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void warning(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public void startDocument() throws SAXException { super.startDocument(); // Do not assume namespace declarations when no DTD has been specified. // namespaces.put("", SVGDOMImplementation.SVG_NAMESPACE_URI); // namespaces.put("xlink", XLinkSupport.XLINK_NAMESPACE_URI); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public InputSource resolveEntity(String publicId, String systemId) throws SAXException { try { synchronized (LOCK) { // Bootstrap if needed - move to a static block??? if (dtdProps == null) { dtdProps = new Properties(); try { Class cls = SAXSVGDocumentFactory.class; InputStream is = cls.getResourceAsStream ("resources/dtdids.properties"); dtdProps.load(is); } catch (IOException ioe) { throw new SAXException(ioe); } } if (dtdids == null) dtdids = dtdProps.getProperty(KEY_PUBLIC_IDS); if (skippable_dtdids == null) skippable_dtdids = dtdProps.getProperty(KEY_SKIPPABLE_PUBLIC_IDS); if (skip_dtd == null) skip_dtd = dtdProps.getProperty(KEY_SKIP_DTD); } if (publicId == null) return null; // Let SAX Parser find it. if (!isValidating && (skippable_dtdids.indexOf(publicId) != -1)) { // We are not validating and this is a DTD we can // safely skip so do it... Here we provide just enough // of the DTD to keep stuff running (set svg and // xlink namespaces). return new InputSource(new StringReader(skip_dtd)); } if (dtdids.indexOf(publicId) != -1) { String localSystemId = dtdProps.getProperty(KEY_SYSTEM_ID + publicId.replace(' ', '_')); if (localSystemId != null && !"".equals(localSystemId)) { return new InputSource (getClass().getResource(localSystemId).toString()); } } } catch (MissingResourceException e) { throw new SAXException(e); } // Let the SAX parser find the entity. return null; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void fatalError(SAXParseException ex) throws SAXException { throw ex; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void error(SAXParseException ex) throws SAXException { throw ex; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void warning(SAXParseException ex) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startDocument() throws SAXException { preInfo = new LinkedList(); namespaces = new HashTableStack(); namespaces.put("xml", XMLSupport.XML_NAMESPACE_URI); namespaces.put("xmlns", XMLSupport.XMLNS_NAMESPACE_URI); namespaces.put("", null); inDTD = false; inCDATA = false; inProlog = true; currentNode = null; document = null; doctype = null; isStandalone = false; xmlVersion = XMLConstants.XML_VERSION_10; stringBuffer.setLength(0); stringContent = false; if (createDocumentDescriptor) { documentDescriptor = new DocumentDescriptor(); } else { documentDescriptor = null; } }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new SAXException(new InterruptedIOException()); } if (inProlog) { inProlog = false; if (parser != null) { try { isStandalone = parser.getFeature ("http://xml.org/sax/features/is-standalone"); } catch (SAXNotRecognizedException ex) { } try { xmlVersion = (String) parser.getProperty ("http://xml.org/sax/properties/document-xml-version"); } catch (SAXNotRecognizedException ex) { } } } // Namespaces resolution int len = attributes.getLength(); namespaces.push(); String version = null; for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); int slen = aname.length(); if (slen < 5) continue; if (aname.equals("version")) { version = attributes.getValue(i); continue; } if (!aname.startsWith("xmlns")) continue; if (slen == 5) { String ns = attributes.getValue(i); if (ns.length() == 0) ns = null; namespaces.put("", ns); } else if (aname.charAt(5) == ':') { String ns = attributes.getValue(i); if (ns.length() == 0) { ns = null; } namespaces.put(aname.substring(6), ns); } } // Add any collected String Data before element. appendStringData(); // Element creation Element e; int idx = rawName.indexOf(':'); String nsp = (idx == -1 || idx == rawName.length()-1) ? "" : rawName.substring(0, idx); String nsURI = namespaces.get(nsp); if (currentNode == null) { implementation = getDOMImplementation(version); document = implementation.createDocument(nsURI, rawName, doctype); Iterator i = preInfo.iterator(); currentNode = e = document.getDocumentElement(); while (i.hasNext()) { PreInfo pi = (PreInfo)i.next(); Node n = pi.createNode(document); document.insertBefore(n, e); } preInfo = null; } else { e = document.createElementNS(nsURI, rawName); currentNode.appendChild(e); currentNode = e; } // Storage of the line number. if (createDocumentDescriptor && locator != null) { documentDescriptor.setLocation(e, locator.getLineNumber(), locator.getColumnNumber()); } // Attributes creation for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); if (aname.equals("xmlns")) { e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, aname, attributes.getValue(i)); } else { idx = aname.indexOf(':'); nsURI = (idx == -1) ? null : namespaces.get(aname.substring(0, idx)); e.setAttributeNS(nsURI, aname, attributes.getValue(i)); } } }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endElement(String uri, String localName, String rawName) throws SAXException { appendStringData(); // add string data if any. if (currentNode != null) currentNode = currentNode.getParentNode(); namespaces.pop(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void characters(char[] ch, int start, int length) throws SAXException { stringBuffer.append(ch, start, length); stringContent = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { stringBuffer.append(ch, start, length); stringContent = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void processingInstruction(String target, String data) throws SAXException { if (inDTD) return; appendStringData(); // Add any collected String Data before PI if (currentNode == null) preInfo.add(new ProcessingInstructionInfo(target, data)); else currentNode.appendChild (document.createProcessingInstruction(target, data)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startDTD(String name, String publicId, String systemId) throws SAXException { appendStringData(); // Add collected string data before entering DTD doctype = implementation.createDocumentType(name, publicId, systemId); inDTD = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endDTD() throws SAXException { inDTD = false; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startEntity(String name) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endEntity(String name) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startCDATA() throws SAXException { appendStringData(); // Add any collected String Data before CData inCDATA = true; stringContent = true; // always create CDATA even if empty. }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endCDATA() throws SAXException { appendStringData(); // Add the CDATA section inCDATA = false; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void comment(char[] ch, int start, int length) throws SAXException { if (inDTD) return; appendStringData(); String str = new String(ch, start, length); if (currentNode == null) { preInfo.add(new CommentInfo(str)); } else { currentNode.appendChild(document.createComment(str)); } }
(Domain) SAXIOException 2
              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, XMLReader r) throws IOException { r.setContentHandler(this); r.setDTDHandler(this); r.setEntityResolver(this); try { r.parse(uri); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
2
              
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
0
(Domain) SVGOMException 2
              
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public SVGMatrix inverse() throws SVGException { try { return new SVGOMMatrix(getAffineTransform().createInverse()); } catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public SVGMatrix rotateFromVector(float x, float y) throws SVGException { if (x == 0 || y == 0) { throw new SVGOMException(SVGException.SVG_INVALID_VALUE_ERR, ""); } AffineTransform tr = (AffineTransform)getAffineTransform().clone(); tr.rotate(Math.atan2(y, x)); return new SVGOMMatrix(tr); }
1
              
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
0
(Lib) SecurityException 2
              
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
public GeneratedClassLoader createClassLoader (final ClassLoader parentLoader, Object securityDomain) { if (securityDomain instanceof RhinoClassLoader) { return (RhinoClassLoader)securityDomain; } // FIXX: This should be supported by intersecting perms. // Calling var script = Script(source); script(); is not supported throw new SecurityException("Script() objects are not supported"); }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public void enforceSecurity(boolean enforce){ SecurityManager sm = System.getSecurityManager(); if (sm != null && sm != lastSecurityManagerInstalled) { // Throw a Security exception: we do not want to override // an 'alien' SecurityManager with either null or // a new SecurityManager. throw new SecurityException (Messages.getString(EXCEPTION_ALIEN_SECURITY_MANAGER)); } if (enforce) { // We first set the security manager to null to // force reloading of the policy file in case there // has been a change since it was last enforced (this // may happen with dynamically generated policy files). System.setSecurityManager(null); installSecurityManager(); } else { if (sm != null) { System.setSecurityManager(null); lastSecurityManagerInstalled = null; } } }
0 12
              
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadScript(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL) throws SecurityException { if (EventQueue.isDispatchThread()) { userAgent.checkLoadScript(scriptType, scriptPURL, docPURL); } else { final String st = scriptType; final ParsedURL sPURL= scriptPURL; final ParsedURL dPURL= docPURL; class Query implements Runnable { SecurityException se = null; public void run() { try { userAgent.checkLoadScript(st, sPURL, dPURL); } catch (SecurityException se) { this.se = se; } } } Query q = new Query(); invokeAndWait(q); if (q.se != null) { q.se.fillInStackTrace(); throw q.se; } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { if (EventQueue.isDispatchThread()) { userAgent.checkLoadExternalResource(resourceURL, docURL); } else { final ParsedURL rPURL= resourceURL; final ParsedURL dPURL= docURL; class Query implements Runnable { SecurityException se; public void run() { try { userAgent.checkLoadExternalResource(rPURL, dPURL); } catch (SecurityException se) { this.se = se; } } } Query q = new Query(); invokeAndWait(q); if (q.se != null) { q.se.fillInStackTrace(); throw q.se; } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { if (svgUserAgent != null) { svgUserAgent.checkLoadScript(scriptType, scriptURL, docURL); } else { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { if (svgUserAgent != null) { svgUserAgent.checkLoadExternalResource(resourceURL, docURL); } else { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/bridge/URIResolver.java
public Node getNode(String uri, Element ref) throws MalformedURLException, IOException, SecurityException { String baseURI = getRefererBaseURI(ref); // System.err.println("baseURI: " + baseURI); // System.err.println("URI: " + uri); if (baseURI == null && uri.charAt(0) == '#') { return getNodeByFragment(uri.substring(1), ref); } ParsedURL purl = new ParsedURL(baseURI, uri); // System.err.println("PURL: " + purl); if (documentURI == null) documentURI = document.getURL(); String frag = purl.getRef(); if ((frag != null) && (documentURI != null)) { ParsedURL pDocURL = new ParsedURL(documentURI); // System.out.println("doc: " + pDocURL); // System.out.println("Purl: " + purl); if (pDocURL.sameFile(purl)) { // System.out.println("match"); return document.getElementById(frag); } } // uri is not a reference into this document, so load the // document it does reference after doing a security // check with the UserAgent ParsedURL pDocURL = null; if (documentURI != null) { pDocURL = new ParsedURL(documentURI); } UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); String purlStr = purl.toString(); if (frag != null) { purlStr = purlStr.substring(0, purlStr.length()-(frag.length()+1)); } Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag); return doc; }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/bridge/BridgeContext.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { userAgent.checkLoadExternalResource(resourceURL, docURL); }
(Lib) WrappedException 2
              
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
public Object callWithDomain(Object securityDomain, final Context cx, final Callable callable, final Scriptable scope, final Scriptable thisObj, final Object[] args) { AccessControlContext acc; if (securityDomain instanceof AccessControlContext) acc = (AccessControlContext)securityDomain; else { RhinoClassLoader loader = (RhinoClassLoader)securityDomain; acc = loader.rhinoAccessControlContext; } PrivilegedExceptionAction execAction = new PrivilegedExceptionAction() { public Object run() { return callable.call(cx, scope, thisObj, args); } }; try { return AccessController.doPrivileged(execAction, acc); } catch (Exception e) { throw new WrappedException(e); } }
2
              
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
0
(Lib) Exception 1
              
// in sources/org/apache/batik/svggen/font/SVGFont.java
protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii) throws Exception { // StringBuffer sb = new StringBuffer(); // int horiz_advance_x = font.getHmtxTable().getAdvanceWidth( // font.getHheaTable().getNumberOfHMetrics() - 1); int horiz_advance_x = font.getOS2Table().getAvgCharWidth(); ps.print(XML_OPEN_TAG_START); ps.print(SVG_FONT_TAG); ps.print(XML_SPACE); // ps.print("<font "); if (id != null) { ps.print(SVG_ID_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("id=\""); ps.print(id); ps.print(XML_CHAR_QUOT); ps.print(XML_SPACE); // ps.print("\" "); } ps.print(SVG_HORIZ_ADV_X_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("horiz-adv-x=\""); ps.print(horiz_advance_x); ps.print(XML_CHAR_QUOT); ps.print(XML_OPEN_TAG_END_CHILDREN); // ps.println("\">"); ps.print(getSVGFontFaceElement(font)); // Decide upon a cmap table to use for our character to glyph look-up CmapFormat cmapFmt = null; if (forceAscii) { // We've been asked to use the ASCII/Macintosh cmap format cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMacintosh, Table.encodingRoman ); } else { // The default behaviour is to use the Unicode cmap encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUGL ); if (cmapFmt == null) { // This might be a symbol font, so we'll look for an "undefined" encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUndefined ); } } if (cmapFmt == null) { throw new Exception("Cannot find a suitable cmap table"); } // If this font includes arabic script, we want to specify // substitutions for initial, medial, terminal & isolated // cases. GsubTable gsub = (GsubTable) font.getTable(Table.GSUB); SingleSubst initialSubst = null; SingleSubst medialSubst = null; SingleSubst terminalSubst = null; if (gsub != null) { Script s = gsub.getScriptList().findScript(SCRIPT_TAG_ARAB); if (s != null) { LangSys ls = s.getDefaultLangSys(); if (ls != null) { Feature init = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_INIT); Feature medi = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_MEDI); Feature fina = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_FINA); if (init != null) { initialSubst = (SingleSubst) gsub.getLookupList().getLookup(init, 0).getSubtable(0); } if (medi != null) { medialSubst = (SingleSubst) gsub.getLookupList().getLookup(medi, 0).getSubtable(0); } if (fina != null) { terminalSubst = (SingleSubst) gsub.getLookupList().getLookup(fina, 0).getSubtable(0); } } } } // Include the missing glyph ps.println(getGlyphAsSVG(font, font.getGlyph(0), 0, horiz_advance_x, initialSubst, medialSubst, terminalSubst, "")); try { if (first == -1) { if (!autoRange) first = DEFAULT_FIRST; else first = cmapFmt.getFirst(); } if (last == -1) { if (!autoRange) last = DEFAULT_LAST; else last = cmapFmt.getLast(); } // Include our requested range Set glyphSet = new HashSet(); for (int i = first; i <= last; i++) { int glyphIndex = cmapFmt.mapCharCode(i); // ps.println(String.valueOf(i) + " -> " + String.valueOf(glyphIndex)); // if (font.getGlyphs()[glyphIndex] != null) // sb.append(font.getGlyphs()[glyphIndex].toString() + "\n"); if (glyphIndex > 0) { // add glyph ID to set so we can filter later glyphSet.add(glyphIndex); ps.println(getGlyphAsSVG( font, font.getGlyph(glyphIndex), glyphIndex, horiz_advance_x, initialSubst, medialSubst, terminalSubst, (32 <= i && i <= 127) ? encodeEntities( String.valueOf( (char)i ) ) : XML_CHAR_REF_PREFIX + Integer.toHexString(i) + XML_CHAR_REF_SUFFIX)); } } // Output kerning pairs from the requested range KernTable kern = (KernTable) font.getTable(Table.kern); if (kern != null) { KernSubtable kst = kern.getSubtable(0); PostTable post = (PostTable) font.getTable(Table.post); for (int i = 0; i < kst.getKerningPairCount(); i++) { KerningPair kpair = kst.getKerningPair(i); // check if left and right are both in our glyph set if (glyphSet.contains(kpair.getLeft()) && glyphSet.contains(kpair.getRight())) { ps.println(getKerningPairAsSVG(kpair, post)); } } } } catch (Exception e) { System.err.println(e.getMessage()); } ps.print(XML_CLOSE_TAG_START); ps.print(SVG_FONT_TAG); ps.println(XML_CLOSE_TAG_END); // ps.println("</font>"); }
0 5
              
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
public void handle(ParsedURL purl, JSVGViewerFrame svgViewerFrame) throws Exception { String uri = purl.toString(); TransformerFactory tFactory = TransformerFactory.newInstance(); // First, load the input XML document into a generic DOM tree DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document inDoc = db.parse(uri); // Now, look for <?xml-stylesheet ...?> processing instructions String xslStyleSheetURI = extractXSLProcessingInstruction(inDoc); if (xslStyleSheetURI == null) { // Assume that the input file is a literal result template xslStyleSheetURI = uri; } ParsedURL parsedXSLStyleSheetURI = new ParsedURL(uri, xslStyleSheetURI); Transformer transformer = tFactory.newTransformer (new StreamSource(parsedXSLStyleSheetURI.toString())); // Set the URIResolver to properly handle document() and xsl:include transformer.setURIResolver (new DocumentURIResolver(parsedXSLStyleSheetURI.toString())); // Now, apply the transformation to the input document. // // <!> Due to issues with namespaces, the transform creates the // result in a stream which is parsed. This is sub-optimal // but this was the only solution found to be able to // generate content in the proper namespaces. // // SVGOMDocument outDoc = // (SVGOMDocument)impl.createDocument(svgNS, "svg", null); // outDoc.setURLObject(new URL(uri)); // transformer.transform // (new DOMSource(inDoc), // new DOMResult(outDoc.getDocumentElement())); // StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); transformer.transform(new DOMSource(inDoc), result); sw.flush(); sw.close(); String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; try { outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); } // Patch the result tree to go under the root node // checkAndPatch(outDoc); svgViewerFrame.getJSVGCanvas().setSVGDocument(outDoc); svgViewerFrame.setSVGDocument(outDoc, uri, outDoc.getTitle()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii) throws Exception { // StringBuffer sb = new StringBuffer(); // int horiz_advance_x = font.getHmtxTable().getAdvanceWidth( // font.getHheaTable().getNumberOfHMetrics() - 1); int horiz_advance_x = font.getOS2Table().getAvgCharWidth(); ps.print(XML_OPEN_TAG_START); ps.print(SVG_FONT_TAG); ps.print(XML_SPACE); // ps.print("<font "); if (id != null) { ps.print(SVG_ID_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("id=\""); ps.print(id); ps.print(XML_CHAR_QUOT); ps.print(XML_SPACE); // ps.print("\" "); } ps.print(SVG_HORIZ_ADV_X_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("horiz-adv-x=\""); ps.print(horiz_advance_x); ps.print(XML_CHAR_QUOT); ps.print(XML_OPEN_TAG_END_CHILDREN); // ps.println("\">"); ps.print(getSVGFontFaceElement(font)); // Decide upon a cmap table to use for our character to glyph look-up CmapFormat cmapFmt = null; if (forceAscii) { // We've been asked to use the ASCII/Macintosh cmap format cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMacintosh, Table.encodingRoman ); } else { // The default behaviour is to use the Unicode cmap encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUGL ); if (cmapFmt == null) { // This might be a symbol font, so we'll look for an "undefined" encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUndefined ); } } if (cmapFmt == null) { throw new Exception("Cannot find a suitable cmap table"); } // If this font includes arabic script, we want to specify // substitutions for initial, medial, terminal & isolated // cases. GsubTable gsub = (GsubTable) font.getTable(Table.GSUB); SingleSubst initialSubst = null; SingleSubst medialSubst = null; SingleSubst terminalSubst = null; if (gsub != null) { Script s = gsub.getScriptList().findScript(SCRIPT_TAG_ARAB); if (s != null) { LangSys ls = s.getDefaultLangSys(); if (ls != null) { Feature init = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_INIT); Feature medi = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_MEDI); Feature fina = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_FINA); if (init != null) { initialSubst = (SingleSubst) gsub.getLookupList().getLookup(init, 0).getSubtable(0); } if (medi != null) { medialSubst = (SingleSubst) gsub.getLookupList().getLookup(medi, 0).getSubtable(0); } if (fina != null) { terminalSubst = (SingleSubst) gsub.getLookupList().getLookup(fina, 0).getSubtable(0); } } } } // Include the missing glyph ps.println(getGlyphAsSVG(font, font.getGlyph(0), 0, horiz_advance_x, initialSubst, medialSubst, terminalSubst, "")); try { if (first == -1) { if (!autoRange) first = DEFAULT_FIRST; else first = cmapFmt.getFirst(); } if (last == -1) { if (!autoRange) last = DEFAULT_LAST; else last = cmapFmt.getLast(); } // Include our requested range Set glyphSet = new HashSet(); for (int i = first; i <= last; i++) { int glyphIndex = cmapFmt.mapCharCode(i); // ps.println(String.valueOf(i) + " -> " + String.valueOf(glyphIndex)); // if (font.getGlyphs()[glyphIndex] != null) // sb.append(font.getGlyphs()[glyphIndex].toString() + "\n"); if (glyphIndex > 0) { // add glyph ID to set so we can filter later glyphSet.add(glyphIndex); ps.println(getGlyphAsSVG( font, font.getGlyph(glyphIndex), glyphIndex, horiz_advance_x, initialSubst, medialSubst, terminalSubst, (32 <= i && i <= 127) ? encodeEntities( String.valueOf( (char)i ) ) : XML_CHAR_REF_PREFIX + Integer.toHexString(i) + XML_CHAR_REF_SUFFIX)); } } // Output kerning pairs from the requested range KernTable kern = (KernTable) font.getTable(Table.kern); if (kern != null) { KernSubtable kst = kern.getSubtable(0); PostTable post = (PostTable) font.getTable(Table.post); for (int i = 0; i < kst.getKerningPairCount(); i++) { KerningPair kpair = kst.getKerningPair(i); // check if left and right are both in our glyph set if (glyphSet.contains(kpair.getLeft()) && glyphSet.contains(kpair.getRight())) { ps.println(getKerningPairAsSVG(kpair, post)); } } } } catch (Exception e) { System.err.println(e.getMessage()); } ps.print(XML_CLOSE_TAG_START); ps.print(SVG_FONT_TAG); ps.println(XML_CLOSE_TAG_END); // ps.println("</font>"); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_IEND_chunk(PNGChunk chunk) throws Exception { // Store text strings int textLen = textKeys.size(); String[] textArray = new String[2*textLen]; for (int i = 0; i < textLen; i++) { String key = (String)textKeys.get(i); String val = (String)textStrings.get(i); textArray[2*i] = key; textArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "text_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setText(textArray); } // Store compressed text strings int ztextLen = ztextKeys.size(); String[] ztextArray = new String[2*ztextLen]; for (int i = 0; i < ztextLen; i++) { String key = (String)ztextKeys.get(i); String val = (String)ztextStrings.get(i); ztextArray[2*i] = key; ztextArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "ztext_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setCompressedText(ztextArray); } // Parse prior IDAT chunks InputStream seqStream = new SequenceInputStream( Collections.enumeration( streamVec ) ); InputStream infStream = new InflaterInputStream(seqStream, new Inflater()); dataStream = new DataInputStream(infStream); // Create an empty WritableRaster int depth = bitDepth; if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && output8BitGray) { depth = 8; } if ((colorType == PNG_COLOR_PALETTE) && expandPalette) { depth = 8; } int bytesPerRow = (outputBands*width*depth + 7)/8; int scanlineStride = (depth == 16) ? (bytesPerRow/2) : bytesPerRow; theTile = createRaster(width, height, outputBands, scanlineStride, depth); if (performGammaCorrection && (gammaLut == null)) { initGammaLut(bitDepth); } if ((postProcess == POST_GRAY_LUT) || (postProcess == POST_GRAY_LUT_ADD_TRANS) || (postProcess == POST_GRAY_LUT_ADD_TRANS_EXP)) { initGrayLut(bitDepth); } decodeImage(interlaceMethod == 1); sampleModel = theTile.getSampleModel(); if ((colorType == PNG_COLOR_PALETTE) && !expandPalette) { if (outputHasAlphaPalette) { colorModel = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette, alphaPalette); } else { colorModel = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette); } } else if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && !output8BitGray) { byte[] palette = expandBits[bitDepth]; colorModel = new IndexColorModel(bitDepth, palette.length, palette, palette, palette); } else { colorModel = createComponentColorModel(sampleModel); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_IEND_chunk(PNGChunk chunk) throws Exception { // Store text strings int textLen = textKeys.size(); String[] textArray = new String[2*textLen]; for (int i = 0; i < textLen; i++) { String key = (String)textKeys.get(i); String val = (String)textStrings.get(i); textArray[2*i] = key; textArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "text_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setText(textArray); } // Store compressed text strings int ztextLen = ztextKeys.size(); String[] ztextArray = new String[2*ztextLen]; for (int i = 0; i < ztextLen; i++) { String key = (String)ztextKeys.get(i); String val = (String)ztextStrings.get(i); ztextArray[2*i] = key; ztextArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "ztext_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setCompressedText(ztextArray); } // Parse prior IDAT chunks InputStream seqStream = new SequenceInputStream( Collections.enumeration( streamVec )); InputStream infStream = new InflaterInputStream(seqStream, new Inflater()); dataStream = new DataInputStream(infStream); // Create an empty WritableRaster int depth = bitDepth; if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && output8BitGray) { depth = 8; } if ((colorType == PNG_COLOR_PALETTE) && expandPalette) { depth = 8; } int width = bounds.width; int height = bounds.height; int bytesPerRow = (outputBands*width*depth + 7)/8; int scanlineStride = (depth == 16) ? (bytesPerRow/2) : bytesPerRow; theTile = createRaster(width, height, outputBands, scanlineStride, depth); if (performGammaCorrection && (gammaLut == null)) { initGammaLut(bitDepth); } if ((postProcess == POST_GRAY_LUT) || (postProcess == POST_GRAY_LUT_ADD_TRANS) || (postProcess == POST_GRAY_LUT_ADD_TRANS_EXP)) { initGrayLut(bitDepth); } decodeImage(interlaceMethod == 1); // Free resources associated with compressed data. dataStream.close(); infStream.close(); seqStream.close(); streamVec = null; SampleModel sm = theTile.getSampleModel(); ColorModel cm; if ((colorType == PNG_COLOR_PALETTE) && !expandPalette) { if (outputHasAlphaPalette) { cm = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette, alphaPalette); } else { cm = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette); } } else if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && !output8BitGray) { byte[] palette = expandBits[bitDepth]; cm = new IndexColorModel(bitDepth, palette.length, palette, palette, palette); } else { cm = createComponentColorModel(sm); } init((CachableRed)null, bounds, cm, sm, 0, 0, properties); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
public static void main(String[] args) throws Exception{ if(args.length < 1){ System.err.println(USAGE); System.exit(0); } // // Builds a PrintTranscoder // PrintTranscoder transcoder = new PrintTranscoder(); // // Set the hints, from the command line arguments // // Language setTranscoderFloatHint(transcoder, KEY_LANGUAGE_STR, KEY_LANGUAGE); // User stylesheet setTranscoderFloatHint(transcoder, KEY_USER_STYLESHEET_URI_STR, KEY_USER_STYLESHEET_URI); // XML parser setTranscoderStringHint(transcoder, KEY_XML_PARSER_CLASSNAME_STR, KEY_XML_PARSER_CLASSNAME); // Scale to page setTranscoderBooleanHint(transcoder, KEY_SCALE_TO_PAGE_STR, KEY_SCALE_TO_PAGE); // AOI setTranscoderRectangleHint(transcoder, KEY_AOI_STR, KEY_AOI); // Image size setTranscoderFloatHint(transcoder, KEY_WIDTH_STR, KEY_WIDTH); setTranscoderFloatHint(transcoder, KEY_HEIGHT_STR, KEY_HEIGHT); // Pixel to millimeter setTranscoderFloatHint(transcoder, KEY_PIXEL_TO_MM_STR, KEY_PIXEL_UNIT_TO_MILLIMETER); // Page orientation setTranscoderStringHint(transcoder, KEY_PAGE_ORIENTATION_STR, KEY_PAGE_ORIENTATION); // Page size setTranscoderFloatHint(transcoder, KEY_PAGE_WIDTH_STR, KEY_PAGE_WIDTH); setTranscoderFloatHint(transcoder, KEY_PAGE_HEIGHT_STR, KEY_PAGE_HEIGHT); // Margins setTranscoderFloatHint(transcoder, KEY_MARGIN_TOP_STR, KEY_MARGIN_TOP); setTranscoderFloatHint(transcoder, KEY_MARGIN_RIGHT_STR, KEY_MARGIN_RIGHT); setTranscoderFloatHint(transcoder, KEY_MARGIN_BOTTOM_STR, KEY_MARGIN_BOTTOM); setTranscoderFloatHint(transcoder, KEY_MARGIN_LEFT_STR, KEY_MARGIN_LEFT); // Dialog options setTranscoderBooleanHint(transcoder, KEY_SHOW_PAGE_DIALOG_STR, KEY_SHOW_PAGE_DIALOG); setTranscoderBooleanHint(transcoder, KEY_SHOW_PRINTER_DIALOG_STR, KEY_SHOW_PRINTER_DIALOG); // // First, request the transcoder to transcode // each of the input files // for(int i=0; i<args.length; i++){ transcoder.transcode(new TranscoderInput(new File(args[i]).toURL().toString()), null); } // // Now, print... // transcoder.print(); System.exit(0); }
(Lib) InternalError 1
              
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public String getUri() { switch (getPaintType()) { case SVG_PAINTTYPE_URI: return valueProvider.getValue().getStringValue(); case SVG_PAINTTYPE_URI_NONE: case SVG_PAINTTYPE_URI_CURRENTCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: return valueProvider.getValue().item(0).getStringValue(); } throw new InternalError(); }
0 0
(Lib) StreamCorruptedException 1
              
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
boolean isMatch(InputStream is) throws StreamCorruptedException { int idx = 0; is.mark(getReadlimit()); try { // Skip to the offset location. while (idx < offset) { int rn = (int)is.skip(offset-idx); if (rn == -1) { return false; } idx += rn; } idx = 0; while (idx < buffer.length) { int rn = is.read(buffer, idx, buffer.length-idx); if (rn == -1) { return false; } idx += rn; } for (int i=0; i<magicNumber.length; i++) { if (magicNumber[i] != buffer[i]) { return false; } } } catch (IOException ioe) { return false; } finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } } return true; }
1
              
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
2
              
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
boolean isMatch(InputStream is) throws StreamCorruptedException { int idx = 0; is.mark(getReadlimit()); try { // Skip to the offset location. while (idx < offset) { int rn = (int)is.skip(offset-idx); if (rn == -1) { return false; } idx += rn; } idx = 0; while (idx < buffer.length) { int rn = is.read(buffer, idx, buffer.length-idx); if (rn == -1) { return false; } idx += rn; } for (int i=0; i<magicNumber.length; i++) { if (magicNumber[i] != buffer[i]) { return false; } } } catch (IOException ioe) { return false; } finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } } return true; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
public boolean isCompatibleStream(InputStream is) throws StreamCorruptedException { for (int i=0; i<magicNumbers.length; i++) { if (magicNumbers[i].isMatch(is)) { return true; } } return false; }
Explicit thrown (throw new...): 1143/1728
Explicit thrown ratio: 66.1%
Builder thrown ratio: 30.1%
Variable thrown ratio: 3.9%
Checked Runtime Total
Domain 38 330 368
Lib 27 504 531
Total 65 834

Caught Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be caught, and it happens that the catch block contains a throw (e.g. for wrapping a low-level exception). Hovering over a number triggers showing code snippets from the application code.

Type Exception Caught
(directly)
Caught
with Thrown
(Lib) IOException 122
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (IOException ioe) { System.err.println("Error while reading file-list: " + file); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (IOException ioe) { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (IOException e1) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (IOException ioe) { // Nothing... }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
catch (IOException ex) { // unlikely to happen }
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) {}
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { return false; }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException e) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(e)); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException io) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(io)); }
// in sources/org/apache/batik/svggen/font/Font.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/script/ImportInfo.java
catch (IOException ioe) { return ret; }
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/script/rhino/RhinoClassLoader.java
catch (IOException e){ p = null; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { return false; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch(IOException ioe) { // Couldn't open the stream, go to next entry. openFailed = true; continue; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (IOException ioe) { // Something bad happened here... filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
catch (IOException e) { markPos = -1L; }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (IOException ex) { handler.fatalError(new TranscoderException(ex)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
catch (IOException e) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); return; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (IOException ex) { return ""; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (IOException e) { if (userAgent != null) { userAgent.displayError(e); } return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (IOException io) { }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ioe) { // Do nothing, can't really happen with StringReader }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { // This would be from a close, Let it slide... }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { // Like Duh! what would you do close it again? }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (java.io.IOException e) { s = null; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/gui/UserStyleDialog.java
catch (IOException ex) { }
// in sources/org/apache/batik/util/gui/URIChooser.java
catch (IOException ex) { }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException ioe) { /* nothing */ }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException ioe) { /* nothing */ }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/util/Service.java
catch (IOException ioe) { return l.iterator(); }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e1) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e2) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { try { fis = new FileInputStream(fullName = USER_DIR+FILE_SEP+prefFileName); } catch (IOException e4) { fullName = null; } }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e4) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch(IOException e1) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e2) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { fullName = null; throw e3; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
55
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { fullName = null; throw e3; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
(Lib) Exception 119
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); return; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) {}
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) {}
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (Exception ex) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception ex) { ex.printStackTrace(); uiSpecialization = null; }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { // As in other places. But this is ugly... }
// in sources/org/apache/batik/apps/rasterizer/DestinationType.java
catch(Exception e) { return null; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch (Exception e) { userStylesheetURL = userStylesheet; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/svgpp/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { System.err.println(e.getMessage()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (Exception e) { // should not happened }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (Exception e) { // should not happened }
// in sources/org/apache/batik/script/ImportInfo.java
catch (Exception ex) { // Just try the next file... // ex.printStackTrace(); }
// in sources/org/apache/batik/script/rhino/svg12/SVG12RhinoInterpreter.java
catch (Exception ex) { // cannot happen }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (Exception ex) { // cannot happen }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
// in sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
catch (Exception e) { System.err.println ("You have loaded the Batik jar files more than once\n" + "in the same JVM this is likely a problem with the\n" + "way you are loading the Batik jar files."); base = (int)(Math.random()*2000000); continue; }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIODebugUtil.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
catch (Exception e) { stream = new MemoryCacheSeekableStream(is); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception ex) { return new DocumentError(type, severity, key, related, e); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { return new XPathException(type, key); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception ex) { }
// in sources/org/apache/batik/dom/AbstractNode.java
catch (Exception e) { return new DOMException(type, key); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
catch (Exception e) { return new SVGOMException(type, key); }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (Exception e) { return new EventException(code, key); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (Exception ex) { }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (Exception exc) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (Exception e) { }
// in sources/org/apache/batik/gvt/svg12/MultiResGraphicsNode.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/gvt/text/GlyphLayout.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (Exception ex) { // Do nothing couldn't get Referenced URL. }
// in sources/org/apache/batik/bridge/FontFace.java
catch (Exception ex) { }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (Exception ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { helpCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { /* Nothing to do */ }
// in sources/org/apache/batik/bridge/RepaintManager.java
catch(Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (Exception ex) { /* Nothing to do */ }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); return null; } }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/util/gui/xmleditor/XMLScanner.java
catch (Exception ex) { current = -1; }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (Exception ex) { is.reset(); return is; }
// in sources/org/apache/batik/util/Service.java
catch (Exception ex) { // Just try the next line }
// in sources/org/apache/batik/util/Service.java
catch (Exception ex) { // Just try the next file... }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
23
            
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
(Lib) NumberFormatException 85
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse frame time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse transition time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse window size: " + args[i+1]); }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (NumberFormatException e) { f = 0.85f; }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (NumberFormatException e) { f = 15f; }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ // If an error occured, the x, y, w, h // values will not be valid }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ // If an error occured, the a, r, g, b // values will not be in the 0-255 range // and the next if test will fail }
// in sources/org/apache/batik/script/ImportInfo.java
catch (NumberFormatException nfe) { }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
catch (NumberFormatException nfe) { }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(NumberFormatException e){ // Ignore insertion, as it results in an out of range value }
// in sources/org/apache/batik/parser/NumberListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthPairListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/AngleParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/gvt/font/UnicodeRange.java
catch (NumberFormatException e) { firstUnicodeValue = -1; lastUnicodeValue = -1; }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (NumberFormatException nfe){ }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
// in sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java
catch (NumberFormatException nfe) { // bad port leave as '-1' }
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { setFloat(key, defaultValue); return defaultValue; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
52
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
(Lib) NoninvertibleTransformException 41
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException nite) { /* nothing */ }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { dim = svgThumbnailCanvas.getSize(); s = new Rectangle2D.Float(0, 0, dim.width, dim.height); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/ext/awt/g2d/GraphicContext.java
catch(NoninvertibleTransformException e){ return null; }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
// in sources/org/apache/batik/ext/awt/image/rendered/AffineRed.java
catch (NoninvertibleTransformException nite) { me2src = null; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
catch (NoninvertibleTransformException e) { invAffine = null; }
// in sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable8Bit.java
catch(NoninvertibleTransformException e){ }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { handleException(e); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { // Degenerate case return null; r2d = null; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { // Degenerate case return null; r2d = null; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { ret = null; }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (java.awt.geom.NoninvertibleTransformException ex) {}
14
            
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
(Domain) ParseException 41
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { this.min = 0; }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { this.max = INDEFINITE; }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/parser/PathParser.java
catch (ParseException e) { errorHandler.error(e); skipSubPath(); }
// in sources/org/apache/batik/parser/TransformListParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
catch (ParseException e) { unitType = SVG_ANGLETYPE_UNKNOWN; value = 0; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
catch (ParseException e) { unitType = SVG_LENGTHTYPE_UNKNOWN; value = 0; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
catch (ParseException e) { itemList = null; }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { reportError(e.getMessage()); return current; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; }
18
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
(Lib) InterruptedException 34
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InterruptedException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JAuthenticator.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/StatusBar.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/StatusBar.java
catch(InterruptedException e) { }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException e) { return; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException e) { return; }
// in sources/org/apache/batik/util/gui/MemoryMonitor.java
catch (InterruptedException e) {}
// in sources/org/apache/batik/util/CleanerThread.java
catch (InterruptedException ie) { continue; }
// in sources/org/apache/batik/util/SoftReferenceCache.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (InterruptedException e) { // Assume they will get delivered???? // be nice to wait on List but how??? }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { // just loop again. }
// in sources/org/apache/batik/util/RunnableQueue.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { // Loop again... }
0
(Lib) MissingResourceException 32
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MissingResourceException e) { System.out.println(e.getMessage()); System.exit(0); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
catch(MissingResourceException e){ }
// in sources/org/apache/batik/ext/awt/image/codec/util/PropertyUtil.java
catch(MissingResourceException e){ return key; }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (MissingResourceException e) { m = message; }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (MissingResourceException e) { return key; }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
catch (MissingResourceException e) { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { s = getString(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { l = getStringList(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { b = getBoolean(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarToggleButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/LocationBar.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
catch (MissingResourceException e) { }
1
            
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
(Lib) SecurityException 30
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (SecurityException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (SecurityException e) { EOL = "\n"; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch(SecurityException se){ // Could not patch the file URI for security // reasons (e.g., when run as an unsigned // JavaWebStart jar): file access is not // allowed. Loading will fail, but there is // nothing more to do at this point. }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (SecurityException se) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch(SecurityException se){ // Cannot access files. }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (SecurityException e) { temp = PROPERTY_LINE_SEPARATOR_DEFAULT; }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (SecurityException e) { temp = "\n"; }
// in sources/org/apache/batik/script/ImportInfo.java
catch (SecurityException se) { }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (SecurityException se) { rhinoClassLoader = null; }
// in sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
catch (SecurityException se) { }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
catch (SecurityException se) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (SecurityException se) { this.se = se; }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (SecurityException se) { this.se = se; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (SecurityException e) { return; // Can't access clipboard. }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (SecurityException se) { }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Security violation notify the user but keep going. ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Can't load font - Security violation. // We should not throw the error that is for certain, just // move down the font list, but do we display the error or not??? // I'll vote yes just because it is a security exception (other // exceptions like font not available etc I would skip). userAgent.displayError(ex); return null; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (SecurityException e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (SecurityException se) { handleSecurityException(se); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (SecurityException se) { }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/Service.java
catch (SecurityException se) { // Ooops! can't get his class loader. }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (SecurityException e) { throw e; }
9
            
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (SecurityException e) { throw e; }
(Lib) Throwable 22
            
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (Throwable t) { // happen only if Batik extensions are not their }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (Throwable t) { // happen only if Batik extensions are not there }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (Throwable t) { }
// in sources/org/apache/batik/ext/awt/image/rendered/Any2sRGBRed.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (Throwable th) { th.printStackTrace(); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (Throwable t) { t.printStackTrace(); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/gvt/renderer/MacRenderer.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (Throwable t) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); }
// in sources/org/apache/batik/util/CleanerThread.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch(Throwable t) { err = t; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { if (ll[ll.length-1] != null) dispatchEvent(dispatcher, ll, evt); t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
0
(Domain) LiveAttributeException 20
            
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
20
            
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
(Lib) MalformedURLException 20
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (MalformedURLException mue) { System.err.println("Can't make sense of line:\n " + line); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MalformedURLException ex) { if (userAgent != null) { userAgent.displayError(ex); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
// in sources/org/apache/batik/script/InterpreterPool.java
catch (MalformedURLException e) { }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (MalformedURLException mue) { // No sense in trying it if we can't build a URL out of it. return false; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (MalformedURLException mue) { return null; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
catch (MalformedURLException e) { return null; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (MalformedURLException mue) { /* nothing just let docURL be null */ }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { return false; }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
// in sources/org/apache/batik/util/ParsedURLJarProtocolHandler.java
catch (MalformedURLException mue) { return super.parseURL(baseURL, urlStr); }
// in sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java
catch (MalformedURLException mue) { // Built in URL wouldn't take it... // mue.printStackTrace(); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (MalformedURLException ex) { internal.remove(key); return defaultValue; }
7
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
(Lib) ThreadDeath 18
            
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/util/CleanerThread.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath t) { // Keep delivering messages but remember to throw later. td = t; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath t) { // Remember to throw later. td = t; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
16
            
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/util/CleanerThread.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
(Domain) SVGGraphics2DIOException 14
            
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException e) { // this catch prevents from catching an SVGGraphics2DIOException // and wrapping it again in another SVGGraphics2DIOException // as would do the second catch (XmlWriter throws SVGGraphics2DIO // Exception but flush throws IOException) generatorCtx.errorHandler. handleError(e); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
7
            
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
(Domain) BridgeException 13
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (BridgeException e) { userAgent.displayError(e); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (BridgeException e) { exception = e; ev = new GVTTreeBuilderEvent(this, e.getGraphicsNode()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/PaintServer.java
catch (BridgeException ex) { }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
7
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
(Lib) IllegalAccessException 13
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalAccessException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (IllegalAccessException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (IllegalAccessException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
10
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
(Lib) RuntimeException 13
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (RuntimeException re) { rex = re; }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
4
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
(Lib) InvocationTargetException 11
            
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InvocationTargetException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (InvocationTargetException e) { e.printStackTrace(); }
9
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
(Lib) CSSParseException 7
            
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); return; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
1
            
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }
(Lib) IndexOutOfBoundsException 7
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/text/GVTACIImpl.java
catch(IndexOutOfBoundsException e) { }
// in sources/org/apache/batik/gvt/text/GVTACIImpl.java
catch(IndexOutOfBoundsException e) { }
5
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
(Domain) InterpreterException 6
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterpreterException ie) { throw ie; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { System.err.println("InterpExcept: " + e); handleInterpreterException(e); return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { handleInterpreterException(e); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); synchronized (this) { error = true; } }
1
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterpreterException ie) { throw ie; }
(Domain) InterruptedBridgeException 6
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterruptedBridgeException ibe) { throw ibe; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (InterruptedBridgeException e) { // this sometimes happens with SVG Fonts since the glyphs are // not built till the rendering stage fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedBridgeException ibe) { /* do nothing */ }
2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterruptedBridgeException ibe) { throw ibe; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
(Lib) ArrayIndexOutOfBoundsException 5
            
// in sources/org/apache/batik/svggen/font/table/CmapFormat4.java
catch (ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); }
// in sources/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java
catch (ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFLZWDecoder.java
catch(ArrayIndexOutOfBoundsException e) { // Strip not terminated as expected: return EndOfInformation code. return 257; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; }
1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
(Lib) ClassNotFoundException 5
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (ClassNotFoundException e) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (ClassNotFoundException cnfe) { }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (ClassNotFoundException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (ClassNotFoundException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
1
            
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
(Domain) TranscoderException 5
            
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(TranscoderException e){ drawError(_g, e); return PAGE_EXISTS; }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch(TranscoderException ex) { // at this time, all TranscoderExceptions are fatal errors handler.fatalError(ex); return; }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
3
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
(Lib) TransformerException 5
            
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
5
            
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
(Lib) InstantiationException 4
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (InstantiationException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (InstantiationException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
2
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
(Lib) UnsupportedOperationException 4
            
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
0
(Domain) AnimationException 3
            
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
3
            
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
(Lib) CloneNotSupportedException 3
            
// in sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java
catch (CloneNotSupportedException ex) {}
// in sources/org/apache/batik/ext/awt/g2d/TransformStackElement.java
catch(java.lang.CloneNotSupportedException ex) {}
// in sources/org/apache/batik/dom/events/AbstractEvent.java
catch (CloneNotSupportedException e) { return null; }
0
(Lib) IIOInvalidTreeException 3
            
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
3
            
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
(Lib) IllegalArgumentException 3
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalArgumentException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
catch (IllegalArgumentException ex) { // XXX Should we throw an exception here when the length // type is unknown? return 0f; }
0
(Lib) InterruptedIOException 3
            
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (InterruptedIOException e) { fireEvent(cancelledDispatcher, evt); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
2
            
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
(Lib) SAXException 3
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (SAXException e1) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
4
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
(Lib) TclException 3
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { // should not happened we just register an object }
1
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
(Lib) UnsupportedEncodingException 3
            
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFUtilities.java
catch (UnsupportedEncodingException e) { // Fall through to use default. }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (UnsupportedEncodingException uee) { enc = null; }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (UnsupportedEncodingException uee) { // Try with no encoding. r = new InputStreamReader(is); }
0
(Lib) BadLocationException 2
            
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
1
            
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
(Lib) ClassCastException 2
            
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
2
            
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
(Lib) FileNotFoundException 2
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch(FileNotFoundException fnfe) { System.err.println("Unable to open file-list: " + file); return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
1
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
(Lib) JavaScriptException 2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
(Lib) ParserConfigurationException 2
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (ParserConfigurationException e1) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
1
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
(Lib) SAXNotRecognizedException 2
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXNotRecognizedException ex) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXNotRecognizedException ex) { }
0
(Domain) SVGConverterException 2
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(SVGConverterException e){ error(ERROR_WHILE_CONVERTING_FILES, new Object[] { e.getMessage() }); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
1
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
(Lib) StreamCorruptedException 2
            
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch (StreamCorruptedException sce) { // Stream is messed up so setup to reopen it.. is = null; }
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch (StreamCorruptedException sce) { break; }
0
(Lib) WrappedException 2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
4
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
(Lib) AccessControlException 1
            
// in sources/org/apache/batik/util/PreferenceManager.java
catch(AccessControlException e){ return ""; }
0
(Lib) CannotRedoException 1
            
// in sources/org/apache/batik/util/gui/xmleditor/XMLTextEditor.java
catch (CannotRedoException ex) { }
0
(Lib) CannotUndoException 1
            
// in sources/org/apache/batik/util/gui/xmleditor/XMLTextEditor.java
catch (CannotUndoException ex) { }
0
(Lib) DOMException 1
            
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (DOMException ex) { handler.fatalError(new TranscoderException(ex)); }
0
(Lib) DataFormatException 1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
(Lib) IllegalStateException 1
            
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (IllegalStateException ise) { // Not running, which is probably ok since that's what we // wanted. Might be an issue if SVGUnload wasn't issued... }
0
(Lib) LinkageError 1
            
// in sources/org/apache/batik/util/Service.java
catch (LinkageError le) { // Just try the next file... }
0
(Lib) NoClassDefFoundError 1
            
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (NoClassDefFoundError e) { // This error was reported to happen when the rendering // is interrupted with JDK1.3.0rc1 Solaris. }
0
(Lib) NoSuchFieldException 1
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (NoSuchFieldException e) { e.printStackTrace(); }
0
(Lib) NoSuchMethodException 1
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoSuchMethodException nsme) { }
0
(Lib) PrinterException 1
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (PrinterException ex) { userAgent.displayError(ex); }
0
(Lib) PyException 1
            
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
1
            
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
(Lib) UnsupportedFlavorException 1
            
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (UnsupportedFlavorException e) { e.printStackTrace(); }
0
(Domain) XMLException 1
            
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); }
0
(Lib) ZipException 1
            
// in sources/org/apache/batik/util/ParsedURLData.java
catch (ZipException ze) { is.reset(); return is; }
0

Exception Recast Summary

There is a common practice of throwing exceptions from within a catch block (e.g. for wrapping a low-level exception). The following table summarizes the usage of this practice in the application. The last column gives the number of times it happens for a pair of exceptions. The graph below the table graphically renders the same information. For a given node, its color represents its origin (blue means library exception, orange means domain exception); the left-most number is the number of times it is thrown, the right-most is the number of times it is caught.

Catch Throw
(Lib) Exception
(Lib) IllegalArgumentException
(Domain) SVGConverterException
(Lib) WrappedException
(Lib) Error
(Lib) RuntimeException
(Domain) TranscoderException
(Domain) BridgeException
(Lib) DOMException
Unknown
1
                    
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
1
                    
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
1
                    
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
1
                    
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
4
                    
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
1
                    
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
1
                    
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
1
                    
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
12
                    
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
(Domain) SVGConverterException
Unknown
1
                    
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
(Domain) TranscoderException
(Lib) RuntimeException
3
                    
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
(Lib) FileNotFoundException
(Domain) SVGConverterException
1
                    
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
(Lib) MalformedURLException
(Lib) Error
(Domain) SVGGraphics2DIOException
(Domain) TranscoderException
(Lib) IOException
(Domain) BridgeException
1
                    
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
1
                    
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
1
                    
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
3
                    
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
1
                    
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
(Lib) IOException
(Domain) SVGConverterException
(Domain) SVGGraphics2DIOException
(Lib) WrappedException
(Lib) Error
(Lib) StreamCorruptedException
(Lib) RuntimeException
(Domain) TranscoderException
(Domain) XMLException
(Domain) ParseException
(Lib) SAXException
(Domain) BridgeException
(Lib) MissingResourceException
(Lib) CSSException
Unknown
1
                    
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
8
                    
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
1
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
2
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
1
                    
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
14
                    
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
7
                    
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
4
                    
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
9
                    
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
1
                    
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
3
                    
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
1
                    
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
1
                    
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
2
                    
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { fullName = null; throw e3; }
(Domain) SVGGraphics2DIOException
(Domain) SVGGraphics2DRuntimeException
Unknown
6
                    
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
1
                    
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; }
(Lib) NumberFormatException
(Lib) IllegalArgumentException
(Domain) BridgeException
(Lib) MissingResourceException
(Domain) ResourceFormatException
Unknown
1
                    
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
46
                    
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
1
                    
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
1
                    
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
3
                    
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
(Lib) ParserConfigurationException
(Lib) IOException
1
                    
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
(Lib) SAXException
(Domain) SAXIOException
Unknown
2
                    
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
2
                    
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
(Lib) IllegalAccessException
(Lib) RuntimeException
(Lib) DOMException
9
                    
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
1
                    
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
(Lib) SecurityException
(Domain) BridgeException
Unknown
7
                    
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
2
                    
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (SecurityException e) { throw e; }
(Lib) InvocationTargetException
(Lib) RuntimeException
9
                    
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
(Lib) ClassNotFoundException
(Lib) DOMException
1
                    
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
(Lib) MissingResourceException
(Lib) SAXException
1
                    
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
(Lib) NoninvertibleTransformException
(Domain) SVGGraphics2DRuntimeException
(Lib) Error
(Lib) IllegalArgumentException
(Domain) SVGOMException
(Lib) IllegalStateException
Unknown
5
                    
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
4
                    
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
2
                    
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
1
                    
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
1
                    
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
1
                    
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
(Lib) RuntimeException
(Domain) InterpreterException
4
                    
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
(Domain) InterpreterException
Unknown
1
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterpreterException ie) { throw ie; }
(Domain) AnimationException
(Domain) BridgeException
3
                    
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
(Domain) ParseException
(Lib) IllegalArgumentException
(Domain) BridgeException
Unknown
1
                    
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
12
                    
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
5
                    
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
(Domain) LiveAttributeException
(Domain) BridgeException
20
                    
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
(Domain) BridgeException
(Domain) TranscoderException
Unknown
1
                    
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
6
                    
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
(Domain) InterruptedBridgeException
Unknown
2
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterruptedBridgeException ibe) { throw ibe; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
(Lib) InstantiationException
(Lib) RuntimeException
(Lib) DOMException
1
                    
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
1
                    
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
(Lib) ArrayIndexOutOfBoundsException
(Lib) RuntimeException
1
                    
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
(Lib) ThreadDeath
Unknown
16
                    
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/util/CleanerThread.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
(Lib) TclException
(Domain) InterpreterException
1
                    
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
(Lib) PyException
(Domain) InterpreterException
1
                    
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
(Lib) WrappedException
(Domain) InterpreterException
4
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
(Lib) JavaScriptException
(Domain) InterpreterException
2
                    
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
(Lib) IndexOutOfBoundsException
(Lib) NoSuchElementException
(Lib) ConcurrentModificationException
2
                    
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
3
                    
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
(Lib) DataFormatException
(Lib) RuntimeException
1
                    
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
(Lib) ClassCastException
(Lib) Error
2
                    
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
(Lib) IIOInvalidTreeException
(Lib) RuntimeException
3
                    
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
(Lib) BadLocationException
(Lib) Error
1
                    
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
(Lib) TransformerException
Unknown
5
                    
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
(Lib) InterruptedIOException
(Domain) InterruptedBridgeException
2
                    
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
(Lib) CSSParseException
Unknown
1
                    
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }

Caught / Thrown Exception

Not all exceptions are thrown AND caught in the same project. The following table gives the exceptions types with respect to this. The lower left hand side sell lists all exceptions thrown but not caught (prevalent for libraries), the upper right-hand side lists all exceptions caught but not thrown (usually coming from external dependencies).

Thrown Not Thrown
Caught
Type Name
(Lib) Exception
(Domain) SVGConverterException
(Domain) TranscoderException
(Lib) IOException
(Domain) SVGGraphics2DIOException
(Lib) IllegalArgumentException
(Lib) SAXException
(Lib) SecurityException
(Lib) MissingResourceException
(Lib) RuntimeException
(Domain) InterpreterException
(Domain) XMLException
(Domain) ParseException
(Domain) LiveAttributeException
(Domain) BridgeException
(Domain) InterruptedBridgeException
(Lib) IllegalStateException
(Lib) WrappedException
(Lib) IndexOutOfBoundsException
(Lib) UnsupportedOperationException
(Lib) StreamCorruptedException
(Lib) ClassCastException
(Lib) DOMException
Type Name
(Lib) InterruptedException
(Lib) FileNotFoundException
(Lib) MalformedURLException
(Lib) NumberFormatException
(Lib) ParserConfigurationException
(Lib) IllegalAccessException
(Lib) NoSuchFieldException
(Lib) InvocationTargetException
(Lib) ClassNotFoundException
(Lib) NoninvertibleTransformException
(Lib) NoSuchMethodException
(Domain) AnimationException
(Lib) InstantiationException
(Lib) PrinterException
(Lib) UnsupportedFlavorException
(Lib) ArrayIndexOutOfBoundsException
(Lib) Throwable
(Lib) ThreadDeath
(Lib) TclException
(Lib) PyException
(Lib) JavaScriptException
(Lib) CloneNotSupportedException
(Lib) DataFormatException
(Lib) IIOInvalidTreeException
(Lib) BadLocationException
(Lib) UnsupportedEncodingException
(Lib) TransformerException
(Lib) SAXNotRecognizedException
(Lib) InterruptedIOException
(Lib) NoClassDefFoundError
(Lib) CannotUndoException
(Lib) CannotRedoException
(Lib) ZipException
(Lib) LinkageError
(Lib) AccessControlException
(Lib) CSSParseException
Not caught
Type Name
(Domain) MissingListenerException
(Lib) Error
(Domain) SVGGraphics2DRuntimeException
(Lib) NullPointerException
(Lib) NoSuchElementException
(Lib) EOFException
(Domain) SVGOMException
(Domain) SAXIOException
(Lib) ConcurrentModificationException
(Domain) ResourceFormatException
(Lib) CSSException
(Lib) InternalError

Methods called in Catch and Finally Blocks

The following shows the methods that are called inside catch blocks (first column) and finally blocks (second column). For each method, we give the number of times it is called in a catch block (second sub-column), and the total number of calls (third sub-column). If the method name is red, it means that it is only called from catch/finally blocks. Hovering over a number triggers showing code snippets from the application code.

Catch Finally
Method Nbr Nbr total
getMessage 92
                  
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MissingResourceException e) { System.out.println(e.getMessage()); System.exit(0); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(SVGConverterException e){ error(ERROR_WHILE_CONVERTING_FILES, new Object[] { e.getMessage() }); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { System.err.println(e.getMessage()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
// in sources/org/apache/batik/svggen/font/table/CmapFormat4.java
catch (ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { reportError(e.getMessage()); return current; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
113
displayError 59
                  
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MalformedURLException ex) { if (userAgent != null) { userAgent.displayError(ex); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (PrinterException ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); return; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (BridgeException e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Security violation notify the user but keep going. ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Can't load font - Security violation. // We should not throw the error that is for certain, just // move down the font list, but do we display the error or not??? // I'll vote yes just because it is a security exception (other // exceptions like font not available etc I would skip). userAgent.displayError(ex); return null; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (IOException e) { if (userAgent != null) { userAgent.displayError(e); } return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (SecurityException e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (Exception ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); return null; } }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
76
printStackTrace 59
                  
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalArgumentException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalAccessException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (SecurityException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (NoSuchFieldException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InterruptedException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InvocationTargetException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception ex) { ex.printStackTrace(); uiSpecialization = null; }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (UnsupportedFlavorException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/svgpp/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
// in sources/org/apache/batik/svggen/font/Font.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
// in sources/org/apache/batik/ext/awt/image/rendered/Any2sRGBRed.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIODebugUtil.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (Throwable th) { th.printStackTrace(); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (Throwable t) { t.printStackTrace(); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/gvt/renderer/MacRenderer.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/gvt/svg12/MultiResGraphicsNode.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/gvt/text/GlyphLayout.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/RepaintManager.java
catch(Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/util/CleanerThread.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (InvocationTargetException e) { e.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { if (ll[ll.length-1] != null) dispatchEvent(dispatcher, ll, evt); t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
70
fireEvent 19
                  
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (BridgeException e) { exception = e; ev = new GVTTreeBuilderEvent(this, e.getGraphicsNode()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (InterruptedIOException e) { fireEvent(cancelledDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (InterruptedBridgeException e) { // this sometimes happens with SVG Fonts since the glyphs are // not built till the rendering stage fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (Throwable t) { t.printStackTrace(); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (Throwable t) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); }
49
toString 18
                  
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
349
formatMessage 17
                  
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
catch (MissingResourceException e) { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
123
println 17
                  
// in sources/org/apache/batik/apps/slideshow/Main.java
catch(FileNotFoundException fnfe) { System.err.println("Unable to open file-list: " + file); return; }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (MalformedURLException mue) { System.err.println("Can't make sense of line:\n " + line); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (IOException ioe) { System.err.println("Error while reading file-list: " + file); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse frame time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse transition time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse window size: " + args[i+1]); }
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MissingResourceException e) { System.out.println(e.getMessage()); System.exit(0); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { System.err.println(e.getMessage()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
// in sources/org/apache/batik/svggen/font/table/CmapFormat4.java
catch (ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); }
// in sources/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java
catch (ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); }
// in sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
catch (Exception e) { System.err.println ("You have loaded the Batik jar files more than once\n" + "in the same JVM this is likely a problem with the\n" + "way you are loading the Batik jar files."); base = (int)(Math.random()*2000000); continue; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { System.err.println("InterpExcept: " + e); handleInterpreterException(e); return; }
184
getUserAgent 14
                  
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Security violation notify the user but keep going. ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (Exception ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } }
79
fatalError 10
                  
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (DOMException ex) { handler.fatalError(new TranscoderException(ex)); }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (IOException ex) { handler.fatalError(new TranscoderException(ex)); }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch(TranscoderException ex) { // at this time, all TranscoderExceptions are fatal errors handler.fatalError(ex); return; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); return; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
111
getBrokenLinkImage 10
                  
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (IOException ioe) { // Something bad happened here... filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
16
getName 10
                  
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
62
error 9
                  
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(SVGConverterException e){ error(ERROR_WHILE_CONVERTING_FILES, new Object[] { e.getMessage() }); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/parser/PathParser.java
catch (ParseException e) { errorHandler.error(e); skipSubPath(); }
// in sources/org/apache/batik/parser/TransformListParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; }
15
handleError 9
                  
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException e) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(e)); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException e) { // this catch prevents from catching an SVGGraphics2DIOException // and wrapping it again in another SVGGraphics2DIOException // as would do the second catch (XmlWriter throws SVGGraphics2DIO // Exception but flush throws IOException) generatorCtx.errorHandler. handleError(e); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException io) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(io)); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
19
getElement 8
                  
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
32
reportError 8
                  
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); return; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { reportError(e.getMessage()); return current; }
33
remove 7
                  
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (MalformedURLException ex) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { internal.remove(key); return defaultValue; }
202
ArrayList 6
                  
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
172
getString 6
                  
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { s = getString(name); }
329
release 6
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
8
createException 5
                  
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
17
createXPathException 5
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
12
handleInterpreterException
5
                  
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { System.err.println("InterpExcept: " + e); handleInterpreterException(e); return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { handleInterpreterException(e); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); synchronized (this) { error = true; } }
5
equals 4
                  
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
915
getCode 4
                  
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
6
reportUnexpectedCharacterError 4
                  
// in sources/org/apache/batik/parser/NumberListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthPairListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/AngleParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
61
setSource 4
                  
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
21
createBrokenImageNode
3
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
3
createCSSParseException 3
                  
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; }
31
createErrorMessage 3
                  
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
4
getClass 3
                  
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
72
getLocalizedMessage
3
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
3
UpdateManagerEvent 2
                  
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (Throwable t) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); }
8
checkForComodification 2
                  
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
7
drawError
2
                  
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(TranscoderException e){ drawError(_g, e); return PAGE_EXISTS; }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); }
2
getBridgeContext 2
                  
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
6
getException 2
                  
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
6
getGraphicsNode 2
                  
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (BridgeException e) { exception = e; ev = new GVTTreeBuilderEvent(this, e.getGraphicsNode()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
34
getOwnerDocument 2
                  
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
113
getURLDone 2
                  
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
4
getValue 2
                  
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
362
getWrappedException
2
                  
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
2
handleValueError 2
                  
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
3
invokeLater 2
                  
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
64
openStream 2
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
22
printUsage 2
                  
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/apps/svgpp/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
3
proceedOnSourceTranscodingFailure
2
                  
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
2
reset 2
                  
// in sources/org/apache/batik/util/ParsedURLData.java
catch (Exception ex) { is.reset(); return is; }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (ZipException ze) { is.reset(); return is; }
44
setGraphicsNode 2
                  
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
13
skipTransform 2
                  
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/parser/TransformListParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
73
ByteArrayOutputStream 1
                  
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); }
5
DocumentError 1
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception ex) { return new DocumentError(type, severity, key, related, e); }
2
Double 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
163
FileInputStream 1
                  
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { try { fis = new FileInputStream(fullName = USER_DIR+FILE_SEP+prefFileName); } catch (IOException e4) { fullName = null; } }
11
Float 1
                  
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { dim = svgThumbnailCanvas.getSize(); s = new Rectangle2D.Float(0, 0, dim.width, dim.height); }
343
GVTTreeBuilderEvent 1
                  
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (BridgeException e) { exception = e; ev = new GVTTreeBuilderEvent(this, e.getGraphicsNode()); fireEvent(failedDispatcher, ev); }
3
InputStreamReader 1
                  
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (UnsupportedEncodingException uee) { // Try with no encoding. r = new InputStreamReader(is); }
22
Integer 1
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
270
JButton 1
                  
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JButton(); }
15
JToolbarButton 1
                  
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarButton(); }
2
JToolbarToggleButton 1
                  
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarToggleButton(); }
2
MemoryCacheSeekableStream
1
                  
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
catch (Exception e) { stream = new MemoryCacheSeekableStream(is); }
1
XPathException 1
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { return new XPathException(type, key); }
2
add 1
                  
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
976
buildGraphicsNode 1
                  
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
10
close 1
                  
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
83
createDOMException 1
                  
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
215
createSVGException 1
                  
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
17
dispatchEvent 1
                  
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { if (ll[ll.length-1] != null) dispatchEvent(dispatcher, ll, evt); t.printStackTrace(); }
46
exit 1
                  
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MissingResourceException e) { System.out.println(e.getMessage()); System.exit(0); }
13
flush 1
                  
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
37
getBoolean 1
                  
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { b = getBoolean(name); }
33
getBounds2D 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
231
getChildren 1
                  
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
32
getErrorCode
1
                  
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
1
getErrorHandler
1
                  
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); }
1
getErrorStream
1
                  
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
1
getHeight 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
374
getNodeValue 1
                  
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
86
getOptionDescription 1
                  
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
2
getPatternString
1
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
1
getPredefinedCursor 1
                  
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { helpCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
19
getSize 1
                  
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { dim = svgThumbnailCanvas.getSize(); s = new Rectangle2D.Float(0, 0, dim.width, dim.height); }
47
getStringList 1
                  
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { l = getStringList(name); }
5
getWidth 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
384
getX 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
388
getY 1
                  
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
381
handleException
1
                  
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { handleException(e); }
1
handleSecurityException
1
                  
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (SecurityException se) { handleSecurityException(se); }
1
hasBeenHalted 1
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
23
int 1
                  
// in sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
catch (Exception e) { System.err.println ("You have loaded the Batik jar files more than once\n" + "in the same JVM this is likely a problem with the\n" + "way you are loading the Batik jar files."); base = (int)(Math.random()*2000000); continue; }
261
iterator 1
                  
// in sources/org/apache/batik/util/Service.java
catch (IOException ioe) { return l.iterator(); }
248
newInstance 1
                  
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } }
15
parseURL 1
                  
// in sources/org/apache/batik/util/ParsedURLJarProtocolHandler.java
catch (MalformedURLException mue) { return super.parseURL(baseURL, urlStr); }
22
random 1
                  
// in sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
catch (Exception e) { System.err.println ("You have loaded the Batik jar files more than once\n" + "in the same JVM this is likely a problem with the\n" + "way you are loading the Batik jar files."); base = (int)(Math.random()*2000000); continue; }
5
seek 1
                  
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; }
68
setClip 1
                  
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); }
27
setFloat 1
                  
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { setFloat(key, defaultValue); return defaultValue; }
3
setTransform 1
                  
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); }
64
skipSubPath 1
                  
// in sources/org/apache/batik/parser/PathParser.java
catch (ParseException e) { errorHandler.error(e); skipSubPath(); }
2
usage 1
                  
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
2
Method Nbr Nbr total
close 12
                  
// in sources/org/apache/batik/apps/slideshow/Main.java
finally { try { br.close(); } catch (IOException ioe) { } }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
finally { os.close(); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
finally { os.close(); }
// in sources/org/apache/batik/script/ImportInfo.java
finally { // close and release all io-resources to avoid leaks if ( is != null ){ try { is.close(); } catch ( IOException ignored ){} is = null; } if ( r != null ){ try{ r.close(); } catch ( IOException ignored ){} r = null; } if ( br == null ){ try{ br.close(); } catch ( IOException ignored ){} br = null; } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } }
// in sources/org/apache/batik/util/Service.java
finally { // close and release all io-resources to avoid leaks if (is != null) { try { is.close(); } catch (IOException ignored) { } is = null; } if (r != null) { try{ r.close(); } catch (IOException ignored) { } r = null; } if (br != null) { try { br.close(); } catch (IOException ignored) { } br = null; } }
// in sources/org/apache/batik/util/PreferenceManager.java
finally { fis.close(); }
// in sources/org/apache/batik/util/PreferenceManager.java
finally { fos.close(); }
83
getShape 3
                  
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
finally { shapeNode.setShape(app.getShape()); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
finally { // transform the shape into the correct coord system Shape shape = app.getShape(); Shape transformedShape = scaleTransform.createTransformedShape(shape); dShape = transformedShape; }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
finally { pathShape = app.getShape(); }
21
println 2
                  
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } }
184
StreamCorruptedException
1
                  
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } }
1
appendChild 1
                  
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
finally { // Restore the svgRoot to its original tree position if (rootParent != null) { if (nextSibling == null) { rootParent.appendChild(svgRoot); } else { rootParent.insertBefore(svgRoot, nextSibling); } } }
90
createTransformedShape 1
                  
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
finally { // transform the shape into the correct coord system Shape shape = app.getShape(); Shape transformedShape = scaleTransform.createTransformedShape(shape); dShape = transformedShape; }
107
dispose 1
                  
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } }
92
endDocument
1
                  
// in sources/org/apache/batik/css/parser/Parser.java
finally { documentHandler.endDocument(source); scanner = null; }
1
endFontFace
1
                  
// in sources/org/apache/batik/css/parser/Parser.java
finally { documentHandler.endFontFace(); }
1
endMedia
1
                  
// in sources/org/apache/batik/css/parser/Parser.java
finally { documentHandler.endMedia(ml); }
1
endPage
1
                  
// in sources/org/apache/batik/css/parser/Parser.java
finally { documentHandler.endPage(page, ppage); }
1
endSelector
1
                  
// in sources/org/apache/batik/css/parser/Parser.java
finally { documentHandler.endSelector(sl); }
1
enforceSecurity 1
                  
// in sources/org/apache/batik/apps/rasterizer/Main.java
finally { System.out.flush(); securityEnforcer.enforceSecurity(false); }
4
flush 1
                  
// in sources/org/apache/batik/apps/rasterizer/Main.java
finally { System.out.flush(); securityEnforcer.enforceSecurity(false); }
37
getMessage 1
                  
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } }
113
insertBefore 1
                  
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
finally { // Restore the svgRoot to its original tree position if (rootParent != null) { if (nextSibling == null) { rootParent.appendChild(svgRoot); } else { rootParent.insertBefore(svgRoot, nextSibling); } } }
26
pop 1
                  
// in sources/org/apache/batik/util/RunnableQueue.java
finally { do { // Empty the list of pending runnables and unlock them (so // invokeAndWait will return). // It's up to the runnables to check if the runnable actually // ran, if that is important. synchronized (list) { l = (Link)list.pop(); } if (l == null) break; else l.unlock(); } while (true); synchronized (this) { runnableQueueThread = null; } }
16
release 1
                  
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
finally { reference.release(); }
8
reset 1
                  
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } }
44
setComposite 1
                  
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
finally { g2d.setTransform(g2dAt); g2d.setComposite(g2dComposite); }
28
setShape 1
                  
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
finally { shapeNode.setShape(app.getShape()); }
20
setTransform 1
                  
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
finally { g2d.setTransform(g2dAt); g2d.setComposite(g2dComposite); }
64
unlock 1
                  
// in sources/org/apache/batik/util/RunnableQueue.java
finally { do { // Empty the list of pending runnables and unlock them (so // invokeAndWait will return). // It's up to the runnables to check if the runnable actually // ran, if that is important. synchronized (list) { l = (Link)list.pop(); } if (l == null) break; else l.unlock(); } while (true); synchronized (this) { runnableQueueThread = null; } }
2

Reference Table

This table concatenates the results of the previous tables.

Checked/Runtime Type Exception Thrown Thrown from Catch Declared Caught directly Caught
with Thrown
Caught
with Thrown Runtime
unknown (Lib) AccessControlException 0 0 0 1
            
// in sources/org/apache/batik/util/PreferenceManager.java
catch(AccessControlException e){ return ""; }
0 0
runtime (Domain) AnimationException
public class AnimationException extends RuntimeException {

    /**
     * The timed element on which the error occurred.
     */
    protected TimedElement e;

    /**
     * The error code.
     */
    protected String code;

    /**
     * The parameters to use for the error message.
     */
    protected Object[] params;

    /**
     * The message.
     */
    protected String message;

    /**
     * Creates a new AnimationException.
     * @param e the animation element on which the error occurred
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public AnimationException(TimedElement e, String code, Object[] params) {
        this.e = e;
        this.code = code;
        this.params = params;
    }

    /**
     * Returns the timed element that caused this animation exception.
     */
    public TimedElement getElement() {
        return e;
    }

    /**
     * Returns the error code.
     */
    public String getCode() {
        return code;
    }

    /**
     * Returns the error message parameters.
     */
    public Object[] getParams() {
        return params;
    }

    /**
     * Returns the error message according to the error code and parameters.
     */
    public String getMessage() {
        return TimedElement.formatMessage(code, params);
    }
}
0 0 0 3
            
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
3
            
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
3
unknown (Lib) ArrayIndexOutOfBoundsException 0 0 0 5
            
// in sources/org/apache/batik/svggen/font/table/CmapFormat4.java
catch (ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); }
// in sources/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java
catch (ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFLZWDecoder.java
catch(ArrayIndexOutOfBoundsException e) { // Strip not terminated as expected: return EndOfInformation code. return 257; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; }
1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
1
unknown (Lib) BadLocationException 0 0 6
            
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) { return; } // Get current value String curVal = getText(0, getLength()); boolean hasDot = curVal.indexOf('.') != -1; // Strip non digit characters char[] buffer = str.toCharArray(); char[] digit = new char[buffer.length]; int j = 0; if(offs==0 && buffer!=null && buffer.length>0 && buffer[0]=='-') digit[j++] = buffer[0]; for (int i = 0; i < buffer.length; i++) { if(Character.isDigit(buffer[i])) digit[j++] = buffer[i]; if(!hasDot && buffer[i]=='.'){ digit[j++] = '.'; hasDot = true; } } // Now, test that new value is within range. String added = new String(digit, 0, j); try{ StringBuffer val = new StringBuffer(curVal); val.insert(offs, added); String valStr = val.toString(); if( valStr.equals(".") || valStr.equals("-") || valStr.equals("-.")) super.insertString(offs, added, a); else{ Double.valueOf( valStr ); super.insertString(offs, added, a); } }catch(NumberFormatException e){ // Ignore insertion, as it results in an out of range value } }
// in sources/org/apache/batik/util/gui/xmleditor/XMLDocument.java
public XMLToken getScannerStart(int pos) throws BadLocationException { int ctx = XMLScanner.CHARACTER_DATA_CONTEXT; int offset = 0; int tokenOffset = 0; if (cacheToken != null) { if (cacheToken.getStartOffset() > pos) { cacheToken = null; } else { ctx = cacheToken.getContext(); offset = cacheToken.getStartOffset(); tokenOffset = offset; Element element = getDefaultRootElement(); int line1 = element.getElementIndex(pos); int line2 = element.getElementIndex(offset); //if (pos - offset <= 1800 ) { if (line1 - line2 < 50) { return cacheToken; } } } String str = getText(offset, pos - offset); lexer.setString(str); lexer.reset(); // read until pos int lastCtx = ctx; int lastOffset = offset; while (offset < pos) { lastOffset = offset; lastCtx = ctx; offset = lexer.scan(ctx) + tokenOffset; ctx = lexer.getScanValue(); } cacheToken = new XMLToken(lastCtx, lastOffset, offset); return cacheToken; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLDocument.java
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { super.insertString(offset, str, a); if (cacheToken != null) { if (cacheToken.getStartOffset() >= offset) { cacheToken = null; } } }
// in sources/org/apache/batik/util/gui/xmleditor/XMLDocument.java
public void remove(int offs, int len) throws BadLocationException { super.remove(offs, len); if (cacheToken != null) { if (cacheToken.getStartOffset() >= offs) { cacheToken = null; } } }
// in sources/org/apache/batik/util/gui/xmleditor/XMLDocument.java
public int find(String str, int fromIndex, boolean caseSensitive) throws BadLocationException { int offset = -1; int startOffset = -1; int len = 0; int charIndex = 0; Element rootElement = getDefaultRootElement(); int elementIndex = rootElement.getElementIndex(fromIndex); if (elementIndex < 0) { return offset; } // set the initial charIndex charIndex = fromIndex - rootElement.getElement(elementIndex).getStartOffset(); for (int i = elementIndex; i < rootElement.getElementCount(); i++) { Element element = rootElement.getElement(i); startOffset = element.getStartOffset(); if (element.getEndOffset() > getLength()) { len = getLength() - startOffset; } else { len = element.getEndOffset() - startOffset; } String text = getText(startOffset, len); if (!caseSensitive) { text = text.toLowerCase(); str = str.toLowerCase(); } charIndex = text.indexOf(str, charIndex); if (charIndex != -1) { offset = startOffset + charIndex; break; } charIndex = 0; // reset the charIndex } return offset; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLView.java
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException { XMLDocument doc = (XMLDocument)getDocument(); XMLToken token = doc.getScannerStart(p0); String str = doc.getText(token.getStartOffset(), (p1-token.getStartOffset()) + 1); lexer.setString(str); lexer.reset(); // read until p0 int pos = token.getStartOffset(); int ctx = token.getContext(); int lastCtx = ctx; while (pos < p0) { pos = lexer.scan(ctx) + token.getStartOffset(); lastCtx = ctx; ctx = lexer.getScanValue(); } int mark = p0; while (pos < p1) { if (lastCtx != ctx) { //syntax = context.getSyntaxName(lastCtx); g.setColor(context.getSyntaxForeground(lastCtx)); g.setFont(context.getSyntaxFont(lastCtx)); Segment text = getLineBuffer(); doc.getText(mark, pos - mark, text); x = Utilities.drawTabbedText(text, x, y, g, this, mark); mark = pos; } pos = lexer.scan(ctx) + token.getStartOffset(); lastCtx = ctx; ctx = lexer.getScanValue(); } // flush remaining //syntax = context.getSyntaxName(lastCtx); g.setColor(context.getSyntaxForeground(lastCtx)); g.setFont(context.getSyntaxFont(lastCtx)); Segment text = getLineBuffer(); doc.getText(mark, p1 - mark, text); x = Utilities.drawTabbedText(text, x, y, g, this, mark); return x; }
2
            
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
1
            
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
1
runtime (Domain) BridgeException
public class BridgeException extends RuntimeException {

    /** The element on which the error occured. */
    protected Element e;

    /** The error code. */
    protected String code;

    /**
     * The message.
     */
    protected String message;

    /** The paramters to use for the error message. */
    protected Object [] params;

    /** The line number on which the error occured. */
    protected int line;

    /** The graphics node that represents the current state of the GVT tree. */
    protected GraphicsNode node;

    /**
     * Constructs a new <tt>BridgeException</tt> based on the specified
     * <tt>LiveAttributeException</tt>.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param ex the {@link LiveAttributeException}
     */
    public BridgeException(BridgeContext ctx, LiveAttributeException ex) {
        switch (ex.getCode()) {
            case LiveAttributeException.ERR_ATTRIBUTE_MISSING:
                this.code = ErrorConstants.ERR_ATTRIBUTE_MISSING;
                break;
            case LiveAttributeException.ERR_ATTRIBUTE_MALFORMED:
                this.code = ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED;
                break;
            case LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE:
                this.code = ErrorConstants.ERR_LENGTH_NEGATIVE;
                break;
            default:
                throw new IllegalStateException
                    ("Unknown LiveAttributeException error code "
                     + ex.getCode());
        }
        this.e = ex.getElement();
        this.params = new Object[] { ex.getAttributeName(), ex.getValue() };
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

     /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public BridgeException(BridgeContext ctx, Element e, String code,
                           Object[] params) {

        this.e = e;
        this.code = code;
        this.params = params;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param ex the exception which was the root-cause for this exception
     * @param code the error code
     * @param params the parameters to use for the error message
     */
    public BridgeException(BridgeContext ctx, Element e, Exception ex, String code,
                           Object[] params) {

        // todo ex can be chained in jdk >= 1.4
        this.e = e;

        message = ex.getMessage();
        this.code = code;
        this.params = params;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Constructs a new <tt>BridgeException</tt> with the specified parameters.
     *
     * @param ctx the bridge context to use for determining the element's
     *            source position
     * @param e the element on which the error occurred
     * @param message the error message
     */
    public BridgeException(BridgeContext ctx, Element e, String message) {
        this.e = e;
        this.message = message;
        if (e != null && ctx != null) {
            this.line = ctx.getDocumentLoader().getLineNumber(e);
        }
    }

    /**
     * Returns the element on which the error occurred.
     */
    public Element getElement() {
        return e;
    }

    /**
     * Sets the graphics node that represents the current GVT tree built.
     *
     * @param node the graphics node
     */
    public void setGraphicsNode(GraphicsNode node) {
        this.node = node;
    }

    /**
     * Returns the graphics node that represents the current GVT tree built.
     */
    public GraphicsNode getGraphicsNode() {
        return node;
    }

    /**
     * Returns the error message according to the error code and parameters.
     */
    public String getMessage() {
        if (message != null) {
            return message;
        }

        String uri;
        String lname = "<Unknown Element>";
        SVGDocument doc = null;
        if (e != null) {
            doc = (SVGDocument)e.getOwnerDocument();
            lname = e.getLocalName();
        }
        if (doc == null)  uri = "<Unknown Document>";
        else              uri = doc.getURL();
        Object [] fullparams = new Object[params.length+3];
        fullparams[0] = uri;
        fullparams[1] = new Integer(line);
        fullparams[2] = lname;
        System.arraycopy( params, 0, fullparams, 3, params.length );
        return Messages.formatMessage(code, fullparams);
    }

    /**
     * Returns the exception's error code
     */
    public String getCode() {
        return code;
    }
}
193
            
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
protected RegionInfo buildRegion(UnitProcessor.Context uctx, Element e, float verticalAlignment) { String s; // 'x' attribute - default is 0 s = e.getAttribute(BATIK_EXT_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, BATIK_EXT_X_ATTRIBUTE, uctx); } // 'y' attribute - default is 0 s = e.getAttribute(BATIK_EXT_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, BATIK_EXT_Y_ATTRIBUTE, uctx); } // 'width' attribute - required s = e.getAttribute(BATIK_EXT_WIDTH_ATTRIBUTE); float w; if (s.length() != 0) { w = UnitProcessor.svgHorizontalLengthToUserSpace (s, BATIK_EXT_WIDTH_ATTRIBUTE, uctx); } else { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_WIDTH_ATTRIBUTE, s}); } // A value of zero disables rendering of the element if (w == 0) { return null; } // 'height' attribute - required s = e.getAttribute(BATIK_EXT_HEIGHT_ATTRIBUTE); float h; if (s.length() != 0) { h = UnitProcessor.svgVerticalLengthToUserSpace (s, BATIK_EXT_HEIGHT_ATTRIBUTE, uctx); } else { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_HEIGHT_ATTRIBUTE, s}); } // A value of zero disables rendering of the element if (h == 0) { return null; } return new RegionInfo(x,y,w,h,verticalAlignment); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e); String s; // 'cx' attribute - default is 0 s = e.getAttributeNS(null, SVG_CX_ATTRIBUTE); float cx = 0; if (s.length() != 0) { cx = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_CX_ATTRIBUTE, uctx); } // 'cy' attribute - default is 0 s = e.getAttributeNS(null, SVG_CY_ATTRIBUTE); float cy = 0; if (s.length() != 0) { cy = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_CY_ATTRIBUTE, uctx); } // 'r' attribute - required s = e.getAttributeNS(null, SVG_R_ATTRIBUTE); float r; if (s.length() == 0) throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_R_ATTRIBUTE, s}); r = UnitProcessor.svgOtherLengthToUserSpace (s, SVG_R_ATTRIBUTE, uctx); // 'ir' attribute - required s = e.getAttributeNS(null, BATIK_EXT_IR_ATTRIBUTE); float ir; if (s.length() == 0) throw new BridgeException (ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {BATIK_EXT_IR_ATTRIBUTE, s}); ir = UnitProcessor.svgOtherLengthToUserSpace (s, BATIK_EXT_IR_ATTRIBUTE, uctx); // 'sides' attribute - default is 3 int sides = convertSides(e, BATIK_EXT_SIDES_ATTRIBUTE, 3, ctx); GeneralPath gp = new GeneralPath(); double angle, x, y; final double SECTOR = 2.0 * Math.PI/sides; final double HALF_PI = Math.PI / 2.0; for (int i=0; i<sides; i++) { angle = i * SECTOR - HALF_PI; x = cx + ir*Math.cos(angle); y = cy - ir*Math.sin(angle); if (i==0) gp.moveTo((float)x, (float)y); else gp.lineTo((float)x, (float)y); angle = (i+0.5) * SECTOR - HALF_PI; x = cx + r*Math.cos(angle); y = cy - r*Math.sin(angle); gp.lineTo((float)x, (float)y); } gp.closePath(); shapeNode.setShape(gp); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e); String s; // 'cx' attribute - default is 0 s = e.getAttributeNS(null, SVG_CX_ATTRIBUTE); float cx = 0; if (s.length() != 0) { cx = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_CX_ATTRIBUTE, uctx); } // 'cy' attribute - default is 0 s = e.getAttributeNS(null, SVG_CY_ATTRIBUTE); float cy = 0; if (s.length() != 0) { cy = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_CY_ATTRIBUTE, uctx); } // 'r' attribute - required s = e.getAttributeNS(null, SVG_R_ATTRIBUTE); float r; if (s.length() != 0) { r = UnitProcessor.svgOtherLengthToUserSpace (s, SVG_R_ATTRIBUTE, uctx); } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_R_ATTRIBUTE, s}); } // 'sides' attribute - default is 3 int sides = convertSides(e, BATIK_EXT_SIDES_ATTRIBUTE, 3, ctx); GeneralPath gp = new GeneralPath(); for (int i=0; i<sides; i++) { double angle = (i+0.5)*(2*Math.PI/sides) - (Math.PI/2); double x = cx + r*Math.cos(angle); double y = cy - r*Math.sin(angle); if (i==0) gp.moveTo((float)x, (float)y); else gp.lineTo((float)x, (float)y); } gp.closePath(); shapeNode.setShape(gp); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // The default region is the union of the input sources // regions unless 'in' is 'SourceGraphic' in which case the // default region is the filterChain's region Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE); Rectangle2D defaultRegion; if (in == sourceGraphics) { defaultRegion = filterRegion; } else { defaultRegion = in.getBounds2D(); } Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); float trim = 1; String s = filterElement.getAttributeNS (null, BATIK_EXT_TRIM_ATTRIBUTE); if (s.length() != 0) { try { trim = SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); } } if (trim < 0) trim =0; else if (trim > 100) trim=100; Filter filter = in; filter = new BatikHistogramNormalizationFilter8Bit(filter, trim/100); filter = new PadRable8Bit(filter, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(filter, filterElement); return filter; }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
protected static int convertSides(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { int ret = 0; try { ret = SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } if (ret <3) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); return ret; } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { Class cls = JSVGComponent.class; URL blURL = cls.getResource("resources/BrokenLink.svg"); if (blURL == null) throw new BridgeException (bridgeContext, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] { url, message }); DocumentLoader loader = bridgeContext.getDocumentLoader(); SVGDocument doc = null; try { doc = (SVGDocument)loader.loadDocument(blURL.toString()); if (doc == null) return doc; DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); doc = (SVGDocument)DOMUtilities.deepCloneDocument(doc, impl); String title; Element infoE, titleE, descE; infoE = doc.getElementById("__More_About"); if (infoE == null) return doc; titleE = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_TITLE_TAG); title = Messages.formatMessage(BROKEN_LINK_TITLE, null); titleE.appendChild(doc.createTextNode(title)); descE = doc.createElementNS(SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_DESC_TAG); descE.appendChild(doc.createTextNode(message)); infoE.insertBefore(descE, infoE.getFirstChild()); infoE.insertBefore(titleE, descE); } catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); } return doc; }
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPolylineElement pe = (SVGOMPolylineElement) e; try { SVGOMAnimatedPoints _points = pe.getSVGOMAnimatedPoints(); _points.check(); SVGPointList pl = _points.getAnimatedPoints(); int size = pl.getNumberOfItems(); if (size == 0) { shapeNode.setShape(DEFAULT_SHAPE); } else { AWTPolylineProducer app = new AWTPolylineProducer(); app.setWindingRule(CSSUtilities.convertFillRule(e)); app.startPoints(); for (int i = 0; i < size; i++) { SVGPoint p = pl.getItem(i); app.point(p.getX(), p.getY()); } app.endPoints(); shapeNode.setShape(app.getShape()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPathElement pe = (SVGOMPathElement) e; AWTPathProducer app = new AWTPathProducer(); try { // 'd' attribute - required SVGOMAnimatedPathData _d = pe.getAnimatedPathData(); _d.check(); SVGPathSegList p = _d.getAnimatedPathSegList(); app.setWindingRule(CSSUtilities.convertFillRule(e)); SVGAnimatedPathDataSupport.handlePathSegList(p, app); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } finally { shapeNode.setShape(app.getShape()); } }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
protected static float [] convertTableValues(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TABLE_VALUES_ATTRIBUTE); if (s.length() == 0) { return null; } StringTokenizer tokens = new StringTokenizer(s, " ,"); float [] v = new float[tokens.countTokens()]; try { for (int i = 0; tokens.hasMoreTokens(); ++i) { v[i] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); } return v; }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
protected static int convertType(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_TYPE_ATTRIBUTE}); } if (SVG_DISCRETE_VALUE.equals(s)) { return ComponentTransferFunction.DISCRETE; } if (SVG_IDENTITY_VALUE.equals(s)) { return ComponentTransferFunction.IDENTITY; } if (SVG_GAMMA_VALUE.equals(s)) { return ComponentTransferFunction.GAMMA; } if (SVG_LINEAR_VALUE.equals(s)) { return ComponentTransferFunction.LINEAR; } if (SVG_TABLE_VALUE.equals(s)) { return ComponentTransferFunction.TABLE; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/svg12/SVGMultiImageElementBridge.java
protected static Rectangle2D getImageBounds(BridgeContext ctx, Element element) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); // 'x' attribute - default is 0 String s = element.getAttributeNS(null, SVG_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_X_ATTRIBUTE, uctx); } // 'y' attribute - default is 0 s = element.getAttributeNS(null, SVG_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_Y_ATTRIBUTE, uctx); } // 'width' attribute - required s = element.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE); float w; if (s.length() == 0) { throw new BridgeException(ctx, element, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_WIDTH_ATTRIBUTE}); } else { w = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_WIDTH_ATTRIBUTE, uctx); } // 'height' attribute - required s = element.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE); float h; if (s.length() == 0) { throw new BridgeException(ctx, element, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HEIGHT_ATTRIBUTE}); } else { h = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_HEIGHT_ATTRIBUTE, uctx); } return new Rectangle2D.Float(x, y, w, h); }
// in sources/org/apache/batik/bridge/svg12/SVGMultiImageElementBridge.java
protected void addRefInfo(Element e, Collection elems, Collection minDim, Collection maxDim, Rectangle2D bounds) { String uriStr = XLinkSupport.getXLinkHref(e); if (uriStr.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } String baseURI = AbstractNode.getBaseURI(e); ParsedURL purl; if (baseURI == null) purl = new ParsedURL(uriStr); else purl = new ParsedURL(baseURI, uriStr); Document doc = e.getOwnerDocument(); Element imgElem = doc.createElementNS(SVG_NAMESPACE_URI, SVG_IMAGE_TAG); imgElem.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE, purl.toString()); // move the attributes from <subImageRef> to the <image> element NamedNodeMap attrs = e.getAttributes(); int len = attrs.getLength(); for (int i = 0; i < len; i++) { Attr attr = (Attr)attrs.item(i); imgElem.setAttributeNS(attr.getNamespaceURI(), attr.getName(), attr.getValue()); } String s; s = e.getAttribute("x"); if (s.length() == 0) imgElem.setAttribute("x", "0"); s = e.getAttribute("y"); if (s.length() == 0) imgElem.setAttribute("y", "0"); s = e.getAttribute("width"); if (s.length() == 0) imgElem.setAttribute("width", "100%"); s = e.getAttribute("height"); if (s.length() == 0) imgElem.setAttribute("height", "100%"); e.appendChild(imgElem); elems.add(imgElem); minDim.add(getElementMinPixel(e, bounds)); maxDim.add(getElementMaxPixel(e, bounds)); }
// in sources/org/apache/batik/bridge/svg12/SVGSolidColorElementBridge.java
protected static float extractOpacity(Element paintElement, float opacity, BridgeContext ctx) { Map refs = new HashMap(); CSSEngine eng = CSSUtilities.getCSSEngine(paintElement); int pidx = eng.getPropertyIndex (SVG12CSSConstants.CSS_SOLID_OPACITY_PROPERTY); for (;;) { Value opacityVal = CSSUtilities.getComputedStyle(paintElement, pidx); // Was solid-opacity explicity set on this element? StyleMap sm = ((CSSStylableElement)paintElement).getComputedStyleMap(null); if (!sm.isNullCascaded(pidx)) { // It was explicit... float attr = PaintServer.convertOpacity(opacityVal); return (opacity * attr); } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { return opacity; // no xlink:href found, exit } SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); // check if there is circular dependencies if (refs.containsKey(purl)) { throw new BridgeException (ctx, paintElement, ErrorConstants.ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.put(purl, purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/svg12/SVGSolidColorElementBridge.java
protected static Color extractColor(Element paintElement, float opacity, BridgeContext ctx) { Map refs = new HashMap(); CSSEngine eng = CSSUtilities.getCSSEngine(paintElement); int pidx = eng.getPropertyIndex (SVG12CSSConstants.CSS_SOLID_COLOR_PROPERTY); for (;;) { Value colorDef = CSSUtilities.getComputedStyle(paintElement, pidx); // Was solid-color explicity set on this element? StyleMap sm = ((CSSStylableElement)paintElement).getComputedStyleMap(null); if (!sm.isNullCascaded(pidx)) { // It was explicit... if (colorDef.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { return PaintServer.convertColor(colorDef, opacity); } else { return PaintServer.convertRGBICCColor (paintElement, colorDef.item(0), (ICCColor)colorDef.item(1), opacity, ctx); } } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { // no xlink:href found, exit return new Color(0, 0, 0, opacity); } SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); // check if there is circular dependencies if (refs.containsKey(purl)) { throw new BridgeException (ctx, paintElement, ErrorConstants.ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.put(purl, purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
protected void addDefinitionRef(Element defRef) { String ref = defRef.getAttributeNS(null, XBL_REF_ATTRIBUTE); Element e = ctx.getReferencedElement(defRef, ref); if (!XBL_NAMESPACE_URI.equals(e.getNamespaceURI()) || !XBL_DEFINITION_TAG.equals(e.getLocalName())) { throw new BridgeException (ctx, defRef, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { ref }); } ImportRecord ir = new ImportRecord(defRef, e); imports.put(defRef, ir); NodeEventTarget et = (NodeEventTarget) defRef; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", refAttrListener, false, null); XBLOMDefinitionElement d = (XBLOMDefinitionElement) defRef; String ns = d.getElementNamespaceURI(); String ln = d.getElementLocalName(); addDefinition(ns, ln, (XBLOMDefinitionElement) e, defRef); }
// in sources/org/apache/batik/bridge/svg12/DefaultXBLManager.java
protected void addImport(Element imp) { String bindings = imp.getAttributeNS(null, XBL_BINDINGS_ATTRIBUTE); Node n = ctx.getReferencedNode(imp, bindings); if (n.getNodeType() == Node.ELEMENT_NODE && !(XBL_NAMESPACE_URI.equals(n.getNamespaceURI()) && XBL_XBL_TAG.equals(n.getLocalName()))) { throw new BridgeException (ctx, imp, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { n }); } ImportRecord ir = new ImportRecord(imp, n); imports.put(imp, ir); NodeEventTarget et = (NodeEventTarget) imp; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", importAttrListener, false, null); et = (NodeEventTarget) n; et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", ir.importInsertedListener, false, null); et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", ir.importRemovedListener, false, null); et.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMSubtreeModified", ir.importSubtreeListener, false, null); addImportedDefinitions(imp, n); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
protected void initializeAnimation() { // Determine the target element. String uri = XLinkSupport.getXLinkHref(element); Node t; if (uri.length() == 0) { t = element.getParentNode(); } else { t = ctx.getReferencedElement(element, uri); if (t.getOwnerDocument() != element.getOwnerDocument()) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } } animationTarget = null; if (t instanceof SVGOMElement) { targetElement = (SVGOMElement) t; animationTarget = targetElement; } if (animationTarget == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } // Get the attribute/property name. String an = element.getAttributeNS(null, SVG_ATTRIBUTE_NAME_ATTRIBUTE); int ci = an.indexOf(':'); if (ci == -1) { if (element.hasProperty(an)) { animationType = AnimationEngine.ANIM_TYPE_CSS; attributeLocalName = an; } else { animationType = AnimationEngine.ANIM_TYPE_XML; attributeLocalName = an; } } else { animationType = AnimationEngine.ANIM_TYPE_XML; String prefix = an.substring(0, ci); attributeNamespaceURI = element.lookupNamespaceURI(prefix); attributeLocalName = an.substring(ci + 1); } if (animationType == AnimationEngine.ANIM_TYPE_CSS && !targetElement.isPropertyAnimatable(attributeLocalName) || animationType == AnimationEngine.ANIM_TYPE_XML && !targetElement.isAttributeAnimatable(attributeNamespaceURI, attributeLocalName)) { throw new BridgeException (ctx, element, "attribute.not.animatable", new Object[] { targetElement.getNodeName(), an }); } // Check that the attribute/property is animatable with this // animation element. int type; if (animationType == AnimationEngine.ANIM_TYPE_CSS) { type = targetElement.getPropertyType(attributeLocalName); } else { type = targetElement.getAttributeType(attributeNamespaceURI, attributeLocalName); } if (!canAnimateType(type)) { throw new BridgeException (ctx, element, "type.not.animatable", new Object[] { targetElement.getNodeName(), an, element.getNodeName() }); } // Add the animation. timedElement = createTimedElement(); animation = createAnimation(animationTarget); eng.addAnimation(animationTarget, animationType, attributeNamespaceURI, attributeLocalName, animation); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
protected AnimatableValue parseAnimatableValue(String an) { if (!element.hasAttributeNS(null, an)) { return null; } String s = element.getAttributeNS(null, an); AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, animationType == AnimationEngine.ANIM_TYPE_CSS, s); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { an, s }); } return val; }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { boolean rebuild = false; if (alav.getNamespaceURI() == null) { String ln = alav.getLocalName(); if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) { rebuild = true; } else if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; // X & Y are ignored on outermost SVG. boolean isOutermost = doc.getRootElement() == e; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); float y = _y.getCheckedValue(); AffineTransform positionTransform = AffineTransform.getTranslateInstance(x, y); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; cgn.setPositionTransform(positionTransform); return; } } else if (ln.equals(SVG_VIEW_BOX_ATTRIBUTE) || ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { SVGDocument doc = (SVGDocument)e.getOwnerDocument(); SVGOMSVGElement se = (SVGOMSVGElement) e; boolean isOutermost = doc.getRootElement() == e; // X & Y are ignored on outermost SVG. float x = 0; float y = 0; if (!isOutermost) { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) se.getX(); x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) se.getY(); y = _y.getCheckedValue(); } // 'width' attribute - default is 100% AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) se.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - default is 100% AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) se.getHeight(); float h = _height.getCheckedValue(); CanvasGraphicsNode cgn; cgn = (CanvasGraphicsNode)node; // 'viewBox' and "preserveAspectRatio' attributes SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox(); SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio(); AffineTransform newVT = ViewBox.getPreserveAspectRatioTransform (e, vb, par, w, h, ctx); AffineTransform oldVT = cgn.getViewingTransform(); if ((newVT.getScaleX() != oldVT.getScaleX()) || (newVT.getScaleY() != oldVT.getScaleY()) || (newVT.getShearX() != oldVT.getShearX()) || (newVT.getShearY() != oldVT.getShearY())) rebuild = true; else { // Only differs in translate. cgn.setViewingTransform(newVT); // 'overflow' and 'clip' Shape clip = null; if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { // clip:auto clip = new Rectangle2D.Float(x, y, w, h); } else { // clip:rect(<x> <y> <w> <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { AffineTransform at; at = cgn.getPositionTransform(); if (at == null) at = new AffineTransform(); else at = new AffineTransform(at); at.concatenate(newVT); at = at.createInverse(); // clip in user space clip = at.createTransformedShape(clip); Filter filter = cgn.getGraphicsNodeRable(true); cgn.setClip(new ClipRable8Bit(filter, clip)); } catch (NoninvertibleTransformException ex) {} } } } if (rebuild) { CompositeGraphicsNode gn = node.getParent(); gn.remove(node); disposeTree(e, false); handleElementAdded(gn, e.getParentNode(), e); return; } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public SVGDocument getBrokenLinkDocument(Element e, String url, String message) { throw new BridgeException(ctx, e, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/bridge/SVGFeBlendElementBridge.java
protected static CompositeRule convertMode(Element filterElement, BridgeContext ctx) { String rule = filterElement.getAttributeNS(null, SVG_MODE_ATTRIBUTE); if (rule.length() == 0) { return CompositeRule.OVER; } if (SVG_NORMAL_VALUE.equals(rule)) { return CompositeRule.OVER; } if (SVG_MULTIPLY_VALUE.equals(rule)) { return CompositeRule.MULTIPLY; } if (SVG_SCREEN_VALUE.equals(rule)) { return CompositeRule.SCREEN; } if (SVG_DARKEN_VALUE.equals(rule)) { return CompositeRule.DARKEN; } if (SVG_LIGHTEN_VALUE.equals(rule)) { return CompositeRule.LIGHTEN; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_MODE_ATTRIBUTE, rule}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
public SVGFontFace createFontFace(BridgeContext ctx, Element fontFaceElement) { // get all the font-face attributes String familyNames = fontFaceElement.getAttributeNS (null, SVG_FONT_FAMILY_ATTRIBUTE); // units per em String unitsPerEmStr = fontFaceElement.getAttributeNS (null, SVG_UNITS_PER_EM_ATTRIBUTE); if (unitsPerEmStr.length() == 0) { unitsPerEmStr = SVG_FONT_FACE_UNITS_PER_EM_DEFAULT_VALUE; } float unitsPerEm; try { unitsPerEm = SVGUtilities.convertSVGNumber(unitsPerEmStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); } // font-weight String fontWeight = fontFaceElement.getAttributeNS (null, SVG_FONT_WEIGHT_ATTRIBUTE); if (fontWeight.length() == 0) { fontWeight = SVG_FONT_FACE_FONT_WEIGHT_DEFAULT_VALUE; } // font-style String fontStyle = fontFaceElement.getAttributeNS (null, SVG_FONT_STYLE_ATTRIBUTE); if (fontStyle.length() == 0) { fontStyle = SVG_FONT_FACE_FONT_STYLE_DEFAULT_VALUE; } // font-variant String fontVariant = fontFaceElement.getAttributeNS (null, SVG_FONT_VARIANT_ATTRIBUTE); if (fontVariant.length() == 0) { fontVariant = SVG_FONT_FACE_FONT_VARIANT_DEFAULT_VALUE; } // font-stretch String fontStretch = fontFaceElement.getAttributeNS (null, SVG_FONT_STRETCH_ATTRIBUTE); if (fontStretch.length() == 0) { fontStretch = SVG_FONT_FACE_FONT_STRETCH_DEFAULT_VALUE; } // slopeStr String slopeStr = fontFaceElement.getAttributeNS (null, SVG_SLOPE_ATTRIBUTE); if (slopeStr.length() == 0) { slopeStr = SVG_FONT_FACE_SLOPE_DEFAULT_VALUE; } float slope; try { slope = SVGUtilities.convertSVGNumber(slopeStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); } // panose-1 String panose1 = fontFaceElement.getAttributeNS (null, SVG_PANOSE_1_ATTRIBUTE); if (panose1.length() == 0) { panose1 = SVG_FONT_FACE_PANOSE_1_DEFAULT_VALUE; } // ascent String ascentStr = fontFaceElement.getAttributeNS (null, SVG_ASCENT_ATTRIBUTE); if (ascentStr.length() == 0) { // set it to be unitsPerEm * .8 ascentStr = String.valueOf( unitsPerEm * 0.8); } float ascent; try { ascent = SVGUtilities.convertSVGNumber(ascentStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); } // descent String descentStr = fontFaceElement.getAttributeNS (null, SVG_DESCENT_ATTRIBUTE); if (descentStr.length() == 0) { // set it to be unitsPerEm *.2. descentStr = String.valueOf(unitsPerEm*0.2); } float descent; try { descent = SVGUtilities.convertSVGNumber(descentStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); } // underline-position String underlinePosStr = fontFaceElement.getAttributeNS (null, SVG_UNDERLINE_POSITION_ATTRIBUTE); if (underlinePosStr.length() == 0) { underlinePosStr = String.valueOf(-3*unitsPerEm/40); } float underlinePos; try { underlinePos = SVGUtilities.convertSVGNumber(underlinePosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); } // underline-thickness String underlineThicknessStr = fontFaceElement.getAttributeNS (null, SVG_UNDERLINE_THICKNESS_ATTRIBUTE); if (underlineThicknessStr.length() == 0) { underlineThicknessStr = String.valueOf(unitsPerEm/20); } float underlineThickness; try { underlineThickness = SVGUtilities.convertSVGNumber(underlineThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); } // strikethrough-position String strikethroughPosStr = fontFaceElement.getAttributeNS (null, SVG_STRIKETHROUGH_POSITION_ATTRIBUTE); if (strikethroughPosStr.length() == 0) { strikethroughPosStr = String.valueOf(3*ascent/8); } float strikethroughPos; try { strikethroughPos = SVGUtilities.convertSVGNumber(strikethroughPosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); } // strikethrough-thickness String strikethroughThicknessStr = fontFaceElement.getAttributeNS (null, SVG_STRIKETHROUGH_THICKNESS_ATTRIBUTE); if (strikethroughThicknessStr.length() == 0) { strikethroughThicknessStr = String.valueOf(unitsPerEm/20); } float strikethroughThickness; try { strikethroughThickness = SVGUtilities.convertSVGNumber(strikethroughThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); } // overline-position String overlinePosStr = fontFaceElement.getAttributeNS (null, SVG_OVERLINE_POSITION_ATTRIBUTE); if (overlinePosStr.length() == 0) { overlinePosStr = String.valueOf(ascent); } float overlinePos; try { overlinePos = SVGUtilities.convertSVGNumber(overlinePosStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); } // overline-thickness String overlineThicknessStr = fontFaceElement.getAttributeNS (null, SVG_OVERLINE_THICKNESS_ATTRIBUTE); if (overlineThicknessStr.length() == 0) { overlineThicknessStr = String.valueOf(unitsPerEm/20); } float overlineThickness; try { overlineThickness = SVGUtilities.convertSVGNumber(overlineThicknessStr); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); } List srcs = null; Element fontElt = SVGUtilities.getParentElement(fontFaceElement); if (!fontElt.getNamespaceURI().equals(SVG_NAMESPACE_URI) || !fontElt.getLocalName().equals(SVG_FONT_TAG)) { srcs = getFontFaceSrcs(fontFaceElement); } // TODO: get the rest of the attributes return new SVGFontFace(fontFaceElement, srcs, familyNames, unitsPerEm, fontWeight, fontStyle, fontVariant, fontStretch, slope, panose1, ascent, descent, strikethroughPos, strikethroughThickness, underlinePos, underlineThickness, overlinePos, overlineThickness); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getViewTransform(String ref, Element e, float w, float h, BridgeContext ctx) { // no reference has been specified, no extra viewBox is defined if (ref == null || ref.length() == 0) { return getPreserveAspectRatioTransform(e, w, h, ctx); } ViewHandler vh = new ViewHandler(); FragmentIdentifierParser p = new FragmentIdentifierParser(); p.setFragmentIdentifierHandler(vh); p.parse(ref); // Determine the 'view' element that ref refers to. Element viewElement = e; if (vh.hasId) { Document document = e.getOwnerDocument(); viewElement = document.getElementById(vh.id); } if (viewElement == null) { throw new BridgeException(ctx, e, ERR_URI_MALFORMED, new Object[] {ref}); } if (!(viewElement.getNamespaceURI().equals(SVG_NAMESPACE_URI) && viewElement.getLocalName().equals(SVG_VIEW_TAG))) { viewElement = null; } Element ancestorSVG = getClosestAncestorSVGElement(e); // 'viewBox' float[] vb; if (vh.hasViewBox) { vb = vh.viewBox; } else { Element elt; if (DOMUtilities.isAttributeSpecifiedNS (viewElement, null, SVG_VIEW_BOX_ATTRIBUTE)) { elt = viewElement; } else { elt = ancestorSVG; } String viewBoxStr = elt.getAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE); vb = parseViewBoxAttribute(elt, viewBoxStr, ctx); } // 'preserveAspectRatio' short align; boolean meet; if (vh.hasPreserveAspectRatio) { align = vh.align; meet = vh.meet; } else { Element elt; if (DOMUtilities.isAttributeSpecifiedNS (viewElement, null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { elt = viewElement; } else { elt = ancestorSVG; } String aspectRatio = elt.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); PreserveAspectRatioParser pp = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); pp.setPreserveAspectRatioHandler(ph); try { pp.parse(aspectRatio); } catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } align = ph.align; meet = ph.meet; } // the additional transform that may appear on the URI AffineTransform transform = getPreserveAspectRatioTransform(vb, align, meet, w, h); if (vh.hasTransform) { transform.concatenate(vh.getAffineTransform()); } return transform; }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform(Element e, String viewBox, String aspectRatio, float w, float h, BridgeContext ctx) { // no viewBox specified if (viewBox.length() == 0) { return new AffineTransform(); } float[] vb = parseViewBoxAttribute(e, viewBox, ctx); // 'preserveAspectRatio' attribute PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform(Element e, float[] vb, float w, float h, BridgeContext ctx) { String aspectRatio = e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); // 'preserveAspectRatio' attribute PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
// in sources/org/apache/batik/bridge/ViewBox.java
public static AffineTransform getPreserveAspectRatioTransform (Element e, float[] vb, float w, float h, SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) { // 'preserveAspectRatio' attribute try { SVGPreserveAspectRatio pAR = aPAR.getAnimVal(); short align = pAR.getAlign(); boolean meet = pAR.getMeetOrSlice() == SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; return getPreserveAspectRatioTransform(vb, align, meet, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/ViewBox.java
public static float[] parseViewBoxAttribute(Element e, String value, BridgeContext ctx) { if (value.length() == 0) { return null; } int i = 0; float[] vb = new float[4]; StringTokenizer st = new StringTokenizer(value, " ,"); try { while (i < 4 && st.hasMoreTokens()) { vb[i] = Float.parseFloat(st.nextToken()); i++; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); } if (i != 4) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value}); } // A negative value for <width> or <height> is an error if (vb[2] < 0 || vb[3] < 0) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value}); } // A value of zero for width or height disables rendering of the element if (vb[2] == 0 || vb[3] == 0) { return null; // <!> FIXME : must disable ! } return vb; }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
protected static double[] convertKernelUnitLength(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE); if (s.length() == 0) { return null; } double [] units = new double[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { units[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { units[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { units[1] = units[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } if (tokens.hasMoreTokens() || units[0] <= 0 || units[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } return units; }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
protected static MultipleGradientPaint.CycleMethodEnum convertSpreadMethod (Element paintElement, String s, BridgeContext ctx) { if (SVG_REPEAT_VALUE.equals(s)) { return MultipleGradientPaint.REPEAT; } if (SVG_REFLECT_VALUE.equals(s)) { return MultipleGradientPaint.REFLECT; } if (SVG_PAD_VALUE.equals(s)) { return MultipleGradientPaint.NO_CYCLE; } throw new BridgeException (ctx, paintElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPREAD_METHOD_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
protected static List extractStop(Element paintElement, float opacity, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { List stops = extractLocalStop(paintElement, opacity, ctx); if (stops != null) { return stops; // stop elements found, exit } String uri = XLinkSupport.getXLinkHref(paintElement); if (uri.length() == 0) { return null; // no xlink:href found, exit } // check if there is circular dependencies String baseURI = ((AbstractNode) paintElement).getBaseURI(); ParsedURL purl = new ParsedURL(baseURI, uri); if (contains(refs, purl)) { throw new BridgeException(ctx, paintElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(purl); paintElement = ctx.getReferencedElement(paintElement, uri); } }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
public Stop createStop(BridgeContext ctx, Element gradientElement, Element stopElement, float opacity) { String s = stopElement.getAttributeNS(null, SVG_OFFSET_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException (ctx, stopElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_OFFSET_ATTRIBUTE}); } float offset; try { offset = SVGUtilities.convertRatio(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); } Color color = CSSUtilities.convertStopColor(stopElement, opacity, ctx); return new Stop(color, offset); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float[][] convertValuesToMatrix(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); float [][] matrix = new float[4][5]; if (s.length() == 0) { matrix[0][0] = 1; matrix[1][1] = 1; matrix[2][2] = 1; matrix[3][3] = 1; return matrix; } StringTokenizer tokens = new StringTokenizer(s, " ,"); int n = 0; try { while (n < 20 && tokens.hasMoreTokens()) { matrix[n/5][n%5] = SVGUtilities.convertSVGNumber(tokens.nextToken()); n++; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); } if (n != 20 || tokens.hasMoreTokens()) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } for (int i = 0; i < 4; ++i) { matrix[i][4] *= 255; } return matrix; }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float convertValuesToSaturate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 1; // default is 1 try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static float convertValuesToHueRotate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 0; // default is 0 try { return (float) Math.toRadians( SVGUtilities.convertSVGNumber(s) ); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
protected static int convertType(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { return ColorMatrixRable.TYPE_MATRIX; } if (SVG_HUE_ROTATE_VALUE.equals(s)) { return ColorMatrixRable.TYPE_HUE_ROTATE; } if (SVG_LUMINANCE_TO_ALPHA_VALUE.equals(s)) { return ColorMatrixRable.TYPE_LUMINANCE_TO_ALPHA; } if (SVG_MATRIX_VALUE.equals(s)) { return ColorMatrixRable.TYPE_MATRIX; } if (SVG_SATURATE_VALUE.equals(s)) { return ColorMatrixRable.TYPE_SATURATE; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeDisplacementMapElementBridge.java
protected static ARGBChannel convertChannelSelector(Element filterElement, String attrName, ARGBChannel defaultChannel, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultChannel; } if (SVG_A_VALUE.equals(s)) { return ARGBChannel.A; } if (SVG_R_VALUE.equals(s)) { return ARGBChannel.R; } if (SVG_G_VALUE.equals(s)) { return ARGBChannel.G; } if (SVG_B_VALUE.equals(s)) { return ARGBChannel.B; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
protected AffineTransform computeTransform(SVGTransformable te, BridgeContext ctx) { try { AffineTransform at = new AffineTransform(); // 'transform' SVGOMAnimatedTransformList atl = (SVGOMAnimatedTransformList) te.getTransform(); if (atl.isSpecified()) { atl.check(); AbstractSVGTransformList tl = (AbstractSVGTransformList) te.getTransform().getAnimVal(); at.concatenate(tl.getAffineTransform()); } // motion animation if (e instanceof SVGMotionAnimatableElement) { SVGMotionAnimatableElement mae = (SVGMotionAnimatableElement) e; AffineTransform mat = mae.getMotionTransform(); if (mat != null) { at.concatenate(mat); } } return at; } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/CursorManager.java
public Cursor convertSVGCursorElement(Element cursorElement) { // One of the cursor url resolved to a <cursor> element // Try to handle its image. String uriStr = XLinkSupport.getXLinkHref(cursorElement); if (uriStr.length() == 0) { throw new BridgeException(ctx, cursorElement, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } String baseURI = AbstractNode.getBaseURI(cursorElement); ParsedURL purl; if (baseURI == null) { purl = new ParsedURL(uriStr); } else { purl = new ParsedURL(baseURI, uriStr); } // // Convert the cursor's hot spot // UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, cursorElement); String s = cursorElement.getAttributeNS(null, SVG_X_ATTRIBUTE); float x = 0; if (s.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_X_ATTRIBUTE, uctx); } s = cursorElement.getAttributeNS(null, SVG_Y_ATTRIBUTE); float y = 0; if (s.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_Y_ATTRIBUTE, uctx); } CursorDescriptor desc = new CursorDescriptor(purl, x, y); // // Check if there is a cursor in the cache for this url // Cursor cachedCursor = cursorCache.getCursor(desc); if (cachedCursor != null) { return cachedCursor; } // // Load image into Filter f and transform hotSpot to // cursor space. // Point2D.Float hotSpot = new Point2D.Float(x, y); Filter f = cursorHrefToFilter(cursorElement, purl, hotSpot); if (f == null) { cursorCache.clearCursor(desc); return null; } // The returned Filter is guaranteed to create a // default rendering of the desired size Rectangle cursorSize = f.getBounds2D().getBounds(); RenderedImage ri = f.createScaledRendering(cursorSize.width, cursorSize.height, null); Image img = null; if (ri instanceof Image) { img = (Image)ri; } else { img = renderedImageToImage(ri); } // Make sure the not spot does not fall out of the cursor area. If it // does, then clamp the coordinates to the image space. hotSpot.x = hotSpot.x < 0 ? 0 : hotSpot.x; hotSpot.y = hotSpot.y < 0 ? 0 : hotSpot.y; hotSpot.x = hotSpot.x > (cursorSize.width-1) ? cursorSize.width - 1 : hotSpot.x; hotSpot.y = hotSpot.y > (cursorSize.height-1) ? cursorSize.height - 1: hotSpot.y; // // The cursor image is now into 'img' // Cursor c = Toolkit.getDefaultToolkit() .createCustomCursor(img, new Point(Math.round(hotSpot.x), Math.round(hotSpot.y)), purl.toString()); cursorCache.putCursor(desc, c); return c; }
// in sources/org/apache/batik/bridge/CursorManager.java
protected Filter cursorHrefToFilter(Element cursorElement, ParsedURL purl, Point2D hotSpot) { AffineRable8Bit f = null; String uriStr = purl.toString(); Dimension cursorSize = null; // Try to load as an SVG Document DocumentLoader loader = ctx.getDocumentLoader(); SVGDocument svgDoc = (SVGDocument)cursorElement.getOwnerDocument(); URIResolver resolver = ctx.createURIResolver(svgDoc, loader); try { Element rootElement = null; Node n = resolver.getNode(uriStr, cursorElement); if (n.getNodeType() == Node.DOCUMENT_NODE) { SVGDocument doc = (SVGDocument)n; // FIXX: really should be subCtx here. ctx.initializeDocument(doc); rootElement = doc.getRootElement(); } else { throw new BridgeException (ctx, cursorElement, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } GraphicsNode node = ctx.getGVTBuilder().build(ctx, rootElement); // // The cursorSize define the viewport into which the // cursor is displayed. That viewport is platform // dependant and is not defined by the SVG content. // float width = DEFAULT_PREFERRED_WIDTH; float height = DEFAULT_PREFERRED_HEIGHT; UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, rootElement); String s = rootElement.getAttribute(SVG_WIDTH_ATTRIBUTE); if (s.length() != 0) { width = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_WIDTH_ATTRIBUTE, uctx); } s = rootElement.getAttribute(SVG_HEIGHT_ATTRIBUTE); if (s.length() != 0) { height = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_HEIGHT_ATTRIBUTE, uctx); } cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize (Math.round(width), Math.round(height)); // Handle the viewBox transform AffineTransform at = ViewBox.getPreserveAspectRatioTransform (rootElement, cursorSize.width, cursorSize.height, ctx); Filter filter = node.getGraphicsNodeRable(true); f = new AffineRable8Bit(filter, at); } catch (BridgeException ex) { throw ex; } catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); } catch (Exception ex) { /* Nothing to do */ } // If f is null, it means that we are not dealing with // an SVG image. Try as a raster image. if (f == null) { ImageTagRegistry reg = ImageTagRegistry.getRegistry(); Filter filter = reg.readURL(purl); if (filter == null) { return null; } // Check if we got a broken image if (BrokenLinkProvider.hasBrokenLinkProperty(filter)) { return null; } Rectangle preferredSize = filter.getBounds2D().getBounds(); cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize (preferredSize.width, preferredSize.height); if (preferredSize != null && preferredSize.width >0 && preferredSize.height > 0 ) { AffineTransform at = new AffineTransform(); if (preferredSize.width > cursorSize.width || preferredSize.height > cursorSize.height) { at = ViewBox.getPreserveAspectRatioTransform (new float[] {0, 0, preferredSize.width, preferredSize.height}, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN, true, cursorSize.width, cursorSize.height); } f = new AffineRable8Bit(filter, at); } else { // Invalid Size return null; } } // // Transform the hot spot from image space to cursor space // AffineTransform at = f.getAffine(); at.transform(hotSpot, hotSpot); // // In all cases, clip to the cursor boundaries // Rectangle cursorViewport = new Rectangle(0, 0, cursorSize.width, cursorSize.height); PadRable8Bit cursorImage = new PadRable8Bit(f, cursorViewport, PadMode.ZERO_PAD); return cursorImage; }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { SVGOMPolygonElement pe = (SVGOMPolygonElement) e; try { SVGOMAnimatedPoints _points = pe.getSVGOMAnimatedPoints(); _points.check(); SVGPointList pl = _points.getAnimatedPoints(); int size = pl.getNumberOfItems(); if (size == 0) { shapeNode.setShape(DEFAULT_SHAPE); } else { AWTPolygonProducer app = new AWTPolygonProducer(); app.setWindingRule(CSSUtilities.convertFillRule(e)); app.startPoints(); for (int i = 0; i < size; i++) { SVGPoint p = pl.getItem(i); app.point(p.getX(), p.getY()); } app.endPoints(); shapeNode.setShape(app.getShape()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static int[] convertOrder(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_ORDER_ATTRIBUTE); if (s.length() == 0) { return new int[] {3, 3}; } int [] orderXY = new int[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { orderXY[0] = SVGUtilities.convertSVGInteger(tokens.nextToken()); if (tokens.hasMoreTokens()) { orderXY[1] = SVGUtilities.convertSVGInteger(tokens.nextToken()); } else { orderXY[1] = orderXY[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens() || orderXY[0] <= 0 || orderXY[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s}); } return orderXY; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static float[] convertKernelMatrix(Element filterElement, int[] orderXY, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_KERNEL_MATRIX_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE}); } int size = orderXY[0]*orderXY[1]; float [] kernelMatrix = new float[size]; StringTokenizer tokens = new StringTokenizer(s, " ,"); int i = 0; try { while (tokens.hasMoreTokens() && i < size) { kernelMatrix[i++] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); } if (i != size) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s}); } return kernelMatrix; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static float convertDivisor(Element filterElement, float[] kernelMatrix, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_DIVISOR_ATTRIBUTE); if (s.length() == 0) { // default is sum of kernel values (if sum is zero then 1.0) float sum = 0; for (int i=0; i < kernelMatrix.length; ++i) { sum += kernelMatrix[i]; } return (sum == 0) ? 1.0f : sum; } else { try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); } } }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static int[] convertTarget(Element filterElement, int[] orderXY, BridgeContext ctx) { int[] targetXY = new int[2]; // 'targetX' attribute - default is floor(orderX / 2) String s = filterElement.getAttributeNS(null, SVG_TARGET_X_ATTRIBUTE); if (s.length() == 0) { targetXY[0] = orderXY[0] / 2; } else { try { int v = SVGUtilities.convertSVGInteger(s); if (v < 0 || v >= orderXY[0]) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s}); } targetXY[0] = v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); } } // 'targetY' attribute - default is floor(orderY / 2) s = filterElement.getAttributeNS(null, SVG_TARGET_Y_ATTRIBUTE); if (s.length() == 0) { targetXY[1] = orderXY[1] / 2; } else { try { int v = SVGUtilities.convertSVGInteger(s); if (v < 0 || v >= orderXY[1]) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s}); } targetXY[1] = v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); } } return targetXY; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static double[] convertKernelUnitLength(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE); if (s.length() == 0) { return null; } double [] units = new double[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { units[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { units[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { units[1] = units[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } if (tokens.hasMoreTokens() || units[0] <= 0 || units[1] <= 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); } return units; }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static PadMode convertEdgeMode(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_EDGE_MODE_ATTRIBUTE); if (s.length() == 0) { return PadMode.REPLICATE; } if (SVG_DUPLICATE_VALUE.equals(s)) { return PadMode.REPLICATE; } if (SVG_WRAP_VALUE.equals(s)) { return PadMode.WRAP; } if (SVG_NONE_VALUE.equals(s)) { return PadMode.ZERO_PAD; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_EDGE_MODE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
protected static boolean convertPreserveAlpha(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_PRESERVE_ALPHA_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_TRUE_VALUE.equals(s)) { return true; } if (SVG_FALSE_VALUE.equals(s)) { return false; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ALPHA_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFilterElementBridge.java
protected static Filter buildFilterPrimitives(Element filterElement, Rectangle2D filterRegion, Element filteredElement, GraphicsNode filteredNode, Filter in, Map filterNodeMap, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { Filter newIn = buildLocalFilterPrimitives(filterElement, filterRegion, filteredElement, filteredNode, in, filterNodeMap, ctx); if (newIn != in) { return newIn; // filter primitives found, exit } String uri = XLinkSupport.getXLinkHref(filterElement); if (uri.length() == 0) { return in; // no xlink:href found, exit } // check if there is circular dependencies SVGOMDocument doc = (SVGOMDocument)filterElement.getOwnerDocument(); ParsedURL url = new ParsedURL(doc.getURLObject(), uri); if (refs.contains(url)) { throw new BridgeException(ctx, filterElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(url); filterElement = ctx.getReferencedElement(filterElement, uri); } }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
public ICCColorSpaceExt createICCColorSpaceExt(BridgeContext ctx, Element paintedElement, String iccProfileName) { // Check if there is one if the cache. ICCColorSpaceExt cs = cache.request(iccProfileName.toLowerCase()); // todo locale?? if (cs != null){ return cs; } // There was no cached copies for the profile. Load it now. // Search for a color-profile element with specific name Document doc = paintedElement.getOwnerDocument(); NodeList list = doc.getElementsByTagNameNS(SVG_NAMESPACE_URI, SVG_COLOR_PROFILE_TAG); int n = list.getLength(); Element profile = null; for(int i=0; i<n; i++){ Node node = list.item(i); if(node.getNodeType() == Node.ELEMENT_NODE){ Element profileNode = (Element)node; String nameAttr = profileNode.getAttributeNS(null, SVG_NAME_ATTRIBUTE); if(iccProfileName.equalsIgnoreCase(nameAttr)){ profile = profileNode; } } } if(profile == null) return null; // Now that we have a profile element, // try to load the corresponding ICC profile xlink:href String href = XLinkSupport.getXLinkHref(profile); ICC_Profile p = null; if (href != null) { String baseURI = ((AbstractNode) profile).getBaseURI(); ParsedURL pDocURL = null; if (baseURI != null) { pDocURL = new ParsedURL(baseURI); } ParsedURL purl = new ParsedURL(pDocURL, href); if (!purl.complete()) throw new BridgeException(ctx, paintedElement, ERR_URI_MALFORMED, new Object[] {href}); try { ctx.getUserAgent().checkLoadExternalResource(purl, pDocURL); p = ICC_Profile.getInstance(purl.openStream()); } catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? } catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); } } if (p == null) { return null; } // Extract the rendering intent from profile element int intent = convertIntent(profile, ctx); cs = new ICCColorSpaceExt(p, intent); // Add profile to cache cache.put(iccProfileName.toLowerCase(), cs); return cs; }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
private static int convertIntent(Element profile, BridgeContext ctx) { String intent = profile.getAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE); if (intent.length() == 0) { return ICCColorSpaceExt.AUTO; } if (SVG_PERCEPTUAL_VALUE.equals(intent)) { return ICCColorSpaceExt.PERCEPTUAL; } if (SVG_AUTO_VALUE.equals(intent)) { return ICCColorSpaceExt.AUTO; } if (SVG_RELATIVE_COLORIMETRIC_VALUE.equals(intent)) { return ICCColorSpaceExt.RELATIVE_COLORIMETRIC; } if (SVG_ABSOLUTE_COLORIMETRIC_VALUE.equals(intent)) { return ICCColorSpaceExt.ABSOLUTE_COLORIMETRIC; } if (SVG_SATURATION_VALUE.equals(intent)) { return ICCColorSpaceExt.SATURATION; } throw new BridgeException (ctx, profile, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RENDERING_INTENT_ATTRIBUTE, intent}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
protected static float[] convertRadius(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_RADIUS_ATTRIBUTE); if (s.length() == 0) { return new float[] {0, 0}; } float [] radii = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { radii[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { radii[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { radii[1] = radii[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens() || radii[0] < 0 || radii[1] < 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s}); } return radii; }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
protected static boolean convertOperator(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_OPERATOR_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_ERODE_VALUE.equals(s)) { return false; } if (SVG_DILATE_VALUE.equals(s)) { return true; } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OPERATOR_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
public Glyph createGlyph(BridgeContext ctx, Element glyphElement, Element textElement, int glyphCode, float fontSize, GVTFontFace fontFace, TextPaintInfo tpi) { float fontHeight = fontFace.getUnitsPerEm(); float scale = fontSize/fontHeight; AffineTransform scaleTransform = AffineTransform.getScaleInstance(scale, -scale); // create a shape that represents the d attribute String d = glyphElement.getAttributeNS(null, SVG_D_ATTRIBUTE); Shape dShape = null; if (d.length() != 0) { AWTPathProducer app = new AWTPathProducer(); // Glyph is supposed to use properties from text element. app.setWindingRule(CSSUtilities.convertFillRule(textElement)); try { PathParser pathParser = new PathParser(); pathParser.setPathHandler(app); pathParser.parse(d); } catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); } finally { // transform the shape into the correct coord system Shape shape = app.getShape(); Shape transformedShape = scaleTransform.createTransformedShape(shape); dShape = transformedShape; } } // process any glyph children // first see if there are any, because don't want to do the following // bit of code if we can avoid it NodeList glyphChildren = glyphElement.getChildNodes(); int numChildren = glyphChildren.getLength(); int numGlyphChildren = 0; for (int i = 0; i < numChildren; i++) { Node childNode = glyphChildren.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { numGlyphChildren++; } } CompositeGraphicsNode glyphContentNode = null; if (numGlyphChildren > 0) { // the glyph has child elements // build the GVT tree that represents the glyph children GVTBuilder builder = ctx.getGVTBuilder(); glyphContentNode = new CompositeGraphicsNode(); // // need to clone the parent font element and glyph element // this is so that the glyph doesn't inherit anything past the font element // Element fontElementClone = (Element)glyphElement.getParentNode().cloneNode(false); // copy all font attributes over NamedNodeMap fontAttributes = glyphElement.getParentNode().getAttributes(); int numAttributes = fontAttributes.getLength(); for (int i = 0; i < numAttributes; i++) { fontElementClone.setAttributeNode((Attr)fontAttributes.item(i)); } Element clonedGlyphElement = (Element)glyphElement.cloneNode(true); fontElementClone.appendChild(clonedGlyphElement); textElement.appendChild(fontElementClone); CompositeGraphicsNode glyphChildrenNode = new CompositeGraphicsNode(); glyphChildrenNode.setTransform(scaleTransform); NodeList clonedGlyphChildren = clonedGlyphElement.getChildNodes(); int numClonedChildren = clonedGlyphChildren.getLength(); for (int i = 0; i < numClonedChildren; i++) { Node childNode = clonedGlyphChildren.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element)childNode; GraphicsNode childGraphicsNode = builder.build(ctx, childElement); glyphChildrenNode.add(childGraphicsNode); } } glyphContentNode.add(glyphChildrenNode); textElement.removeChild(fontElementClone); } // set up glyph attributes // unicode String unicode = glyphElement.getAttributeNS(null, SVG_UNICODE_ATTRIBUTE); // glyph-name String nameList = glyphElement.getAttributeNS(null, SVG_GLYPH_NAME_ATTRIBUTE); List names = new ArrayList(); StringTokenizer st = new StringTokenizer(nameList, " ,"); while (st.hasMoreTokens()) { names.add(st.nextToken()); } // orientation String orientation = glyphElement.getAttributeNS(null, SVG_ORIENTATION_ATTRIBUTE); // arabicForm String arabicForm = glyphElement.getAttributeNS(null, SVG_ARABIC_FORM_ATTRIBUTE); // lang String lang = glyphElement.getAttributeNS(null, SVG_LANG_ATTRIBUTE); Element parentFontElement = (Element)glyphElement.getParentNode(); // horz-adv-x String s = glyphElement.getAttributeNS(null, SVG_HORIZ_ADV_X_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ADV_X_ATTRIBUTE); if (s.length() == 0) { // throw an exception since this attribute is required on the font element throw new BridgeException (ctx, parentFontElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HORIZ_ADV_X_ATTRIBUTE}); } } float horizAdvX; try { horizAdvX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); } // vert-adv-y s = glyphElement.getAttributeNS(null, SVG_VERT_ADV_Y_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ADV_Y_ATTRIBUTE); if (s.length() == 0) { // not specified on parent either, use one em s = String.valueOf(fontFace.getUnitsPerEm()); } } float vertAdvY; try { vertAdvY = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); } // vert-origin-x s = glyphElement.getAttributeNS(null, SVG_VERT_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is horizAdvX/2 s = Float.toString(horizAdvX/2); } } float vertOriginX; try { vertOriginX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); } // vert-origin-y s = glyphElement.getAttributeNS(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // look for attribute on parent font element s = parentFontElement.getAttributeNS(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is the fonts ascent s = String.valueOf(fontFace.getAscent()); } } float vertOriginY; try { vertOriginY = SVGUtilities.convertSVGNumber(s) * -scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); } Point2D vertOrigin = new Point2D.Float(vertOriginX, vertOriginY); // get the horizontal origin from the parent font element // horiz-origin-x s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ORIGIN_X_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is 0 s = SVG_HORIZ_ORIGIN_X_DEFAULT_VALUE; } float horizOriginX; try { horizOriginX = SVGUtilities.convertSVGNumber(s) * scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); } // horiz-origin-y s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ORIGIN_Y_ATTRIBUTE); if (s.length() == 0) { // not specified so use the default value which is 0 s = SVG_HORIZ_ORIGIN_Y_DEFAULT_VALUE; } float horizOriginY; try { horizOriginY = SVGUtilities.convertSVGNumber(s) * -scale; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); } Point2D horizOrigin = new Point2D.Float(horizOriginX, horizOriginY); // return a new Glyph return new Glyph(unicode, names, orientation, arabicForm, lang, horizOrigin, vertOrigin, horizAdvX, vertAdvY, glyphCode, tpi, dShape, glyphContentNode); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Point2D getLocation(BridgeContext ctx, Element e) { try { SVGOMTextPositioningElement te = (SVGOMTextPositioningElement) e; // 'x' attribute - default is 0 SVGOMAnimatedLengthList _x = (SVGOMAnimatedLengthList) te.getX(); _x.check(); SVGLengthList xs = _x.getAnimVal(); float x = 0; if (xs.getNumberOfItems() > 0) { x = xs.getItem(0).getValue(); } // 'y' attribute - default is 0 SVGOMAnimatedLengthList _y = (SVGOMAnimatedLengthList) te.getY(); _y.check(); SVGLengthList ys = _y.getAnimVal(); float y = 0; if (ys.getNumberOfItems() > 0) { y = ys.getItem(0).getValue(); } return new Point2D.Float(x, y); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected void addGlyphPositionAttributes(AttributedString as, Element element, BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || (!CSSUtilities.convertDisplay(element))) { return; } if (element.getLocalName().equals(SVG_TEXT_PATH_TAG)) { // 'textPath' doesn't support position attributes. addChildGlyphPositionAttributes(as, element, ctx); return; } // calculate which chars in the string belong to this element int firstChar = getElementStartIndex(element); // No match so no chars to annotate. if (firstChar == -1) return; int lastChar = getElementEndIndex(element); // 'a' elements aren't SVGTextPositioningElements, so don't process // their positioning attributes on them. if (!(element instanceof SVGTextPositioningElement)) { addChildGlyphPositionAttributes(as, element, ctx); return; } // get all of the glyph position attribute values SVGTextPositioningElement te = (SVGTextPositioningElement) element; try { SVGOMAnimatedLengthList _x = (SVGOMAnimatedLengthList) te.getX(); _x.check(); SVGOMAnimatedLengthList _y = (SVGOMAnimatedLengthList) te.getY(); _y.check(); SVGOMAnimatedLengthList _dx = (SVGOMAnimatedLengthList) te.getDx(); _dx.check(); SVGOMAnimatedLengthList _dy = (SVGOMAnimatedLengthList) te.getDy(); _dy.check(); SVGOMAnimatedNumberList _rotate = (SVGOMAnimatedNumberList) te.getRotate(); _rotate.check(); SVGLengthList xs = _x.getAnimVal(); SVGLengthList ys = _y.getAnimVal(); SVGLengthList dxs = _dx.getAnimVal(); SVGLengthList dys = _dy.getAnimVal(); SVGNumberList rs = _rotate.getAnimVal(); int len; // process the x attribute len = xs.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.X, new Float(xs.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process the y attribute len = ys.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.Y, new Float(ys.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process dx attribute len = dxs.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.DX, new Float(dxs.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process dy attribute len = dys.getNumberOfItems(); for (int i = 0; i < len && firstChar + i <= lastChar; i++) { as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.DY, new Float(dys.getItem(i).getValue()), firstChar + i, firstChar + i + 1); } // process rotate attribute len = rs.getNumberOfItems(); if (len == 1) { // not a list // each char will have the same rotate value Float rad = new Float(Math.toRadians(rs.getItem(0).getValue())); as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.ROTATION, rad, firstChar, lastChar + 1); } else if (len > 1) { // it's a list // set each rotate value from the list for (int i = 0; i < len && firstChar + i <= lastChar; i++) { Float rad = new Float(Math.toRadians(rs.getItem(i).getValue())); as.addAttribute (GVTAttributedCharacterIterator.TextAttribute.ROTATION, rad, firstChar + i, firstChar + i + 1); } } addChildGlyphPositionAttributes(as, element, ctx); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Map getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result) { SVGTextContentElement tce = null; if (element instanceof SVGTextContentElement) { // 'a' elements aren't SVGTextContentElements, so they shouldn't // be checked for 'textLength' or 'lengthAdjust' attributes. tce = (SVGTextContentElement) element; } Map inheritMap = null; String s; if (SVG_NAMESPACE_URI.equals(element.getNamespaceURI()) && element.getLocalName().equals(SVG_ALT_GLYPH_TAG)) { result.put(ALT_GLYPH_HANDLER, new SVGAltGlyphHandler(ctx, element)); } // Add null TPI objects to the text (after we set it on the // Text we will swap in the correct values. TextPaintInfo pi = new TextPaintInfo(); // Set some basic props so we can get bounds info for complex paints. pi.visible = true; pi.fillPaint = Color.black; result.put(PAINT_INFO, pi); elemTPI.put(element, pi); if (textPath != null) { result.put(TEXTPATH, textPath); } // Text-anchor TextNode.Anchor a = TextUtilities.convertTextAnchor(element); result.put(ANCHOR_TYPE, a); // Font family List fontList = getFontList(ctx, element, result); result.put(GVT_FONTS, fontList); // Text baseline adjustment. Object bs = TextUtilities.convertBaselineShift(element); if (bs != null) { result.put(BASELINE_SHIFT, bs); } // Unicode-bidi mode Value val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.UNICODE_BIDI_INDEX); s = val.getStringValue(); if (s.charAt(0) == 'n') { if (bidiLevel != null) result.put(TextAttribute.BIDI_EMBEDDING, bidiLevel); } else { // Text direction // XXX: this needs to coordinate with the unicode-bidi // property, so that when an explicit reversal // occurs, the BIDI_EMBEDDING level is // appropriately incremented or decremented. // Note that direction is implicitly handled by unicode // BiDi algorithm in most cases, this property // is only needed when one wants to override the // normal writing direction for a string/substring. val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.DIRECTION_INDEX); String rs = val.getStringValue(); int cbidi = 0; if (bidiLevel != null) cbidi = bidiLevel.intValue(); // We don't care if it was embed or override we just want // it's level here. So map override to positive value. if (cbidi < 0) cbidi = -cbidi; switch (rs.charAt(0)) { case 'l': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_LTR); if ((cbidi & 0x1) == 1) cbidi++; // was odd now even else cbidi+=2; // next greater even number break; case 'r': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); if ((cbidi & 0x1) == 1) cbidi+=2; // next greater odd number else cbidi++; // was even now odd break; } switch (s.charAt(0)) { case 'b': // bidi-override cbidi = -cbidi; // For bidi-override we want a negative number. break; } result.put(TextAttribute.BIDI_EMBEDDING, new Integer(cbidi)); } // Writing mode val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.WRITING_MODE_INDEX); s = val.getStringValue(); switch (s.charAt(0)) { case 'l': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_LTR); break; case 'r': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_RTL); break; case 't': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_TTB); break; } // glyph-orientation-vertical val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX); int primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: // auto result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_AUTO); break; case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (V):" + primitiveType ); } // glyph-orientation-horizontal val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_HORIZONTAL_INDEX); primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (H):" + primitiveType ); } // text spacing properties... // Letter Spacing Float sp = TextUtilities.convertLetterSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.LETTER_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Word spacing sp = TextUtilities.convertWordSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.WORD_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Kerning sp = TextUtilities.convertKerning(element); if (sp != null) { result.put(GVTAttributedCharacterIterator.TextAttribute.KERNING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } if (tce == null) { return inheritMap; } try { // textLength AbstractSVGAnimatedLength textLength = (AbstractSVGAnimatedLength) tce.getTextLength(); if (textLength.isSpecified()) { if (inheritMap == null) { inheritMap = new HashMap(); } Object value = new Float(textLength.getCheckedValue()); result.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); inheritMap.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); // lengthAdjust SVGOMAnimatedEnumeration _lengthAdjust = (SVGOMAnimatedEnumeration) tce.getLengthAdjust(); if (_lengthAdjust.getCheckedVal() == SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS) { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); } else { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } return inheritMap; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AbstractAnimation createAnimation(AnimationTarget target) { animationType = AnimationEngine.ANIM_TYPE_OTHER; attributeLocalName = "motion"; AnimatableValue from = parseLengthPair(SVG_FROM_ATTRIBUTE); AnimatableValue to = parseLengthPair(SVG_TO_ATTRIBUTE); AnimatableValue by = parseLengthPair(SVG_BY_ATTRIBUTE); boolean rotateAuto = false, rotateAutoReverse = false; float rotateAngle = 0; short rotateAngleUnit = SVGAngle.SVG_ANGLETYPE_UNKNOWN; String rotateString = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); if (rotateString.length() != 0) { if (rotateString.equals("auto")) { rotateAuto = true; } else if (rotateString.equals("auto-reverse")) { rotateAuto = true; rotateAutoReverse = true; } else { class Handler implements AngleHandler { float theAngle; short theUnit = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; public void startAngle() throws ParseException { } public void angleValue(float v) throws ParseException { theAngle = v; } public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; } public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; } public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; } public void endAngle() throws ParseException { } } AngleParser ap = new AngleParser(); Handler h = new Handler(); ap.setAngleHandler(h); try { ap.parse(rotateString); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); } rotateAngle = h.theAngle; rotateAngleUnit = h.theUnit; } } return new MotionAnimation(timedElement, this, parseCalcMode(), parseKeyTimes(), parseKeySplines(), parseAdditive(), parseAccumulate(), parseValues(), from, to, by, parsePath(), parseKeyPoints(), rotateAuto, rotateAutoReverse, rotateAngle, rotateAngleUnit); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected ExtendedGeneralPath parsePath() { Node n = element.getFirstChild(); while (n != null) { if (n.getNodeType() == Node.ELEMENT_NODE && SVG_NAMESPACE_URI.equals(n.getNamespaceURI()) && SVG_MPATH_TAG.equals(n.getLocalName())) { String uri = XLinkSupport.getXLinkHref((Element) n); Element path = ctx.getReferencedElement(element, uri); if (!SVG_NAMESPACE_URI.equals(path.getNamespaceURI()) || !SVG_PATH_TAG.equals(path.getLocalName())) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } SVGOMPathElement pathElt = (SVGOMPathElement) path; AWTPathProducer app = new AWTPathProducer(); SVGAnimatedPathDataSupport.handlePathSegList (pathElt.getPathSegList(), app); return (ExtendedGeneralPath) app.getShape(); } n = n.getNextSibling(); } String pathString = element.getAttributeNS(null, SVG_PATH_ATTRIBUTE); if (pathString.length() == 0) { return null; } try { AWTPathProducer app = new AWTPathProducer(); PathParser pp = new PathParser(); pp.setPathHandler(app); pp.parse(pathString); return (ExtendedGeneralPath) app.getShape(); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); } }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected float[] parseKeyPoints() { String keyPointsString = element.getAttributeNS(null, SVG_KEY_POINTS_ATTRIBUTE); int len = keyPointsString.length(); if (len == 0) { return null; } List keyPoints = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (keyPointsString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keyPointsString.charAt(i); while (c != ' ' && c != ';' && c != ',') { i++; if (i == len) { break; } c = keyPointsString.charAt(i); } } end = i++; try { float keyPointCoord = Float.parseFloat(keyPointsString.substring(start, end)); keyPoints.add(new Float(keyPointCoord)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); } } len = keyPoints.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keyPoints.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AnimatableValue[] parseValues(String s) { try { LengthPairListParser lplp = new LengthPairListParser(); LengthArrayProducer lap = new LengthArrayProducer(); lplp.setLengthListHandler(lap); lplp.parse(s); short[] types = lap.getLengthTypeArray(); float[] values = lap.getLengthValueArray(); AnimatableValue[] ret = new AnimatableValue[types.length / 2]; for (int i = 0; i < types.length; i += 2) { float x = animationTarget.svgToUserSpace (values[i], types[i], AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH); float y = animationTarget.svgToUserSpace (values[i + 1], types[i + 1], AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT); ret[i / 2] = new AnimatableMotionPointValue(animationTarget, x, y, 0); } return ret; } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); } }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected void initializeAnimation() { // Determine the target element. String uri = XLinkSupport.getXLinkHref(element); Node t; if (uri.length() == 0) { t = element.getParentNode(); } else { t = ctx.getReferencedElement(element, uri); if (t.getOwnerDocument() != element.getOwnerDocument()) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } } animationTarget = null; if (t instanceof SVGOMElement) { targetElement = (SVGOMElement) t; animationTarget = targetElement; } if (animationTarget == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET, new Object[] { uri }); } // Add the animation. timedElement = createTimedElement(); animation = createAnimation(animationTarget); eng.addAnimation(animationTarget, AnimationEngine.ANIM_TYPE_OTHER, attributeNamespaceURI, attributeLocalName, animation); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
public TextPath createTextPath(BridgeContext ctx, Element textPathElement) { // get the referenced element String uri = XLinkSupport.getXLinkHref(textPathElement); Element pathElement = ctx.getReferencedElement(textPathElement, uri); if ((pathElement == null) || (!SVG_NAMESPACE_URI.equals(pathElement.getNamespaceURI())) || (!pathElement.getLocalName().equals(SVG_PATH_TAG))) { // couldn't find the referenced element // or the referenced element was not a path throw new BridgeException(ctx, textPathElement, ERR_URI_BAD_TARGET, new Object[] {uri}); } // construct a shape for the referenced path element String s = pathElement.getAttributeNS(null, SVG_D_ATTRIBUTE); Shape pathShape = null; if (s.length() != 0) { AWTPathProducer app = new AWTPathProducer(); app.setWindingRule(CSSUtilities.convertFillRule(pathElement)); try { PathParser pathParser = new PathParser(); pathParser.setPathHandler(app); pathParser.parse(s); } catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); } finally { pathShape = app.getShape(); } } else { throw new BridgeException(ctx, pathElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_D_ATTRIBUTE}); } // if the reference path element has a transform apply the transform // to the path shape s = pathElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE); if (s.length() != 0) { AffineTransform tr = SVGUtilities.convertTransform(pathElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx); pathShape = tr.createTransformedShape(pathShape); } // create the TextPath object that we are going to return TextPath textPath = new TextPath(new GeneralPath(pathShape)); // set the start offset if specified s = textPathElement.getAttributeNS(null, SVG_START_OFFSET_ATTRIBUTE); if (s.length() > 0) { float startOffset = 0; int percentIndex = s.indexOf('%'); if (percentIndex != -1) { // its a percentage of the length of the path float pathLength = textPath.lengthOfPath(); String percentString = s.substring(0,percentIndex); float startOffsetPercent = 0; try { startOffsetPercent = SVGUtilities.convertSVGNumber(percentString); } catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); } startOffset = (float)(startOffsetPercent * pathLength/100.0); } else { // its an absolute length UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, textPathElement); startOffset = UnitProcessor.svgOtherLengthToUserSpace(s, SVG_START_OFFSET_ATTRIBUTE, uctx); } textPath.setStartOffset(startOffset); } return textPath; }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMRectElement re = (SVGOMRectElement) e; // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) re.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) re.getY(); float y = _y.getCheckedValue(); // 'width' attribute - required AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) re.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - required AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) re.getHeight(); float h = _height.getCheckedValue(); // 'rx' attribute - default is 0 AbstractSVGAnimatedLength _rx = (AbstractSVGAnimatedLength) re.getRx(); float rx = _rx.getCheckedValue(); if (rx > w / 2) { rx = w / 2; } // 'ry' attribute - default is rx AbstractSVGAnimatedLength _ry = (AbstractSVGAnimatedLength) re.getRy(); float ry = _ry.getCheckedValue(); if (ry > h / 2) { ry = h / 2; } Shape shape; if (rx == 0 || ry == 0) { shape = new Rectangle2D.Float(x, y, w, h); } else { shape = new RoundRectangle2D.Float(x, y, w, h, rx * 2, ry * 2); } shapeNode.setShape(shape); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGPatternElementBridge.java
protected static RootGraphicsNode extractPatternContent(Element patternElement, BridgeContext ctx) { List refs = new LinkedList(); for (;;) { RootGraphicsNode content = extractLocalPatternContent(patternElement, ctx); if (content != null) { return content; // pattern content found, exit } String uri = XLinkSupport.getXLinkHref(patternElement); if (uri.length() == 0) { return null; // no xlink:href found, exit } // check if there is circular dependencies SVGOMDocument doc = (SVGOMDocument)patternElement.getOwnerDocument(); ParsedURL purl = new ParsedURL(doc.getURL(), uri); if (!purl.complete()) throw new BridgeException(ctx, patternElement, ERR_URI_MALFORMED, new Object[] {uri}); if (contains(refs, purl)) { throw new BridgeException(ctx, patternElement, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uri}); } refs.add(purl); patternElement = ctx.getReferencedElement(patternElement, uri); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { ImageNode imageNode = (ImageNode)super.createGraphicsNode(ctx, e); if (imageNode == null) { return null; } associateSVGContext(ctx, e, imageNode); hitCheckChildren = false; GraphicsNode node = buildImageGraphicsNode(ctx,e); if (node == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } imageNode.setImage(node); imageNode.setHitCheckChildren(hitCheckChildren); // 'image-rendering' and 'color-rendering' RenderingHints hints = null; hints = CSSUtilities.convertImageRendering(e, hints); hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) imageNode.setRenderingHints(hints); return imageNode; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode buildImageGraphicsNode (BridgeContext ctx, Element e){ SVGImageElement ie = (SVGImageElement) e; // 'xlink:href' attribute - required String uriStr = ie.getHref().getAnimVal(); if (uriStr.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } if (uriStr.indexOf('#') != -1) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {"xlink:href", uriStr}); } // Build the URL. String baseURI = AbstractNode.getBaseURI(e); ParsedURL purl; if (baseURI == null) { purl = new ParsedURL(uriStr); } else { purl = new ParsedURL(baseURI, uriStr); } return createImageGraphicsNode(ctx, e, purl); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl) { Rectangle2D bounds = getImageBounds(ctx, e); if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) { ShapeNode sn = new ShapeNode(); sn.setShape(bounds); return sn; } SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); String docURL = svgDoc.getURL(); ParsedURL pDocURL = null; if (docURL != null) pDocURL = new ParsedURL(docURL); UserAgent userAgent = ctx.getUserAgent(); try { userAgent.checkLoadExternalResource(purl, pDocURL); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } DocumentLoader loader = ctx.getDocumentLoader(); ImageTagRegistry reg = ImageTagRegistry.getRegistry(); ICCColorSpaceExt colorspace = extractColorSpace(e, ctx); { /** * Before we open the URL we see if we have the * URL already cached and parsed */ try { /* Check the document loader cache */ Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } } catch (BridgeException ex) { throw ex; } catch (Exception ex) { /* Nothing to do */ } /* Check the ImageTagRegistry Cache */ Filter img = reg.checkCache(purl, colorspace); if (img != null) { return createRasterImageNode(ctx, e, img, purl); } } /* The Protected Stream ensures that the stream doesn't * get closed unless we want it to. It is also based on * a Buffered Reader so in general we can mark the start * and reset rather than reopening the stream. Finally * it hides the mark/reset methods so only we get to * use them. */ ProtectedStream reference = null; try { reference = openStream(e, purl); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); } { /** * First see if we can id the file as a Raster via magic * number. This is probably the fastest mechanism. * We tell the registry what the source purl is but we * tell it not to open that url. */ Filter img = reg.readURL(reference, purl, colorspace, false, false); if (img != null) { try { reference.tie(); } catch (IOException ioe) { // This would be from a close, Let it slide... } // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } try { // Reset the stream for next try. reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { /** * Next see if it's an XML document. */ Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } catch (BridgeException ex) { reference.release(); throw ex; } catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); } catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; } catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); } try { reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { // Finally try to load the image as a raster image (JPG or // PNG) allowing the registry to open the url (so the // JDK readers can be checked). Filter img = reg.readURL(reference, purl, colorspace, true, true); if (img != null) { // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } finally { reference.release(); } return null; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { String ns = alav.getNamespaceURI(); String ln = alav.getLocalName(); if (ns == null) { if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE)) { updateImageBounds(); return; } else if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) { SVGImageElement ie = (SVGImageElement) e; ImageNode imageNode = (ImageNode) node; AbstractSVGAnimatedLength _attr; if (ln.charAt(0) == 'w') { _attr = (AbstractSVGAnimatedLength) ie.getWidth(); } else { _attr = (AbstractSVGAnimatedLength) ie.getHeight(); } float val = _attr.getCheckedValue(); if (val == 0 || imageNode.getImage() instanceof ShapeNode) { rebuildImageNode(); } else { updateImageBounds(); } return; } else if (ln.equals(SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE)) { updateImageBounds(); return; } } else if (ns.equals(XLINK_NAMESPACE_URI) && ln.equals(XLINK_HREF_ATTRIBUTE)) { rebuildImageNode(); return; } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected void rebuildImageNode() { // Reference copy of the imgDocument if ((imgDocument != null) && (listener != null)) { NodeEventTarget tgt = (NodeEventTarget)imgDocument.getRootElement(); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYDOWN, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYPRESS, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_KEYUP, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEDOWN, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEMOVE, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER, listener, false); tgt.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEUP, listener, false); listener = null; } if (imgDocument != null) { SVGSVGElement svgElement = imgDocument.getRootElement(); disposeTree(svgElement); } imgDocument = null; subCtx = null; //update of the reference of the image. GraphicsNode inode = buildImageGraphicsNode(ctx,e); ImageNode imgNode = (ImageNode)node; imgNode.setImage(inode); if (inode == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected static void initializeViewport(BridgeContext ctx, Element e, GraphicsNode node, float[] vb, Rectangle2D bounds) { float x = (float)bounds.getX(); float y = (float)bounds.getY(); float w = (float)bounds.getWidth(); float h = (float)bounds.getHeight(); try { SVGImageElement ie = (SVGImageElement) e; SVGOMAnimatedPreserveAspectRatio _par = (SVGOMAnimatedPreserveAspectRatio) ie.getPreserveAspectRatio(); _par.check(); AffineTransform at = ViewBox.getPreserveAspectRatioTransform (e, vb, w, h, _par, ctx); at.preConcatenate(AffineTransform.getTranslateInstance(x, y)); node.setTransform(at); // 'overflow' and 'clip' Shape clip = null; if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); if (offsets == null) { // clip:auto clip = new Rectangle2D.Float(x, y, w, h); } else { // clip:rect(<x> <y> <w> <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left clip = new Rectangle2D.Float(x+offsets[3], y+offsets[0], w-offsets[1]-offsets[3], h-offsets[2]-offsets[0]); } } if (clip != null) { try { at = at.createInverse(); // clip in user space Filter filter = node.getGraphicsNodeRable(true); clip = at.createTransformedShape(clip); node.setClip(new ClipRable8Bit(filter, clip)); } catch (java.awt.geom.NoninvertibleTransformException ex) {} } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected static Rectangle2D getImageBounds(BridgeContext ctx, Element element) { try { SVGImageElement ie = (SVGImageElement) element; // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) ie.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) ie.getY(); float y = _y.getCheckedValue(); // 'width' attribute - required AbstractSVGAnimatedLength _width = (AbstractSVGAnimatedLength) ie.getWidth(); float w = _width.getCheckedValue(); // 'height' attribute - required AbstractSVGAnimatedLength _height = (AbstractSVGAnimatedLength) ie.getHeight(); float h = _height.getCheckedValue(); return new Rectangle2D.Float(x, y, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static Filter getIn2(Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Map filterMap, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_IN2_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object [] {SVG_IN2_ATTRIBUTE}); } return getFilterSource(filterElement, s, filteredElement, filteredNode, filterMap, ctx); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static int convertInteger(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } } }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
protected static float convertNumber(Element filterElement, String attrName, float defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); } } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgLengthToObjectBoundingBox(String s, String attr, short d, Context ctx) { float v = svgToObjectBoundingBox(s, attr, d, ctx); if (v < 0) { throw new BridgeException(getBridgeContext(ctx), ctx.getElement(), ErrorConstants.ERR_LENGTH_NEGATIVE, new Object[] {attr, s}); } return v; }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToObjectBoundingBox(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgLengthToUserSpace(String s, String attr, short d, Context ctx) { float v = svgToUserSpace(s, attr, d, ctx); if (v < 0) { throw new BridgeException(getBridgeContext(ctx), ctx.getElement(), ErrorConstants.ERR_LENGTH_NEGATIVE, new Object[] {attr, s}); } else { return v; } }
// in sources/org/apache/batik/bridge/UnitProcessor.java
public static float svgToUserSpace(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToUserSpace(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); } }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
public Marker createMarker(BridgeContext ctx, Element markerElement, Element paintedElement) { GVTBuilder builder = ctx.getGVTBuilder(); CompositeGraphicsNode markerContentNode = new CompositeGraphicsNode(); // build the GVT tree that represents the marker boolean hasChildren = false; for(Node n = markerElement.getFirstChild(); n != null; n = n.getNextSibling()) { // check if the node is a valid Element if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } Element child = (Element)n; GraphicsNode markerNode = builder.build(ctx, child) ; // check if a GVT node has been created if (markerNode == null) { continue; // skip element as <marker> can contain <defs>... } hasChildren = true; markerContentNode.getChildren().add(markerNode); } if (!hasChildren) { return null; // no marker content defined } String s; UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, paintedElement); // 'markerWidth' attribute - default is 3 float markerWidth = 3; s = markerElement.getAttributeNS(null, SVG_MARKER_WIDTH_ATTRIBUTE); if (s.length() != 0) { markerWidth = UnitProcessor.svgHorizontalLengthToUserSpace (s, SVG_MARKER_WIDTH_ATTRIBUTE, uctx); } if (markerWidth == 0) { // A value of zero disables rendering of the element. return null; } // 'markerHeight' attribute - default is 3 float markerHeight = 3; s = markerElement.getAttributeNS(null, SVG_MARKER_HEIGHT_ATTRIBUTE); if (s.length() != 0) { markerHeight = UnitProcessor.svgVerticalLengthToUserSpace (s, SVG_MARKER_HEIGHT_ATTRIBUTE, uctx); } if (markerHeight == 0) { // A value of zero disables rendering of the element. return null; } // 'orient' attribute - default is '0' double orient; s = markerElement.getAttributeNS(null, SVG_ORIENT_ATTRIBUTE); if (s.length() == 0) { orient = 0; } else if (SVG_AUTO_VALUE.equals(s)) { orient = Double.NaN; } else { try { orient = SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); } } // 'stroke-width' property Value val = CSSUtilities.getComputedStyle (paintedElement, SVGCSSEngine.STROKE_WIDTH_INDEX); float strokeWidth = val.getFloatValue(); // 'markerUnits' attribute - default is 'strokeWidth' short unitsType; s = markerElement.getAttributeNS(null, SVG_MARKER_UNITS_ATTRIBUTE); if (s.length() == 0) { unitsType = SVGUtilities.STROKE_WIDTH; } else { unitsType = SVGUtilities.parseMarkerCoordinateSystem (markerElement, SVG_MARKER_UNITS_ATTRIBUTE, s, ctx); } // // // // compute an additional transform for 'strokeWidth' coordinate system AffineTransform markerTxf; if (unitsType == SVGUtilities.STROKE_WIDTH) { markerTxf = new AffineTransform(); markerTxf.scale(strokeWidth, strokeWidth); } else { markerTxf = new AffineTransform(); } // 'viewBox' and 'preserveAspectRatio' attributes // viewBox -> viewport(0, 0, markerWidth, markerHeight) AffineTransform preserveAspectRatioTransform = ViewBox.getPreserveAspectRatioTransform(markerElement, markerWidth, markerHeight, ctx); if (preserveAspectRatioTransform == null) { // disable the rendering of the element return null; } else { markerTxf.concatenate(preserveAspectRatioTransform); } // now we can set the transform to the 'markerContentNode' markerContentNode.setTransform(markerTxf); // 'overflow' property if (CSSUtilities.convertOverflow(markerElement)) { // overflow:hidden Rectangle2D markerClip; float [] offsets = CSSUtilities.convertClip(markerElement); if (offsets == null) { // clip:auto markerClip = new Rectangle2D.Float(0, 0, strokeWidth * markerWidth, strokeWidth * markerHeight); } else { // clip:rect(<x>, <y>, <w>, <h>) // offsets[0] = top // offsets[1] = right // offsets[2] = bottom // offsets[3] = left markerClip = new Rectangle2D.Float (offsets[3], offsets[0], strokeWidth * markerWidth - offsets[1] - offsets[3], strokeWidth * markerHeight - offsets[2] - offsets[0]); } CompositeGraphicsNode comp = new CompositeGraphicsNode(); comp.getChildren().add(markerContentNode); Filter clipSrc = comp.getGraphicsNodeRable(true); comp.setClip(new ClipRable8Bit(clipSrc, markerClip)); markerContentNode = comp; } // 'refX' attribute - default is 0 float refX = 0; s = markerElement.getAttributeNS(null, SVG_REF_X_ATTRIBUTE); if (s.length() != 0) { refX = UnitProcessor.svgHorizontalCoordinateToUserSpace (s, SVG_REF_X_ATTRIBUTE, uctx); } // 'refY' attribute - default is 0 float refY = 0; s = markerElement.getAttributeNS(null, SVG_REF_Y_ATTRIBUTE); if (s.length() != 0) { refY = UnitProcessor.svgVerticalCoordinateToUserSpace (s, SVG_REF_Y_ATTRIBUTE, uctx); } // TK: Warning at this time, refX and refY are relative to the // paintedElement's coordinate system. We need to move the // reference point to the marker's coordinate system // Watch out: the reference point is defined a little weirdly in the // SVG spec., but the bottom line is that the marker content should // not be translated. Rather, the reference point should be computed // in viewport space (this is what the following transform // does) and used when placing the marker. // float[] ref = {refX, refY}; markerTxf.transform(ref, 0, ref, 0, 1); Marker marker = new Marker(markerContentNode, new Point2D.Float(ref[0], ref[1]), orient); return marker; }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected int parseCalcMode() { // If the attribute being animated has only non-additive values, take // the animation as having calcMode="discrete". if (animationType == AnimationEngine.ANIM_TYPE_CSS && !targetElement.isPropertyAdditive(attributeLocalName) || animationType == AnimationEngine.ANIM_TYPE_XML && !targetElement.isAttributeAdditive(attributeNamespaceURI, attributeLocalName)) { return SimpleAnimation.CALC_MODE_DISCRETE; } String calcModeString = element.getAttributeNS(null, SVG_CALC_MODE_ATTRIBUTE); if (calcModeString.length() == 0) { return getDefaultCalcMode(); } else if (calcModeString.equals(SMILConstants.SMIL_LINEAR_VALUE)) { return SimpleAnimation.CALC_MODE_LINEAR; } else if (calcModeString.equals(SMILConstants.SMIL_DISCRETE_VALUE)) { return SimpleAnimation.CALC_MODE_DISCRETE; } else if (calcModeString.equals(SMILConstants.SMIL_PACED_VALUE)) { return SimpleAnimation.CALC_MODE_PACED; } else if (calcModeString.equals(SMILConstants.SMIL_SPLINE_VALUE)) { return SimpleAnimation.CALC_MODE_SPLINE; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_CALC_MODE_ATTRIBUTE, calcModeString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected boolean parseAdditive() { String additiveString = element.getAttributeNS(null, SVG_ADDITIVE_ATTRIBUTE); if (additiveString.length() == 0 || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) { return false; } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected boolean parseAccumulate() { String accumulateString = element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE); if (accumulateString.length() == 0 || accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) { return false; } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) { return true; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected AnimatableValue[] parseValues() { boolean isCSS = animationType == AnimationEngine.ANIM_TYPE_CSS; String valuesString = element.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); int len = valuesString.length(); if (len == 0) { return null; } ArrayList values = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (valuesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = valuesString.charAt(i); while (c != ';') { i++; if (i == len) { break; } c = valuesString.charAt(i); } } end = i++; AnimatableValue val = eng.parseAnimatableValue (element, animationTarget, attributeNamespaceURI, attributeLocalName, isCSS, valuesString.substring(start, end)); if (!checkValueType(val)) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, valuesString }); } values.add(val); } AnimatableValue[] ret = new AnimatableValue[values.size()]; return (AnimatableValue[]) values.toArray(ret); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected float[] parseKeyTimes() { String keyTimesString = element.getAttributeNS(null, SVG_KEY_TIMES_ATTRIBUTE); int len = keyTimesString.length(); if (len == 0) { return null; } ArrayList keyTimes = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (keyTimesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keyTimesString.charAt(i); while (c != ' ' && c != ';') { i++; if (i == len) { break; } c = keyTimesString.charAt(i); } } end = i++; try { float keyTime = Float.parseFloat(keyTimesString.substring(start, end)); keyTimes.add(new Float(keyTime)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); } } len = keyTimes.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keyTimes.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
protected float[] parseKeySplines() { String keySplinesString = element.getAttributeNS(null, SVG_KEY_SPLINES_ATTRIBUTE); int len = keySplinesString.length(); if (len == 0) { return null; } List keySplines = new ArrayList(7); int count = 0, i = 0, start = 0, end; char c; outer: while (i < len) { while (keySplinesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i != len) { c = keySplinesString.charAt(i); while (c != ' ' && c != ',' && c != ';') { i++; if (i == len) { break; } c = keySplinesString.charAt(i); } end = i++; if (c == ' ') { do { if (i == len) { break; } c = keySplinesString.charAt(i++); } while (c == ' '); if (c != ';' && c != ',') { i--; } } if (c == ';') { if (count == 3) { count = 0; } else { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); } } else { count++; } } else { end = i++; } try { float keySplineValue = Float.parseFloat(keySplinesString.substring(start, end)); keySplines.add(new Float(keySplineValue)); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); } } len = keySplines.size(); float[] ret = new float[len]; for (int j = 0; j < len; j++) { ret[j] = ((Float) keySplines.get(j)).floatValue(); } return ret; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Node getReferencedNode(Element e, String uri) { try { SVGDocument document = (SVGDocument)e.getOwnerDocument(); URIResolver ur = createURIResolver(document, documentLoader); Node ref = ur.getNode(uri, e); if (ref == null) { throw new BridgeException(this, e, ERR_URI_BAD_TARGET, new Object[] {uri}); } else { SVGOMDocument refDoc = (SVGOMDocument) (ref.getNodeType() == Node.DOCUMENT_NODE ? ref : ref.getOwnerDocument()); // This is new rather than attaching this BridgeContext // with the new document we now create a whole new // BridgeContext to go with the new document. // This means that the new document has it's own // world of stuff and it should avoid memory leaks // since the new document isn't 'tied into' this // bridge context. if (refDoc != document) { createSubBridgeContext(refDoc); } return ref; } } catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); } catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); } catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); } catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); } }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Element getReferencedElement(Element e, String uri) { Node ref = getReferencedNode(e, uri); if (ref != null && ref.getNodeType() != Node.ELEMENT_NODE) { throw new BridgeException(this, e, ERR_URI_REFERENCE_A_DOCUMENT, new Object[] {uri}); } return (Element) ref; }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMCircleElement ce = (SVGOMCircleElement) e; // 'cx' attribute - default is 0 AbstractSVGAnimatedLength _cx = (AbstractSVGAnimatedLength) ce.getCx(); float cx = _cx.getCheckedValue(); // 'cy' attribute - default is 0 AbstractSVGAnimatedLength _cy = (AbstractSVGAnimatedLength) ce.getCy(); float cy = _cy.getCheckedValue(); // 'r' attribute - required AbstractSVGAnimatedLength _r = (AbstractSVGAnimatedLength) ce.getR(); float r = _r.getCheckedValue(); float x = cx - r; float y = cy - r; float w = r * 2; shapeNode.setShape(new Ellipse2D.Float(x, y, w, w)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeCompositeElementBridge.java
protected static CompositeRule convertOperator(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_OPERATOR_ATTRIBUTE); if (s.length() == 0) { return CompositeRule.OVER; // default is over } if (SVG_ATOP_VALUE.equals(s)) { return CompositeRule.ATOP; } if (SVG_IN_VALUE.equals(s)) { return CompositeRule.IN; } if (SVG_OVER_VALUE.equals(s)) { return CompositeRule.OVER; } if (SVG_OUT_VALUE.equals(s)) { return CompositeRule.OUT; } if (SVG_XOR_VALUE.equals(s)) { return CompositeRule.XOR; } if (SVG_ARITHMETIC_VALUE.equals(s)) { float k1 = convertNumber(filterElement, SVG_K1_ATTRIBUTE, 0, ctx); float k2 = convertNumber(filterElement, SVG_K2_ATTRIBUTE, 0, ctx); float k3 = convertNumber(filterElement, SVG_K3_ATTRIBUTE, 0, ctx); float k4 = convertNumber(filterElement, SVG_K4_ATTRIBUTE, 0, ctx); return CompositeRule.ARITHMETIC(k1, k2, k3, k4); } throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OPERATOR_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
protected static float convertSpecularExponent(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS (null, SVG_SPECULAR_EXPONENT_ATTRIBUTE); if (s.length() == 0) { return 1; // default is 1 } else { try { float v = SVGUtilities.convertSVGNumber(s); if (v < 1 || v > 128) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s}); } return v; } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); } } }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
public CompositeGraphicsNode buildCompositeGraphicsNode (BridgeContext ctx, Element e, CompositeGraphicsNode gn) { // get the referenced element SVGOMUseElement ue = (SVGOMUseElement) e; String uri = ue.getHref().getAnimVal(); if (uri.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } Element refElement = ctx.getReferencedElement(e, uri); SVGOMDocument document, refDocument; document = (SVGOMDocument)e.getOwnerDocument(); refDocument = (SVGOMDocument)refElement.getOwnerDocument(); boolean isLocal = (refDocument == document); BridgeContext theCtx = ctx; subCtx = null; if (!isLocal) { subCtx = (BridgeContext)refDocument.getCSSEngine().getCSSContext(); theCtx = subCtx; } // import or clone the referenced element in current document Element localRefElement; localRefElement = (Element)document.importNode(refElement, true, true); if (SVG_SYMBOL_TAG.equals(localRefElement.getLocalName())) { // The referenced 'symbol' and its contents are deep-cloned into // the generated tree, with the exception that the 'symbol' is // replaced by an 'svg'. Element svgElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_SVG_TAG); // move the attributes from <symbol> to the <svg> element NamedNodeMap attrs = localRefElement.getAttributes(); int len = attrs.getLength(); for (int i = 0; i < len; i++) { Attr attr = (Attr)attrs.item(i); svgElement.setAttributeNS(attr.getNamespaceURI(), attr.getName(), attr.getValue()); } // move the children from <symbol> to the <svg> element for (Node n = localRefElement.getFirstChild(); n != null; n = localRefElement.getFirstChild()) { svgElement.appendChild(n); } localRefElement = svgElement; } if (SVG_SVG_TAG.equals(localRefElement.getLocalName())) { // The referenced 'svg' and its contents are deep-cloned into the // generated tree. If attributes width and/or height are provided // on the 'use' element, then these values will override the // corresponding attributes on the 'svg' in the generated tree. try { SVGOMAnimatedLength al = (SVGOMAnimatedLength) ue.getWidth(); if (al.isSpecified()) { localRefElement.setAttributeNS (null, SVG_WIDTH_ATTRIBUTE, al.getAnimVal().getValueAsString()); } al = (SVGOMAnimatedLength) ue.getHeight(); if (al.isSpecified()) { localRefElement.setAttributeNS (null, SVG_HEIGHT_ATTRIBUTE, al.getAnimVal().getValueAsString()); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } } // attach the referenced element to the current document SVGOMUseShadowRoot root; root = new SVGOMUseShadowRoot(document, e, isLocal); root.appendChild(localRefElement); if (gn == null) { gn = new CompositeGraphicsNode(); associateSVGContext(ctx, e, node); } else { int s = gn.size(); for (int i=0; i<s; i++) gn.remove(0); } Node oldRoot = ue.getCSSFirstChild(); if (oldRoot != null) { disposeTree(oldRoot); } ue.setUseShadowTree(root); Element g = localRefElement; // compute URIs and style sheets for the used element CSSUtilities.computeStyleAndURIs(refElement, localRefElement, uri); GVTBuilder builder = ctx.getGVTBuilder(); GraphicsNode refNode = builder.build(ctx, g); /////////////////////////////////////////////////////////////////////// gn.getChildren().add(refNode); gn.setTransform(computeTransform((SVGTransformable) e, ctx)); // set an affine transform to take into account the (x, y) // coordinates of the <use> element // 'visibility' gn.setVisible(CSSUtilities.convertVisibility(e)); RenderingHints hints = null; hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) gn.setRenderingHints(hints); // 'enable-background' Rectangle2D r = CSSUtilities.convertEnableBackground(e); if (r != null) gn.setBackgroundEnable(r); if (l != null) { // Remove event listeners NodeEventTarget target = l.target; target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true); target.removeEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true); l = null; } /////////////////////////////////////////////////////////////////////// // Handle mutations on content referenced in the same file if // we are in a dynamic context. if (isLocal && ctx.isDynamic()) { l = new ReferencedElementMutationListener(); NodeEventTarget target = (NodeEventTarget)refElement; l.target = target; target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved", l, true); target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true, null); theCtx.storeEventListenerNS (target, XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMCharacterDataModified", l, true); } return gn; }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
protected AffineTransform computeTransform(SVGTransformable e, BridgeContext ctx) { AffineTransform at = super.computeTransform(e, ctx); SVGUseElement ue = (SVGUseElement) e; try { // 'x' attribute - default is 0 AbstractSVGAnimatedLength _x = (AbstractSVGAnimatedLength) ue.getX(); float x = _x.getCheckedValue(); // 'y' attribute - default is 0 AbstractSVGAnimatedLength _y = (AbstractSVGAnimatedLength) ue.getY(); float y = _y.getCheckedValue(); AffineTransform xy = AffineTransform.getTranslateInstance(x, y); xy.preConcatenate(at); return xy; } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
public void handleAnimatedAttributeChanged (AnimatedLiveAttributeValue alav) { try { String ns = alav.getNamespaceURI(); String ln = alav.getLocalName(); if (ns == null) { if (ln.equals(SVG_X_ATTRIBUTE) || ln.equals(SVG_Y_ATTRIBUTE) || ln.equals(SVG_TRANSFORM_ATTRIBUTE)) { node.setTransform (computeTransform((SVGTransformable) e, ctx)); handleGeometryChanged(); } else if (ln.equals(SVG_WIDTH_ATTRIBUTE) || ln.equals(SVG_HEIGHT_ATTRIBUTE)) buildCompositeGraphicsNode (ctx, e, (CompositeGraphicsNode)node); } else { if (ns.equals(XLINK_NAMESPACE_URI) && ln.equals(XLINK_HREF_ATTRIBUTE)) buildCompositeGraphicsNode (ctx, e, (CompositeGraphicsNode)node); } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } super.handleAnimatedAttributeChanged(alav); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public AnimatableValue parseAnimatableValue(Element animElt, AnimationTarget target, String ns, String ln, boolean isCSS, String s) { SVGOMElement elt = (SVGOMElement) target.getElement(); int type; if (isCSS) { type = elt.getPropertyType(ln); } else { type = elt.getAttributeType(ns, ln); } Factory factory = factories[type]; if (factory == null) { String an = ns == null ? ln : '{' + ns + '}' + ln; throw new BridgeException (ctx, animElt, "attribute.not.animatable", new Object[] { target.getElement().getNodeName(), an }); } return factories[type].createValue(target, ns, ln, isCSS, s); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public AnimatableValue getUnderlyingCSSValue(Element animElt, AnimationTarget target, String pn) { ValueManager[] vms = cssEngine.getValueManagers(); int idx = cssEngine.getPropertyIndex(pn); if (idx != -1) { int type = vms[idx].getPropertyType(); Factory factory = factories[type]; if (factory == null) { throw new BridgeException (ctx, animElt, "attribute.not.animatable", new Object[] { target.getElement().getNodeName(), pn }); } SVGStylableElement e = (SVGStylableElement) target.getElement(); CSSStyleDeclaration over = e.getOverrideStyle(); String oldValue = over.getPropertyValue(pn); if (oldValue != null) { over.removeProperty(pn); } Value v = cssEngine.getComputedStyle(e, null, idx); if (oldValue != null && !oldValue.equals("")) { over.setProperty(pn, oldValue, null); } return factories[type].createValue(target, pn, v); } // XXX Doesn't handle shorthands. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void start(long documentStartTime) { if (started) { return; } started = true; try { try { Calendar cal = Calendar.getInstance(); cal.setTime(new Date(documentStartTime)); timedDocumentRoot.resetDocument(cal); Object[] bridges = initialBridges.toArray(); initialBridges = null; for (int i = 0; i < bridges.length; i++) { SVGAnimationElementBridge bridge = (SVGAnimationElementBridge) bridges[i]; bridge.initializeAnimation(); } for (int i = 0; i < bridges.length; i++) { SVGAnimationElementBridge bridge = (SVGAnimationElementBridge) bridges[i]; bridge.initializeTimedElement(); } // tick(0, false); // animationThread = new AnimationThread(); // animationThread.start(); UpdateManager um = ctx.getUpdateManager(); if (um != null) { RunnableQueue q = um.getUpdateRunnableQueue(); animationTickRunnable = new AnimationTickRunnable(q, this); q.setIdleRunnable(animationTickRunnable); if (initialStartTime != 0) { setCurrentTime(initialStartTime); } } } catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); } } catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void run() { SVGAnimationEngine eng = getAnimationEngine(); synchronized (eng) { try { try { eng.tick(t, false); } catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); } } catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void run() { SVGAnimationEngine eng = getAnimationEngine(); synchronized (eng) { int animationLimitingMode = eng.animationLimitingMode; float animationLimitingAmount = eng.animationLimitingAmount; try { try { long before = System.currentTimeMillis(); time.setTime(new Date(before)); float t = eng.timedDocumentRoot.convertWallclockTime(time); // if (Math.floor(t) > second) { // second = Math.floor(t); // System.err.println("fps: " + frames); // frames = 0; // } float t2 = eng.tick(t, false); long after = System.currentTimeMillis(); long dur = after - before; if (dur == 0) { dur = 1; } sumTime -= times[timeIndex]; sumTime += dur; times[timeIndex] = dur; timeIndex = (timeIndex + 1) % NUM_TIMES; if (t2 == Float.POSITIVE_INFINITY) { waitTime = Long.MAX_VALUE; } else { waitTime = before + (long) (t2 * 1000) - 1000; if (waitTime < after) { waitTime = after; } if (animationLimitingMode != 0) { float ave = (float) sumTime / NUM_TIMES; float delay; if (animationLimitingMode == 1) { // %cpu delay = ave / animationLimitingAmount - ave; } else { // fps delay = 1000f / animationLimitingAmount - ave; } long newWaitTime = after + (long) delay; if (newWaitTime > waitTime) { waitTime = newWaitTime; } } } // frames++; } catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); } exceptionCount = 0; } catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } } if (animationLimitingMode == 0) { // so we don't steal too much time from the Swing thread try { Thread.sleep(1); } catch (InterruptedException ie) { } } } }
// in sources/org/apache/batik/bridge/SVGFeImageElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'xlink:href' attribute String uriStr = XLinkSupport.getXLinkHref(filterElement); if (uriStr.length() == 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING, new Object[] {"xlink:href"}); } // // According the the SVG specification, feImage behaves like // <image> if it references an SVG document or a raster image // and it behaves like a <use> if it references a document // fragment. // // To provide this behavior, depending on whether the uri // contains a fragment identifier, we create either an // <image> or a <use> element and request the corresponding // bridges to build the corresponding GraphicsNode for us. // // Then, we take care of the possible transformation needed // from objectBoundingBox space to user space. // Document document = filterElement.getOwnerDocument(); boolean isUse = uriStr.indexOf('#') != -1; Element contentElement = null; if (isUse) { contentElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_USE_TAG); } else { contentElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_IMAGE_TAG); } contentElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, uriStr); Element proxyElement = document.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG); proxyElement.appendChild(contentElement); // feImage's default region is that of the filter chain. Rectangle2D defaultRegion = filterRegion; Element filterDefElement = (Element)(filterElement.getParentNode()); Rectangle2D primitiveRegion = SVGUtilities.getBaseFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, ctx); // System.err.println(">>>>>>>> primitiveRegion : " + primitiveRegion); contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf( primitiveRegion.getX() ) ); contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf( primitiveRegion.getY() ) ); contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( primitiveRegion.getWidth() ) ); contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( primitiveRegion.getHeight() ) ); GraphicsNode node = ctx.getGVTBuilder().build(ctx, proxyElement); Filter filter = node.getGraphicsNodeRable(true); // 'primitiveUnits' attribute - default is userSpaceOnUse short coordSystemType; String s = SVGUtilities.getChainableAttributeNS (filterDefElement, null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { coordSystemType = SVGUtilities.USER_SPACE_ON_USE; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx); } // Compute the transform from object bounding box to user // space if needed. AffineTransform at = new AffineTransform(); if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX) { at = SVGUtilities.toObjectBBox(at, filteredNode); } filter = new AffineRable8Bit(filter, at); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(filter, filterElement); // get filter primitive chain region Rectangle2D primitiveRegionUserSpace = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); filter = new PadRable8Bit(filter, primitiveRegionUserSpace, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/TextUtilities.java
public static ArrayList svgRotateArrayToFloats(Element element, String attrName, String valueStr, BridgeContext ctx) { StringTokenizer st = new StringTokenizer(valueStr, ", ", false); ArrayList values = new ArrayList(); String s; while (st.hasMoreTokens()) { try { s = st.nextToken(); values.add (new Float(Math.toRadians (SVGUtilities.convertSVGNumber(s)))); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); } } return values; }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMEllipseElement ee = (SVGOMEllipseElement) e; // 'cx' attribute - default is 0 AbstractSVGAnimatedLength _cx = (AbstractSVGAnimatedLength) ee.getCx(); float cx = _cx.getCheckedValue(); // 'cy' attribute - default is 0 AbstractSVGAnimatedLength _cy = (AbstractSVGAnimatedLength) ee.getCy(); float cy = _cy.getCheckedValue(); // 'rx' attribute - required AbstractSVGAnimatedLength _rx = (AbstractSVGAnimatedLength) ee.getRx(); float rx = _rx.getCheckedValue(); // 'ry' attribute - required AbstractSVGAnimatedLength _ry = (AbstractSVGAnimatedLength) ee.getRy(); float ry = _ry.getCheckedValue(); shapeNode.setShape(new Ellipse2D.Float(cx - rx, cy - ry, rx * 2, ry * 2)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'stdDeviation' attribute - default is [0, 0] float[] stdDeviationXY = convertStdDeviation(filterElement, ctx); if (stdDeviationXY[0] < 0 || stdDeviationXY[1] < 0) { throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, String.valueOf( stdDeviationXY[ 0 ] ) + stdDeviationXY[1]}); } // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // Default region is the size of in (if in is SourceGraphic or // SourceAlpha it will already include a pad/crop to the // proper filter region size). Rectangle2D defaultRegion = in.getBounds2D(); Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); // Take the filter primitive region into account, we need to // pad/crop the input and output. PadRable pad = new PadRable8Bit(in, primitiveRegion, PadMode.ZERO_PAD); // build filter Filter blur = new GaussianBlurRable8Bit (pad, stdDeviationXY[0], stdDeviationXY[1]); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(blur, filterElement); PadRable filter = new PadRable8Bit(blur, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
protected static float[] convertStdDeviation(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_STD_DEVIATION_ATTRIBUTE); if (s.length() == 0) { return new float[] {0, 0}; } float [] stdDevs = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { stdDevs[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { stdDevs[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { stdDevs[1] = stdDevs[0]; } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s}); } return stdDevs; }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Marker convertMarker(Element e, Value v, BridgeContext ctx) { if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { return null; // 'none' } else { String uri = v.getStringValue(); Element markerElement = ctx.getReferencedElement(e, uri); Bridge bridge = ctx.getBridge(markerElement); if (bridge == null || !(bridge instanceof MarkerBridge)) { throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Paint convertURIPaint(Element paintedElement, GraphicsNode paintedNode, Value paintDef, float opacity, BridgeContext ctx) { String uri = paintDef.getStringValue(); Element paintElement = ctx.getReferencedElement(paintedElement, uri); Bridge bridge = ctx.getBridge(paintElement); if (bridge == null || !(bridge instanceof PaintBridge)) { throw new BridgeException (ctx, paintedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((PaintBridge)bridge).createPaint(ctx, paintElement, paintedElement, paintedNode, opacity); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
protected void buildShape(BridgeContext ctx, Element e, ShapeNode shapeNode) { try { SVGOMLineElement le = (SVGOMLineElement) e; // 'x1' attribute - default is 0 AbstractSVGAnimatedLength _x1 = (AbstractSVGAnimatedLength) le.getX1(); float x1 = _x1.getCheckedValue(); // 'y1' attribute - default is 0 AbstractSVGAnimatedLength _y1 = (AbstractSVGAnimatedLength) le.getY1(); float y1 = _y1.getCheckedValue(); // 'x2' attribute - default is 0 AbstractSVGAnimatedLength _x2 = (AbstractSVGAnimatedLength) le.getX2(); float x2 = _x2.getCheckedValue(); // 'y2' attribute - default is 0 AbstractSVGAnimatedLength _y2 = (AbstractSVGAnimatedLength) le.getY2(); float y2 = _y2.getCheckedValue(); shapeNode.setShape(new Line2D.Float(x1, y1, x2, y2)); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static String getChainableAttributeNS(Element element, String namespaceURI, String attrName, BridgeContext ctx) { DocumentLoader loader = ctx.getDocumentLoader(); Element e = element; List refs = new LinkedList(); for (;;) { String v = e.getAttributeNS(namespaceURI, attrName); if (v.length() > 0) { // exit if attribute defined return v; } String uriStr = XLinkSupport.getXLinkHref(e); if (uriStr.length() == 0) { // exit if no more xlink:href return ""; } String baseURI = ((AbstractNode) e).getBaseURI(); ParsedURL purl = new ParsedURL(baseURI, uriStr); Iterator iter = refs.iterator(); while (iter.hasNext()) { if (purl.equals(iter.next())) throw new BridgeException (ctx, e, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, new Object[] {uriStr}); } try { SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); URIResolver resolver = ctx.createURIResolver(svgDoc, loader); e = resolver.getElement(purl.toString(), e); refs.add(purl); } catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); } catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); } } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Rectangle2D convertPatternRegion(Element patternElement, Element paintedElement, GraphicsNode paintedNode, BridgeContext ctx) { // 'x' attribute - default is 0% String xStr = getChainableAttributeNS (patternElement, null, SVG_X_ATTRIBUTE, ctx); if (xStr.length() == 0) { xStr = SVG_PATTERN_X_DEFAULT_VALUE; } // 'y' attribute - default is 0% String yStr = getChainableAttributeNS (patternElement, null, SVG_Y_ATTRIBUTE, ctx); if (yStr.length() == 0) { yStr = SVG_PATTERN_Y_DEFAULT_VALUE; } // 'width' attribute - required String wStr = getChainableAttributeNS (patternElement, null, SVG_WIDTH_ATTRIBUTE, ctx); if (wStr.length() == 0) { throw new BridgeException (ctx, patternElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_WIDTH_ATTRIBUTE}); } // 'height' attribute - required String hStr = getChainableAttributeNS (patternElement, null, SVG_HEIGHT_ATTRIBUTE, ctx); if (hStr.length() == 0) { throw new BridgeException (ctx, patternElement, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_HEIGHT_ATTRIBUTE}); } // 'patternUnits' attribute - default is 'objectBoundingBox' short unitsType; String units = getChainableAttributeNS (patternElement, null, SVG_PATTERN_UNITS_ATTRIBUTE, ctx); if (units.length() == 0) { unitsType = OBJECT_BOUNDING_BOX; } else { unitsType = parseCoordinateSystem (patternElement, SVG_PATTERN_UNITS_ATTRIBUTE, units, ctx); } // resolve units in the (referenced) paintedElement's coordinate system UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, paintedElement); return convertRegion(xStr, yStr, wStr, hStr, unitsType, paintedNode, uctx); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float [] convertFilterRes(Element filterElement, BridgeContext ctx) { float [] filterRes = new float[2]; String s = getChainableAttributeNS (filterElement, null, SVG_FILTER_RES_ATTRIBUTE, ctx); Float [] vals = convertSVGNumberOptionalNumber (filterElement, SVG_FILTER_RES_ATTRIBUTE, s, ctx); if (filterRes[0] < 0 || filterRes[1] < 0) { throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } if (vals[0] == null) filterRes[0] = -1; else { filterRes[0] = vals[0].floatValue(); if (filterRes[0] < 0) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } if (vals[1] == null) filterRes[1] = filterRes[0]; else { filterRes[1] = vals[1].floatValue(); if (filterRes[1] < 0) throw new BridgeException (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_FILTER_RES_ATTRIBUTE, s}); } return filterRes; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Float[] convertSVGNumberOptionalNumber(Element elem, String attrName, String attrValue, BridgeContext ctx) { Float[] ret = new Float[2]; if (attrValue.length() == 0) return ret; try { StringTokenizer tokens = new StringTokenizer(attrValue, " "); ret[0] = new Float(Float.parseFloat(tokens.nextToken())); if (tokens.hasMoreTokens()) { ret[1] = new Float(Float.parseFloat(tokens.nextToken())); } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, elem, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue}); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); } return ret; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static short parseCoordinateSystem(Element e, String attr, String coordinateSystem, BridgeContext ctx) { if (SVG_USER_SPACE_ON_USE_VALUE.equals(coordinateSystem)) { return USER_SPACE_ON_USE; } else if (SVG_OBJECT_BOUNDING_BOX_VALUE.equals(coordinateSystem)) { return OBJECT_BOUNDING_BOX; } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, coordinateSystem}); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static short parseMarkerCoordinateSystem(Element e, String attr, String coordinateSystem, BridgeContext ctx) { if (SVG_USER_SPACE_ON_USE_VALUE.equals(coordinateSystem)) { return USER_SPACE_ON_USE; } else if (SVG_STROKE_WIDTH_VALUE.equals(coordinateSystem)) { return STROKE_WIDTH; } else { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, coordinateSystem}); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static AffineTransform convertTransform(Element e, String attr, String transform, BridgeContext ctx) { try { return AWTTransformProducer.createAffineTransform(transform); } catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float convertSnapshotTime(Element e, BridgeContext ctx) { if (!e.hasAttributeNS(null, SVG_SNAPSHOT_TIME_ATTRIBUTE)) { return 0f; } String t = e.getAttributeNS(null, SVG_SNAPSHOT_TIME_ATTRIBUTE); if (t.equals(SVG_NONE_VALUE)) { return 0f; } class Handler implements ClockHandler { float time; public void clockValue(float t) { time = t; } } ClockParser p = new ClockParser(false); Handler h = new Handler(); p.setClockHandler(h); try { p.parse(t); } catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); } return h.time; }
// in sources/org/apache/batik/bridge/SVGAnimateTransformElementBridge.java
protected short parseType() { String typeString = element.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (typeString.equals("translate")) { return SVGTransform.SVG_TRANSFORM_TRANSLATE; } else if (typeString.equals("scale")) { return SVGTransform.SVG_TRANSFORM_SCALE; } else if (typeString.equals("rotate")) { return SVGTransform.SVG_TRANSFORM_ROTATE; } else if (typeString.equals("skewX")) { return SVGTransform.SVG_TRANSFORM_SKEWX; } else if (typeString.equals("skewY")) { return SVGTransform.SVG_TRANSFORM_SKEWY; } throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_TYPE_ATTRIBUTE, typeString }); }
// in sources/org/apache/batik/bridge/SVGAnimateTransformElementBridge.java
protected AnimatableValue[] parseValues(short type, AnimationTarget target) { String valuesString = element.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); int len = valuesString.length(); if (len == 0) { return null; } ArrayList values = new ArrayList(7); int i = 0, start = 0, end; char c; outer: while (i < len) { while (valuesString.charAt(i) == ' ') { i++; if (i == len) { break outer; } } start = i++; if (i < len) { c = valuesString.charAt(i); while (c != ';') { i++; if (i == len) { break; } c = valuesString.charAt(i); } } end = i++; String valueString = valuesString.substring(start, end); AnimatableValue value = parseValue(valueString, type, target); if (value == null) { throw new BridgeException (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, valuesString }); } values.add(value); } AnimatableValue[] ret = new AnimatableValue[values.size()]; return (AnimatableValue[]) values.toArray(ret); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static float[] convertBaseFrenquency(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_BASE_FREQUENCY_ATTRIBUTE); if (s.length() == 0) { return new float[] {0.001f, 0.001f}; } float[] v = new float[2]; StringTokenizer tokens = new StringTokenizer(s, " ,"); try { v[0] = SVGUtilities.convertSVGNumber(tokens.nextToken()); if (tokens.hasMoreTokens()) { v[1] = SVGUtilities.convertSVGNumber(tokens.nextToken()); } else { v[1] = v[0]; } if (tokens.hasMoreTokens()) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } if (v[0] < 0 || v[1] < 0) { throw new BridgeException (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); } return v; }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static boolean convertStitchTiles(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_STITCH_TILES_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_STITCH_VALUE.equals(s)) { return true; } if (SVG_NO_STITCH_VALUE.equals(s)) { return false; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STITCH_TILES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
protected static boolean convertType(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { return false; } if (SVG_FRACTAL_NOISE_VALUE.equals(s)) { return true; } if (SVG_TURBULENCE_VALUE.equals(s)) { return false; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Filter convertFilter(Element filteredElement, GraphicsNode filteredNode, BridgeContext ctx) { Value v = getComputedStyle(filteredElement, SVGCSSEngine.FILTER_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'filter:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element filter = ctx.getReferencedElement(filteredElement, uri); Bridge bridge = ctx.getBridge(filter); if (bridge == null || !(bridge instanceof FilterBridge)) { throw new BridgeException(ctx, filteredElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((FilterBridge)bridge).createFilter(ctx, filter, filteredElement, filteredNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static ClipRable convertClipPath(Element clippedElement, GraphicsNode clippedNode, BridgeContext ctx) { Value v = getComputedStyle(clippedElement, SVGCSSEngine.CLIP_PATH_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'clip-path:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element cp = ctx.getReferencedElement(clippedElement, uri); Bridge bridge = ctx.getBridge(cp); if (bridge == null || !(bridge instanceof ClipBridge)) { throw new BridgeException(ctx, clippedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((ClipBridge)bridge).createClip(ctx, cp, clippedElement, clippedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Mask convertMask(Element maskedElement, GraphicsNode maskedNode, BridgeContext ctx) { Value v = getComputedStyle(maskedElement, SVGCSSEngine.MASK_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'mask:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element m = ctx.getReferencedElement(maskedElement, uri); Bridge bridge = ctx.getBridge(m); if (bridge == null || !(bridge instanceof MaskBridge)) { throw new BridgeException(ctx, maskedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MaskBridge)bridge).createMask(ctx, m, maskedElement, maskedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
93
            
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException(ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (AnimationException ex) { throw new BridgeException (eng.ctx, ex.getElement().getElement(), ex.getMessage()); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
0 13
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (BridgeException e) { userAgent.displayError(e); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (BridgeException e) { exception = e; ev = new GVTTreeBuilderEvent(this, e.getGraphicsNode()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (BridgeException ex) { // If Security violation notify // the user but keep going. if (ERR_URI_UNSECURE.equals(ex.getCode())) ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
catch (BridgeException e) { // this is ok, it is possible that the glyph at the given // uri is not available. // Display an error message if a security exception occured if (ERR_URI_UNSECURE.equals(e.getCode())) { ctx.getUserAgent().displayError(e); } }
// in sources/org/apache/batik/bridge/PaintServer.java
catch (BridgeException ex) { }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
7
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException be) { // Be only silent if this is a case where the target // could not be found. Do not catch other errors (e.g, // malformed URIs) if (!ERR_URI_BAD_TARGET.equals(be.getCode())) { throw be; } }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { throw ex; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (BridgeException ex) { reference.release(); throw ex; }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // update the exception with the missing parameters ex.setGraphicsNode(rootNode); //ex.printStackTrace(); throw ex; // re-throw the udpated exception }
// in sources/org/apache/batik/bridge/GVTBuilder.java
catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; }
0
unknown (Lib) CSSException 28
            
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/Parser.java
protected Scanner createScanner(InputSource source) { documentURI = source.getURI(); if (documentURI == null) { documentURI = ""; } Reader r = source.getCharacterStream(); if (r != null) { return new Scanner(r); } InputStream is = source.getByteStream(); if (is != null) { return new Scanner(is, source.getEncoding()); } String uri = source.getURI(); if (uri == null) { throw new CSSException(formatMessage("empty.source", null)); } try { ParsedURL purl = new ParsedURL(uri); is = purl.openStreamRaw(CSSConstants.CSS_MIME_TYPE); return new Scanner(is, source.getEncoding()); } catch (IOException e) { throw new CSSException(e); } }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
1
            
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
119
            
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createAndCondition(Condition first, Condition second) throws CSSException { return new DefaultAndCondition(first, second); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new DefaultAttributeCondition(localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createIdCondition(String value) throws CSSException { return new DefaultIdCondition(value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public LangCondition createLangCondition(String lang) throws CSSException { return new DefaultLangCondition(lang); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createOneOfAttributeCondition(String localName, String nsURI, boolean specified, String value) throws CSSException { return new DefaultOneOfAttributeCondition(localName, nsURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createBeginHyphenAttributeCondition (String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new DefaultBeginHyphenAttributeCondition (localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new DefaultClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public AttributeCondition createPseudoClassCondition(String namespaceURI, String value) throws CSSException { return new DefaultPseudoClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/Parser.java
public void setLocale(Locale locale) throws CSSException { localizableSupport.setLocale(locale); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { scanner = createScanner(source); try { documentHandler.startDocument(source); current = scanner.next(); switch (current) { case LexicalUnits.CHARSET_SYMBOL: if (nextIgnoreSpaces() != LexicalUnits.STRING) { reportError("charset.string"); } else { if (nextIgnoreSpaces() != LexicalUnits.SEMI_COLON) { reportError("semicolon"); } next(); } break; case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); } skipSpacesAndCDOCDC(); for (;;) { if (current == LexicalUnits.IMPORT_SYMBOL) { nextIgnoreSpaces(); parseImportRule(); nextIgnoreSpaces(); } else { break; } } loop: for (;;) { switch (current) { case LexicalUnits.PAGE_SYMBOL: nextIgnoreSpaces(); parsePageRule(); break; case LexicalUnits.MEDIA_SYMBOL: nextIgnoreSpaces(); parseMediaRule(); break; case LexicalUnits.FONT_FACE_SYMBOL: nextIgnoreSpaces(); parseFontFaceRule(); break; case LexicalUnits.AT_KEYWORD: nextIgnoreSpaces(); parseAtRule(); break; case LexicalUnits.EOF: break loop; default: parseRuleSet(); } skipSpacesAndCDOCDC(); } } finally { documentHandler.endDocument(source); scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parseStyleSheet(new InputSource(uri)); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclarationInternal() throws CSSException, IOException { nextIgnoreSpaces(); try { parseStyleDeclaration(false); } catch (CSSParseException e) { reportError(e); } finally { scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseRuleInternal() throws CSSException, IOException { nextIgnoreSpaces(); parseRule(); scanner = null; }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected SelectorList parseSelectorsInternal() throws CSSException, IOException { nextIgnoreSpaces(); SelectorList ret = parseSelectorList(); scanner = null; return ret; }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected boolean parsePriorityInternal() throws CSSException, IOException { nextIgnoreSpaces(); scanner = null; switch (current) { case LexicalUnits.EOF: return false; case LexicalUnits.IMPORT_SYMBOL: return true; default: reportError("token", new Object[] { new Integer(current) }); return false; } }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclaration(boolean inSheet) throws CSSException { for (;;) { switch (current) { case LexicalUnits.EOF: if (inSheet) { throw createCSSParseException("eof"); } return; case LexicalUnits.RIGHT_CURLY_BRACE: if (!inSheet) { throw createCSSParseException("eof.expected"); } nextIgnoreSpaces(); return; case LexicalUnits.SEMI_COLON: nextIgnoreSpaces(); continue; default: throw createCSSParseException("identifier"); case LexicalUnits.IDENTIFIER: } String name = scanner.getStringValue(); if (nextIgnoreSpaces() != LexicalUnits.COLON) { throw createCSSParseException("colon"); } nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); } if (exp != null) { boolean important = false; if (current == LexicalUnits.IMPORTANT_SYMBOL) { important = true; nextIgnoreSpaces(); } documentHandler.property(name, exp, important); } } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { scanner = new Scanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(String source) throws CSSException, IOException { scanner = new Scanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { scanner = new Scanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ConditionalSelector createConditionalSelector (SimpleSelector selector, Condition condition) throws CSSException { return new DefaultConditionalSelector(selector, condition); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ElementSelector createElementSelector(String namespaceURI, String tagName) throws CSSException { return new DefaultElementSelector(namespaceURI, tagName); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public ElementSelector createPseudoElementSelector(String namespaceURI, String pseudoName) throws CSSException { return new DefaultPseudoElementSelector(namespaceURI, pseudoName); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public DescendantSelector createDescendantSelector (Selector parent, SimpleSelector descendant) throws CSSException { return new DefaultDescendantSelector(parent, descendant); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public DescendantSelector createChildSelector(Selector parent, SimpleSelector child) throws CSSException { return new DefaultChildSelector(parent, child); }
// in sources/org/apache/batik/css/parser/DefaultSelectorFactory.java
public SiblingSelector createDirectAdjacentSelector (short nodeType, Selector child, SimpleSelector directAdjacent) throws CSSException { return new DefaultDirectAdjacentSelector(nodeType, child, directAdjacent); }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void comment(String text) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void ignorableAtRule(String atRule) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void namespaceDeclaration(String prefix, String uri) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void importStyle(String uri, SACMediaList media, String defaultNamespaceURI) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startMedia(SACMediaList media) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endMedia(SACMediaList media) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startFontFace() throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endFontFace() throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void startSelector(SelectorList selectors) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void endSelector(SelectorList selectors) throws CSSException { }
// in sources/org/apache/batik/css/parser/DefaultDocumentHandler.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void setLocale(Locale locale) throws CSSException { parser.setLocale(locale); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { parser.parseStyleDeclaration(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { parser.parseStyleDeclaration (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(InputSource source) throws CSSException, IOException { parser.parseRule(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(String source) throws CSSException, IOException { parser.parseRule(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { return parser.parseSelectors(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { return parser.parseSelectors (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { return parser.parsePropertyValue(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { return parser.parsePropertyValue (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { return parser.parsePriority(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(String source) throws CSSException, IOException { return parser.parsePriority(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); putAuthorProperty(styleMap, i, v, important, StyleMap.INLINE_AUTHOR_ORIGIN); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endDocument(InputSource source) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void ignorableAtRule(String atRule) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void importStyle(String uri, SACMediaList media, String defaultNamespaceURI) throws CSSException { ImportRule ir = new ImportRule(); ir.setMediaList(media); ir.setParent(styleSheet); ParsedURL base = getCSSBaseURI(); ParsedURL url; if (base == null) { url = new ParsedURL(uri); } else { url = new ParsedURL(base, uri); } ir.setURI(url); styleSheet.append(ir); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startMedia(SACMediaList media) throws CSSException { MediaRule mr = new MediaRule(); mr.setMediaList(media); mr.setParent(styleSheet); styleSheet.append(mr); styleSheet = mr; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endMedia(SACMediaList media) throws CSSException { styleSheet = styleSheet.getParent(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endPage(String name, String pseudo_page) throws CSSException { }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startFontFace() throws CSSException { styleDeclaration = new StyleDeclaration(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endFontFace() throws CSSException { StyleMap sm = new StyleMap(getNumberOfProperties()); int len = styleDeclaration.size(); for (int i=0; i<len; i++) { int idx = styleDeclaration.getIndex(i); sm.putValue(idx, styleDeclaration.getValue(i)); sm.putImportant(idx, styleDeclaration.getPriority(i)); // Not sure on this.. sm.putOrigin(idx, StyleMap.AUTHOR_ORIGIN); } styleDeclaration = null; int pidx = getPropertyIndex(CSSConstants.CSS_FONT_FAMILY_PROPERTY); Value fontFamily = sm.getValue(pidx); if (fontFamily == null) return; ParsedURL base = getCSSBaseURI(); fontFaces.add(new FontFaceRule(sm, base)); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void startSelector(SelectorList selectors) throws CSSException { styleRule = new StyleRule(); styleRule.setSelectorList(selectors); styleDeclaration = new StyleDeclaration(); styleRule.setStyleDeclaration(styleDeclaration); styleSheet.append(styleRule); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void endSelector(SelectorList selectors) throws CSSException { styleRule = null; styleDeclaration = null; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { if (styleMap.isImportant(i)) { // The previous value is important, and a value // from a style attribute cannot be important... return; } updatedProperties[i] = true; Value v = valueManagers[i].createValue(value, CSSEngine.this); styleMap.putMask(i, (short)0); styleMap.putValue(i, v); styleMap.putOrigin(i, StyleMap.INLINE_AUTHOR_ORIGIN); } }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ConditionalSelector createConditionalSelector (SimpleSelector selector, Condition condition) throws CSSException { return new CSSConditionalSelector(selector, condition); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createAnyNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public NegativeSelector createNegativeSelector(SimpleSelector selector) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ElementSelector createElementSelector(String namespaceURI, String tagName) throws CSSException { return new CSSElementSelector(namespaceURI, tagName); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createTextNodeSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCDataSectionSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ProcessingInstructionSelector createProcessingInstructionSelector (String target, String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public CharacterDataSelector createCommentSelector(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public ElementSelector createPseudoElementSelector(String namespaceURI, String pseudoName) throws CSSException { return new CSSPseudoElementSelector(namespaceURI, pseudoName); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public DescendantSelector createDescendantSelector (Selector parent, SimpleSelector descendant) throws CSSException { return new CSSDescendantSelector(parent, descendant); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public DescendantSelector createChildSelector(Selector parent, SimpleSelector child) throws CSSException { return new CSSChildSelector(parent, child); }
// in sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java
public SiblingSelector createDirectAdjacentSelector (short nodeType, Selector child, SimpleSelector directAdjacent) throws CSSException { return new CSSDirectAdjacentSelector(nodeType, child, directAdjacent); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createAndCondition(Condition first, Condition second) throws CSSException { return new CSSAndCondition(first, second); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public CombinatorCondition createOrCondition(Condition first, Condition second) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public NegativeCondition createNegativeCondition(Condition condition) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public PositionalCondition createPositionalCondition(int position, boolean typeNode, boolean type) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createAttributeCondition(String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new CSSAttributeCondition(localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createIdCondition(String value) throws CSSException { return new CSSIdCondition(idNamespaceURI, idLocalName, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public LangCondition createLangCondition(String lang) throws CSSException { return new CSSLangCondition(lang); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createOneOfAttributeCondition(String localName, String nsURI, boolean specified, String value) throws CSSException { return new CSSOneOfAttributeCondition(localName, nsURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createBeginHyphenAttributeCondition (String localName, String namespaceURI, boolean specified, String value) throws CSSException { return new CSSBeginHyphenAttributeCondition (localName, namespaceURI, specified, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createClassCondition(String namespaceURI, String value) throws CSSException { return new CSSClassCondition(classLocalName, classNamespaceURI, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public AttributeCondition createPseudoClassCondition(String namespaceURI, String value) throws CSSException { return new CSSPseudoClassCondition(namespaceURI, value); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyChildCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public Condition createOnlyTypeCondition() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
// in sources/org/apache/batik/css/engine/sac/CSSConditionFactory.java
public ContentCondition createContentCondition(String data) throws CSSException { throw new CSSException("Not implemented in CSS2"); }
0 0 0
unknown (Lib) CSSParseException 0 0 0 7
            
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); return; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); }
1
            
// in sources/org/apache/batik/css/parser/Parser.java
catch (CSSParseException e) { reportError(e); throw e; }
0
unknown (Lib) CannotRedoException 0 0 0 1
            
// in sources/org/apache/batik/util/gui/xmleditor/XMLTextEditor.java
catch (CannotRedoException ex) { }
0 0
unknown (Lib) CannotUndoException 0 0 0 1
            
// in sources/org/apache/batik/util/gui/xmleditor/XMLTextEditor.java
catch (CannotUndoException ex) { }
0 0
unknown (Lib) ClassCastException 4
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public int getAsInt(int index) { switch (type) { case TIFF_BYTE: case TIFF_UNDEFINED: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public long getAsLong(int index) { switch (type) { case TIFF_BYTE: case TIFF_UNDEFINED: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public float getAsFloat(int index) { switch (type) { case TIFF_BYTE: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; case TIFF_FLOAT: return ((float[])data)[index]; case TIFF_DOUBLE: return (float)((double[])data)[index]; case TIFF_SRATIONAL: int[] ivalue = getAsSRational(index); return (float)((double)ivalue[0]/ivalue[1]); case TIFF_RATIONAL: long[] lvalue = getAsRational(index); return (float)((double)lvalue[0]/lvalue[1]); default: throw new ClassCastException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public double getAsDouble(int index) { switch (type) { case TIFF_BYTE: return ((byte[])data)[index] & 0xff; case TIFF_SBYTE: return ((byte[])data)[index]; case TIFF_SHORT: return ((char[])data)[index] & 0xffff; case TIFF_SSHORT: return ((short[])data)[index]; case TIFF_SLONG: return ((int[])data)[index]; case TIFF_LONG: return ((long[])data)[index]; case TIFF_FLOAT: return ((float[])data)[index]; case TIFF_DOUBLE: return ((double[])data)[index]; case TIFF_SRATIONAL: int[] ivalue = getAsSRational(index); return (double)ivalue[0]/ivalue[1]; case TIFF_RATIONAL: long[] lvalue = getAsRational(index); return (double)lvalue[0]/lvalue[1]; default: throw new ClassCastException(); } }
0 0 2
            
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
2
            
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
2
unknown (Lib) ClassNotFoundException 0 0 2
            
// in sources/org/apache/batik/dom/AbstractDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); Class c = Class.forName((String)s.readObject()); try { Method m = c.getMethod("getDOMImplementation", (Class[])null); implementation = (DOMImplementation)m.invoke(null, (Object[])null); } catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } } }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); }
5
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (ClassNotFoundException e) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (ClassNotFoundException cnfe) { }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (ClassNotFoundException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (ClassNotFoundException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
1
            
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
0
unknown (Lib) CloneNotSupportedException 0 0 2
            
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public Object clone() throws CloneNotSupportedException { return copy(); }
// in sources/org/apache/batik/dom/events/AbstractEvent.java
public Object clone() throws CloneNotSupportedException { AbstractEvent newEvent = (AbstractEvent) super.clone(); newEvent.timeStamp = System.currentTimeMillis(); return newEvent; }
3
            
// in sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java
catch (CloneNotSupportedException ex) {}
// in sources/org/apache/batik/ext/awt/g2d/TransformStackElement.java
catch(java.lang.CloneNotSupportedException ex) {}
// in sources/org/apache/batik/dom/events/AbstractEvent.java
catch (CloneNotSupportedException e) { return null; }
0 0
unknown (Lib) ConcurrentModificationException 4
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void remove() { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.remove(lastRet); if (lastRet < cursor) { cursor--; } lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
final void checkForComodification() { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void set(Object o) { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.set(lastRet, o); expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(Object o) { checkForComodification(); try { CompositeGraphicsNode.this.add(cursor++, o); lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
3
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
0 0 0 0
unknown (Lib) DOMException 139
            
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
public CSSEngine createCSSEngine(AbstractStylableDocument doc, CSSContext ctx) { String pn = XMLResourceDescriptor.getCSSParserClassName(); Parser p; try { p = (Parser)Class.forName(pn).newInstance(); } catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); } catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); } catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); } ExtendedParser ep = ExtendedParserWrapper.wrap(p); ValueManager[] vms; if (customValueManagers == null) { vms = new ValueManager[0]; } else { vms = new ValueManager[customValueManagers.size()]; Iterator it = customValueManagers.iterator(); int i = 0; while (it.hasNext()) { vms[i++] = (ValueManager)it.next(); } } ShorthandManager[] sms; if (customShorthandManagers == null) { sms = new ShorthandManager[0]; } else { sms = new ShorthandManager[customShorthandManagers.size()]; Iterator it = customShorthandManagers.iterator(); int i = 0; while (it.hasNext()) { sms[i++] = (ShorthandManager)it.next(); } } CSSEngine result = createCSSEngine(doc, ctx, ep, vms, sms); doc.setCSSEngine(result); return result; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) { if (qualifiedName == null) { qualifiedName = ""; } int test = XMLUtilities.testXMLQName(qualifiedName); if ((test & XMLUtilities.IS_XML_10_NAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("xml.name", new Object[] { qualifiedName })); } if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("invalid.qname", new Object[] { qualifiedName })); } return new GenericDocumentType(qualifiedName, publicId, systemId); }
// in sources/org/apache/batik/dom/GenericDOMImplementation.java
public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) { if (qualifiedName == null) { qualifiedName = ""; } int test = XMLUtilities.testXMLQName(qualifiedName); if ((test & XMLUtilities.IS_XML_10_NAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("xml.name", new Object[] { qualifiedName })); } if ((test & XMLUtilities.IS_XML_10_QNAME) == 0) { throw new DOMException (DOMException.INVALID_CHARACTER_ERR, formatMessage("invalid.qname", new Object[] { qualifiedName })); } return new GenericDocumentType(qualifiedName, publicId, systemId); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public Value getValue() { if (value == null) { throw new DOMException(DOMException.INVALID_STATE_ERR, ""); } return value; }
// in sources/org/apache/batik/dom/events/DocumentEventSupport.java
public Event createEvent(String eventType) throws DOMException { EventFactory ef = (EventFactory)eventFactories.get(eventType.toLowerCase()); if (ef == null) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Bad event type: " + eventType); } return ef.createEvent(); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkType(Element elt, String str) { if (!"simple".equals(str) && !"extended".equals(str) && !"locator".equals(str) && !"arc".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:type='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "type", str); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkShow(Element elt, String str) { if (!"new".equals(str) && !"replace".equals(str) && !"embed".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:show='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "show", str); }
// in sources/org/apache/batik/dom/util/XLinkSupport.java
public static void setXLinkActuate(Element elt, String str) { if (!"onReplace".equals(str) && !"onLoad".equals(str)) { throw new DOMException(DOMException.SYNTAX_ERR, "xlink:actuate='" + str + "'"); } elt.setAttributeNS(XLINK_NAMESPACE_URI, "actuate", str); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void parseStyleSheetPIData(String data, HashTable table) { // !!! Internationalization char c; int i = 0; // Skip leading whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } while (i < data.length()) { // Parse the pseudo attribute name c = data.charAt(i); int d = c / 32; int m = c % 32; if ((NAME_FIRST_CHARACTER[d] & (1 << m)) == 0) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, "Wrong name initial: " + c); } StringBuffer ident = new StringBuffer(); ident.append(c); while (++i < data.length()) { c = data.charAt(i); d = c / 32; m = c % 32; if ((NAME_CHARACTER[d] & (1 << m)) == 0) { break; } ident.append(c); } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // The next char must be '=' if (data.charAt(i) != '=') { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } i++; // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } // The next char must be '\'' or '"' c = data.charAt(i); i++; StringBuffer value = new StringBuffer(); if (c == '\'') { while (i < data.length()) { c = data.charAt(i); if (c == '\'') { break; } value.append(c); i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } } else if (c == '"') { while (i < data.length()) { c = data.charAt(i); if (c == '"') { break; } value.append(c); i++; } if (i >= data.length()) { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } } else { throw new DOMException(DOMException.SYNTAX_ERR, "Wrong xml-stylesheet data: " + data); } table.put(ident.toString().intern(), value.toString()); i++; // Skip whitespaces while (i < data.length()) { c = data.charAt(i); if (!XMLUtilities.isXMLSpace(c)) { break; } i++; } } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public short getColorType() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setUri(String uri) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { ((PaintModificationHandler)handler).uriChanged(uri); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setPaint(short paintType, String uri, String rgbColor, String iccColor) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { ((PaintModificationHandler)handler).paintChanged (paintType, uri, rgbColor, iccColor); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + text + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + text + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + text + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + text + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + text + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + text + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ")"; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0).getCssText() + ' ' + text; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0).getCssText() + ' ' + text + ' ' + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: textChanged(getValue().item(0).getCssText() + ' ' + rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_PAINTTYPE_CURRENTCOLOR: textChanged("currentcolor"); break; case SVG_PAINTTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorProfileChanged(String cp) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); sb.append(cp); iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsCleared() throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsInitialized(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorInsertedBefore(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorReplaced(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorRemoved(int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorAppend(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.floatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public static float convertFloatValue(short unitType, Value value) { switch (unitType) { case CSSPrimitiveValue.CSS_NUMBER: case CSSPrimitiveValue.CSS_PERCENTAGE: case CSSPrimitiveValue.CSS_EMS: case CSSPrimitiveValue.CSS_EXS: case CSSPrimitiveValue.CSS_DIMENSION: case CSSPrimitiveValue.CSS_PX: if (value.getPrimitiveType() == unitType) { return value.getFloatValue(); } break; case CSSPrimitiveValue.CSS_CM: return toCentimeters(value); case CSSPrimitiveValue.CSS_MM: return toMillimeters(value); case CSSPrimitiveValue.CSS_IN: return toInches(value); case CSSPrimitiveValue.CSS_PT: return toPoints(value); case CSSPrimitiveValue.CSS_PC: return toPicas(value); case CSSPrimitiveValue.CSS_DEG: return toDegrees(value); case CSSPrimitiveValue.CSS_RAD: return toRadians(value); case CSSPrimitiveValue.CSS_GRAD: return toGradians(value); case CSSPrimitiveValue.CSS_MS: return toMilliseconds(value); case CSSPrimitiveValue.CSS_S: return toSeconds(value); case CSSPrimitiveValue.CSS_HZ: return toHertz(value); case CSSPrimitiveValue.CSS_KHZ: return tokHertz(value); } throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toCentimeters(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return value.getFloatValue(); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() / 10); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 2.54f); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() * 2.54f / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 2.54f / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toInches(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() / 25.4f); case CSSPrimitiveValue.CSS_IN: return value.getFloatValue(); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toMillimeters(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 10); case CSSPrimitiveValue.CSS_MM: return value.getFloatValue(); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 25.4f); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() * 25.4f / 72); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 25.4f / 6); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toPoints(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 72 / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() * 72 / 25.4f); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 72); case CSSPrimitiveValue.CSS_PT: return value.getFloatValue(); case CSSPrimitiveValue.CSS_PC: return (value.getFloatValue() * 12); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toPicas(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_CM: return (value.getFloatValue() * 6 / 2.54f); case CSSPrimitiveValue.CSS_MM: return (value.getFloatValue() * 6 / 25.4f); case CSSPrimitiveValue.CSS_IN: return (value.getFloatValue() * 6); case CSSPrimitiveValue.CSS_PT: return (value.getFloatValue() / 12); case CSSPrimitiveValue.CSS_PC: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toDegrees(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return value.getFloatValue(); case CSSPrimitiveValue.CSS_RAD: return (float) Math.toDegrees( value.getFloatValue() ); case CSSPrimitiveValue.CSS_GRAD: return (value.getFloatValue() * 9 / 5); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toRadians(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return (value.getFloatValue() * 5 / 9); // todo ?? case CSSPrimitiveValue.CSS_RAD: return value.getFloatValue(); case CSSPrimitiveValue.CSS_GRAD: return (float)(value.getFloatValue() * 100 / Math.PI); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toGradians(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_DEG: return (float)(value.getFloatValue() * Math.PI / 180); // todo ???? case CSSPrimitiveValue.CSS_RAD: return (float)(value.getFloatValue() * Math.PI / 100); case CSSPrimitiveValue.CSS_GRAD: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toMilliseconds(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_MS: return value.getFloatValue(); case CSSPrimitiveValue.CSS_S: return (value.getFloatValue() * 1000); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toSeconds(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_MS: return (value.getFloatValue() / 1000); case CSSPrimitiveValue.CSS_S: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float toHertz(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_HZ: return value.getFloatValue(); case CSSPrimitiveValue.CSS_KHZ: return (value.getFloatValue() / 1000); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected static float tokHertz(Value value) { switch (value.getPrimitiveType()) { case CSSPrimitiveValue.CSS_HZ: return (value.getFloatValue() * 1000); case CSSPrimitiveValue.CSS_KHZ: return value.getFloatValue(); default: throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.stringValueChanged(stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public int getLength() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public CSSValue item(int index) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
protected Value getValue() { if (index >= valueProvider.getValue().getLength()) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } return valueProvider.getValue().item(index); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listTextChanged(index, cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listFloatValueChanged(index, unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listStringValueChanged(index, stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setCssText(String cssText) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public String removeProperty(String propertyName) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { values = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public String removeProperty(String propertyName) throws DOMException { String result = getPropertyValue(propertyName); if (result.length() > 0) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (values != null) { values.remove(propertyName); } handler.propertyRemoved(propertyName); } } return result; }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.propertyChanged(propertyName, value, prio); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (values == null || values.get(this) == null || StyleDeclarationValue.this.handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setRGBColor(String color) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.rgbColorChanged(color); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setRGBColorICCColor(String rgb, String icc) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.rgbColorICCColorChanged(rgb, icc); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColor(short type, String rgb, String icc) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorChanged(type, rgb, icc); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public String getColorProfile() { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } Value value = valueProvider.getValue(); return ((ICCColor)value.item(1)).getColorProfile(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColorProfile(String colorProfile) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorProfileChanged(colorProfile); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public int getNumberOfItems() { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } Value value = valueProvider.getValue(); return ((ICCColor)value.item(1)).getNumberOfColors(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void clear() throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorsCleared(); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { float f = newItem.getValue(); iccColors = new ArrayList(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorsInitialized(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber getItem(int index) throws DOMException { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } Value value = valueProvider.getValue().item(1); float f = ((ICCColor)value).getColor(index); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); return result; }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index > n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(index, result); handler.colorInsertedBefore(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); handler.colorReplaced(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber removeItem(int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } SVGNumber result = null; if (iccColors != null) { result = (ColorNumber)iccColors.get(index); } if (result == null) { Value value = valueProvider.getValue().item(1); result = new ColorNumber(((ICCColor)value).getColor(index)); } handler.colorRemoved(index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber appendItem (SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (iccColors == null) { int n = getNumberOfItems(); iccColors = new ArrayList(n); for (int i = 0; i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorAppend(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setValue(float f) { value = f; if (iccColors == null) { return; } int idx = iccColors.indexOf(this); if (idx == -1) { return; } if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorReplaced(f, idx); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append( value.getGreen().getCssText()); sb.append(','); sb.append( value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorChanged(String text) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_COLORTYPE_CURRENTCOLOR: textChanged(CSSConstants.CSS_CURRENTCOLOR_VALUE); break; case SVG_COLORTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorProfileChanged(String cp) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)value.item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsCleared() throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsInitialized(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorInsertedBefore(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorReplaced(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorRemoved(int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorAppend(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public int getLength() { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public CSSValue item(int index) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/engine/value/FloatValue.java
public static String getCssText(short unit, float value) { if (unit < 0 || unit >= UNITS.length) { throw new DOMException(DOMException.SYNTAX_ERR, ""); } String s = String.valueOf(value); if (s.endsWith(".0")) { s = s.substring(0, s.length() - 2); } return s + UNITS[unit - CSSPrimitiveValue.CSS_NUMBER]; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void setMedia(String str) { try { media = parser.parseMedia(str); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); } }
4
            
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (ClassNotFoundException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.class", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
497
            
// in sources/org/apache/batik/dom/AbstractDocument.java
public Node importNode(Node importedNode, boolean deep) throws DOMException { return importNode(importedNode, deep, false); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Event createEvent(String eventType) throws DOMException { if (documentEventSupport == null) { documentEventSupport = ((AbstractDOMImplementation)implementation). createDocumentEventSupport(); } return documentEventSupport.createEvent(eventType); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public NodeIterator createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { if (traversalSupport == null) { traversalSupport = new TraversalSupport(); } return traversalSupport.createNodeIterator(this, root, whatToShow, filter, entityReferenceExpansion); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public TreeWalker createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { return TraversalSupport.createTreeWalker(this, root, whatToShow, filter, entityReferenceExpansion); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setXmlStandalone(boolean b) throws DOMException { xmlStandalone = b; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setXmlVersion(String v) throws DOMException { if (v == null || !v.equals(XMLConstants.XML_VERSION_10) && !v.equals(XMLConstants.XML_VERSION_11)) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "xml.version", new Object[] { v }); } xmlVersion = v; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Node adoptNode(Node n) throws DOMException { if (!(n instanceof AbstractNode)) { return null; } switch (n.getNodeType()) { case Node.DOCUMENT_NODE: throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document", new Object[] {}); case Node.DOCUMENT_TYPE_NODE: throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "adopt.document.type", new Object[] {}); case Node.ENTITY_NODE: case Node.NOTATION_NODE: return null; } AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(an.getNodeType()), an.getNodeName() }); } Node parent = n.getParentNode(); if (parent != null) { parent.removeChild(n); } adoptNode1((AbstractNode) n); return n; }
// in sources/org/apache/batik/dom/AbstractDocument.java
public void setTextContent(String s) throws DOMException { }
// in sources/org/apache/batik/dom/AbstractDocument.java
public XPathExpression createExpression(String expression, XPathNSResolver resolver) throws DOMException, XPathException { return new XPathExpr(expression, resolver); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Object evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) throws XPathException, DOMException { XPathExpression xpath = createExpression(expression, resolver); return xpath.evaluate(contextNode, type, result); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public Object evaluate(Node contextNode, short type, Object res) throws XPathException, DOMException { if (contextNode.getNodeType() != DOCUMENT_NODE && contextNode.getOwnerDocument() != AbstractDocument.this || contextNode.getNodeType() == DOCUMENT_NODE && contextNode != AbstractDocument.this) { throw createDOMException (DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[] { new Integer(contextNode.getNodeType()), contextNode.getNodeName() }); } if (type < 0 || type > 9) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "xpath.invalid.result.type", new Object[] { new Integer(type) }); } switch (contextNode.getNodeType()) { case ENTITY_REFERENCE_NODE: case ENTITY_NODE: case DOCUMENT_TYPE_NODE: case DOCUMENT_FRAGMENT_NODE: case NOTATION_NODE: throw createDOMException (DOMException.NOT_SUPPORTED_ERR, "xpath.invalid.context.node", new Object[] { new Integer(contextNode.getNodeType()), contextNode.getNodeName() }); } context.reset(); XObject result = null; try { result = xpath.execute(context, contextNode, prefixResolver); } catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); } try { switch (type) { case XPathResult.ANY_UNORDERED_NODE_TYPE: case XPathResult.FIRST_ORDERED_NODE_TYPE: return convertSingleNode(result, type); case XPathResult.BOOLEAN_TYPE: return convertBoolean(result); case XPathResult.NUMBER_TYPE: return convertNumber(result); case XPathResult.ORDERED_NODE_ITERATOR_TYPE: case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE: case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE: return convertNodeIterator(result, type); case XPathResult.STRING_TYPE: return convertString(result); case XPathResult.ANY_TYPE: switch (result.getType()) { case XObject.CLASS_BOOLEAN: return convertBoolean(result); case XObject.CLASS_NUMBER: return convertNumber(result); case XObject.CLASS_STRING: return convertString(result); case XObject.CLASS_NODESET: return convertNodeIterator (result, XPathResult.UNORDERED_NODE_ITERATOR_TYPE); } } } catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); } return null; }
// in sources/org/apache/batik/dom/AbstractNotation.java
public void setTextContent(String s) throws DOMException { }
// in sources/org/apache/batik/dom/svg12/SVG12DOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { SVGOMDocument result = new SVG12OMDocument(doctype, this); result.setIsSVG12(true); // BUG 32108: return empty document if qualifiedName is null. if (qualifiedName != null) result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/svg12/XBLOMElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/dom/AbstractText.java
public Text splitText(int offset) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String v = getNodeValue(); if (offset < 0 || offset >= v.length()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } Node n = getParentNode(); if (n == null) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "need.parent", new Object[] {}); } String t1 = v.substring(offset); Text t = createTextNode(t1); Node ns = getNextSibling(); if (ns != null) { n.insertBefore(t, ns); } else { n.appendChild(t); } setNodeValue(v.substring(0, offset)); return t; }
// in sources/org/apache/batik/dom/AbstractText.java
public Text replaceWholeText(String s) throws DOMException { for (Node n = getPreviousLogicallyAdjacentTextNode(this); n != null; n = getPreviousLogicallyAdjacentTextNode(n)) { AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(n.getNodeType()), n.getNodeName() }); } } for (Node n = getNextLogicallyAdjacentTextNode(this); n != null; n = getNextLogicallyAdjacentTextNode(n)) { AbstractNode an = (AbstractNode) n; if (an.isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(n.getNodeType()), n.getNodeName() }); } } Node parent = getParentNode(); for (Node n = getPreviousLogicallyAdjacentTextNode(this); n != null; n = getPreviousLogicallyAdjacentTextNode(n)) { parent.removeChild(n); } for (Node n = getNextLogicallyAdjacentTextNode(this); n != null; n = getNextLogicallyAdjacentTextNode(n)) { parent.removeChild(n); } if (isReadonly()) { Text t = createTextNode(s); parent.replaceChild(t, this); return t; } setNodeValue(s); return this; }
// in sources/org/apache/batik/dom/AbstractNode.java
public String getNodeValue() throws DOMException { return null; }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setNodeValue(String nodeValue) throws DOMException { }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node insertBefore(Node newChild, Node refChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName()}); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node removeChild(Node oldChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public Node appendChild(Node newChild) throws DOMException { throw createDOMException(DOMException.HIERARCHY_REQUEST_ERR, "children.not.allowed", new Object[] { new Integer(getNodeType()), getNodeName() }); }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String uri = getNamespaceURI(); if (uri == null) { throw createDOMException(DOMException.NAMESPACE_ERR, "namespace", new Object[] { new Integer(getNodeType()), getNodeName() }); } String name = getLocalName(); if (prefix == null) { // prefix null is explicitly allowed by org.w3c.dom.Node#setPrefix(String) setNodeName(name); return; } // prefix is guaranteed to be non-null here... if (!prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } if (!DOMUtilities.isValidPrefix(prefix)) { throw createDOMException(DOMException.NAMESPACE_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } if ((prefix.equals("xml") && !XMLSupport.XML_NAMESPACE_URI.equals(uri)) || (prefix.equals("xmlns") && !XMLSupport.XMLNS_NAMESPACE_URI.equals(uri))) { throw createDOMException(DOMException.NAMESPACE_ERR, "namespace.uri", new Object[] { new Integer(getNodeType()), getNodeName(), uri }); } setNodeName(prefix + ':' + name); }
// in sources/org/apache/batik/dom/AbstractNode.java
public short compareDocumentPosition(Node other) throws DOMException { if (this == other) { return 0; } ArrayList a1 = new ArrayList(10); ArrayList a2 = new ArrayList(10); int c1 = 0; int c2 = 0; Node n; if (getNodeType() == ATTRIBUTE_NODE) { a1.add(this); c1++; n = ((Attr) this).getOwnerElement(); if (other.getNodeType() == ATTRIBUTE_NODE) { Attr otherAttr = (Attr) other; if (n == otherAttr.getOwnerElement()) { if (hashCode() < ((Attr) other).hashCode()) { return DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; } else { return DOCUMENT_POSITION_FOLLOWING | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; } } } } else { n = this; } while (n != null) { if (n == other) { return DOCUMENT_POSITION_CONTAINED_BY | DOCUMENT_POSITION_FOLLOWING; } a1.add(n); c1++; n = n.getParentNode(); } if (other.getNodeType() == ATTRIBUTE_NODE) { a2.add(other); c2++; n = ((Attr) other).getOwnerElement(); } else { n = other; } while (n != null) { if (n == this) { return DOCUMENT_POSITION_CONTAINS | DOCUMENT_POSITION_PRECEDING; } a2.add(n); c2++; n = n.getParentNode(); } int i1 = c1 - 1; int i2 = c2 - 1; if (a1.get(i1) != a2.get(i2)) { if (hashCode() < other.hashCode()) { return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_PRECEDING; } else { return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING; } } Object n1 = a1.get(i1); Object n2 = a2.get(i2); while (n1 == n2) { n = (Node) n1; n1 = a1.get(--i1); n2 = a2.get(--i2); } for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n == n1) { return DOCUMENT_POSITION_PRECEDING; } else if (n == n2) { return DOCUMENT_POSITION_FOLLOWING; } } return DOCUMENT_POSITION_DISCONNECTED; }
// in sources/org/apache/batik/dom/AbstractNode.java
public void setTextContent(String s) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (getNodeType() != DOCUMENT_TYPE_NODE) { while (getFirstChild() != null) { removeChild(getFirstChild()); } appendChild(getOwnerDocument().createTextNode(s)); } }
// in sources/org/apache/batik/dom/GenericDOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { Document result = new GenericDocument(doctype, this); result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/AbstractAttr.java
public String getNodeValue() throws DOMException { Node first = getFirstChild(); if (first == null) { return ""; } Node n = first.getNextSibling(); if (n == null) { return first.getNodeValue(); } StringBuffer result = new StringBuffer(first.getNodeValue()); do { result.append(n.getNodeValue()); n = n.getNextSibling(); } while (n != null); return result.toString(); }
// in sources/org/apache/batik/dom/AbstractAttr.java
public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String s = getNodeValue(); // Remove all the children Node n; while ((n = getFirstChild()) != null) { removeChild(n); } String val = (nodeValue == null) ? "" : nodeValue; // Create and append a new child. n = getOwnerDocument().createTextNode(val); appendChild(n); if (ownerElement != null) { ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION); } }
// in sources/org/apache/batik/dom/AbstractAttr.java
public void setValue(String value) throws DOMException { setNodeValue(value); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public String getNodeValue() throws DOMException { return getData(); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public void setNodeValue(String nodeValue) throws DOMException { setData(nodeValue); }
// in sources/org/apache/batik/dom/AbstractProcessingInstruction.java
public void setData(String data) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String val = this.data; this.data = data; // Mutation event fireDOMCharacterDataModifiedEvent(val, this.data); if (getParentNode() != null) { ((AbstractParentNode)getParentNode()). fireDOMSubtreeModifiedEvent(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValue(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValueInSpecifiedUnits(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public void setValueAsString(String value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public float getSimpleDuration() throws DOMException { float dur = ((SVGAnimationContext) getSVGContext()).getSimpleDuration(); if (dur == TimedElement.INDEFINITE) { throw createDOMException(DOMException.NOT_SUPPORTED_ERR, "animation.dur.indefinite", null); } return dur; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean beginElement() throws DOMException { return ((SVGAnimationContext) getSVGContext()).beginElement(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean beginElementAt(float offset) throws DOMException { return ((SVGAnimationContext) getSVGContext()).beginElementAt(offset); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean endElement() throws DOMException { return ((SVGAnimationContext) getSVGContext()).endElement(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimationElement.java
public boolean endElementAt(float offset) throws DOMException { return ((SVGAnimationContext) getSVGContext()).endElementAt(offset); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException, SVGException { return (SVGNumber)initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber getItem(int index) throws DOMException { return (SVGNumber)getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException, SVGException { return (SVGNumber)insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException, SVGException { return (SVGNumber)replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber removeItem(int index) throws DOMException { return (SVGNumber)removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public SVGNumber appendItem(SVGNumber newItem) throws DOMException, SVGException { return (SVGNumber)appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValue(float value) throws DOMException { revalidate(); this.unitType = SVG_ANGLETYPE_DEG; this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValueInSpecifiedUnits(float value) throws DOMException { revalidate(); this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void setValueAsString(String value) throws DOMException { parse(value); reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValue(float value) throws DOMException { this.value = UnitProcessor.userSpaceToSVG(value, unitType, direction, context); reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValueInSpecifiedUnits(float value) throws DOMException { revalidate(); this.value = value; reset(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
public void setValueAsString(String value) throws DOMException { parse(value); reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
public void setBaseVal(short baseVal) throws DOMException { if (baseVal >= 0 && baseVal < values.length) { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, values[baseVal]); } finally { changing = false; } } }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { value = cssEngine.parsePropertyValue (SVGStylableElement.this, property, text); mutate = true; setAttributeNS(null, property, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { declaration = cssEngine.parseStyleDeclaration (SVGStylableElement.this, text); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, text); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyRemoved(String name) throws DOMException { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; return; } } }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyChanged(String name, String value, String prio) throws DOMException { boolean important = prio != null && prio.length() > 0; cssEngine.setMainProperties(SVGStylableElement.this, this, name, value, important); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void textChanged(String text) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStyleTextChanged (SVGStylableElement.this, text); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyRemoved(String name) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStylePropertyRemoved (SVGStylableElement.this, name); }
// in sources/org/apache/batik/dom/svg/SVGStylableElement.java
public void propertyChanged(String name, String value, String prio) throws DOMException { ((SVGOMDocument) ownerDocument).overrideStylePropertyChanged (SVGStylableElement.this, name, value, prio); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
protected void setValueAsString(String value) throws DOMException { PreserveAspectRatioParserHandler ph; ph = new PreserveAspectRatioParserHandler(); try { PreserveAspectRatioParser p = new PreserveAspectRatioParser(); p.setPreserveAspectRatioHandler(ph); p.parse(value); align = ph.getAlign(); meetOrSlice = ph.getMeetOrSlice(); } catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); } }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setXMLspace(String space) throws DOMException { setAttributeNS(XML_NAMESPACE_URI, XML_SPACE_QNAME, space); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setType(String type) throws DOMException { setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setMedia(String media) throws DOMException { setAttribute(SVG_MEDIA_ATTRIBUTE, media); }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public void setTitle(String title) throws DOMException { setAttribute(SVG_TITLE_ATTRIBUTE, title); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGRect getExtentOfChar(Element elt, final int charnum ) { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGRect() { public float getX() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getX(); } public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getY() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getY(); } public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getWidth() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getWidth(); } public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getHeight() { return (float)SVGTextContentSupport.getExtent (svgelt, context, charnum).getHeight(); } public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGPoint getStartPositionOfChar (Element elt, final int charnum) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGTextPoint(svgelt){ public float getX(){ return (float)SVGTextContentSupport.getStartPos (this.svgelt, context, charnum).getX(); } public float getY(){ return (float)SVGTextContentSupport.getStartPos (this.svgelt, context, charnum).getY(); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static SVGPoint getEndPositionOfChar (Element elt,final int charnum) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; if ( (charnum < 0) || (charnum >= getNumberOfChars(elt)) ){ throw svgelt.createDOMException (DOMException.INDEX_SIZE_ERR, "",null); } final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return new SVGTextPoint(svgelt){ public float getX(){ return (float)SVGTextContentSupport.getEndPos (this.svgelt, context, charnum).getX(); } public float getY(){ return (float)SVGTextContentSupport.getEndPos (this.svgelt, context, charnum).getY(); } }; }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public static int getCharNumAtPosition(Element elt, final float x, final float y) throws DOMException { final SVGOMElement svgelt = (SVGOMElement)elt; final SVGTextContent context = (SVGTextContent)svgelt.getSVGContext(); return context.getCharNumAtPosition(x,y); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGTextContentSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setX(float x) throws DOMException { this.x = x; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setY(float y) throws DOMException { this.y = y; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setWidth(float width) throws DOMException { this.w = width; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setHeight(float height) throws DOMException { this.h = height; reset(); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setX(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setY(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setWidth(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void setHeight(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length", null); }
// in sources/org/apache/batik/dom/svg/SVGZoomAndPanSupport.java
public static void setZoomAndPan(Element elt, short val) throws DOMException { switch (val) { case SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE: elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, SVG_DISABLE_VALUE); break; case SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY: elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, SVG_MAGNIFY_VALUE); break; default: throw ((AbstractNode)elt).createDOMException (DOMException.INVALID_MODIFICATION_ERR, "zoom.and.pan", new Object[] { new Integer(val) }); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setA(float a) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(a, at.getShearY(), at.getShearX(), at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setB(float b) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), b, at.getShearX(), at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setC(float c) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), c, at.getScaleY(), at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setD(float d) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), d, at.getTranslateX(), at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setE(float e) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), at.getScaleY(), e, at.getTranslateY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public void setF(float f) throws DOMException { AffineTransform at = getAffineTransform(); at.setTransform(at.getScaleX(), at.getShearY(), at.getShearX(), at.getScaleY(), at.getTranslateX(), f); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setLocal(String local) throws DOMException { setAttributeNS(null, SVG_LOCAL_ATTRIBUTE, local); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setName(String name) throws DOMException { setAttributeNS(null, SVG_NAME_ATTRIBUTE, name); }
// in sources/org/apache/batik/dom/svg/SVGOMColorProfileElement.java
public void setRenderingIntent(short renderingIntent) throws DOMException { switch (renderingIntent) { case RENDERING_INTENT_AUTO: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_AUTO_VALUE); break; case RENDERING_INTENT_PERCEPTUAL: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_PERCEPTUAL_VALUE); break; case RENDERING_INTENT_RELATIVE_COLORIMETRIC: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_RELATIVE_COLORIMETRIC_VALUE); break; case RENDERING_INTENT_SATURATION: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_SATURATE_VALUE); break; case RENDERING_INTENT_ABSOLUTE_COLORIMETRIC: setAttributeNS(null, SVG_RENDERING_INTENT_ATTRIBUTE, SVG_ABSOLUTE_COLORIMETRIC_VALUE); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg initialize ( SVGPathSeg newItem ) throws DOMException, SVGException { return (SVGPathSeg)initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg getItem ( int index ) throws DOMException { return (SVGPathSeg)getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg insertItemBefore ( SVGPathSeg newItem, int index ) throws DOMException, SVGException { return (SVGPathSeg)insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg replaceItem ( SVGPathSeg newItem, int index ) throws DOMException, SVGException { return (SVGPathSeg)replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg removeItem ( int index ) throws DOMException { return (SVGPathSeg)removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public SVGPathSeg appendItem ( SVGPathSeg newItem ) throws DOMException, SVGException { return (SVGPathSeg) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedInteger.java
public void setBaseVal(int baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedBoolean.java
public void setBaseVal(boolean baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength initialize(SVGLength newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength insertItemBefore(SVGLength newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength replaceItem(SVGLength newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public SVGLength appendItem(SVGLength newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.length.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumber.java
public void setBaseVal(float baseVal) throws DOMException { try { this.baseVal = baseVal; valid = true; changing = true; element.setAttributeNS(namespaceURI, localName, String.valueOf(baseVal)); } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setUseCurrentView(boolean useCurrentView) throws DOMException { throw new UnsupportedOperationException ("SVGSVGElement.setUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setCurrentScale(float currentScale) throws DOMException { SVGContext context = getSVGContext(); AffineTransform scrnTrans = context.getScreenTransform(); float scale = 1; if (scrnTrans != null) { scale = (float)Math.sqrt(scrnTrans.getDeterminant()); } float delta = currentScale/scale; // The way currentScale, currentTranslate are defined // changing scale has no effect on translate. scrnTrans = new AffineTransform (scrnTrans.getScaleX()*delta, scrnTrans.getShearY()*delta, scrnTrans.getShearX()*delta, scrnTrans.getScaleY()*delta, scrnTrans.getTranslateX(), scrnTrans.getTranslateY()); context.setScreenTransform(scrnTrans); }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void unsuspendRedraw(int suspend_handle_id) throws DOMException { SVGSVGContext ctx = (SVGSVGContext)getSVGContext(); if (!ctx.unsuspendRedraw(suspend_handle_id)) { throw createDOMException (DOMException.NOT_FOUND_ERR, "invalid.suspend.handle", new Object[] { new Integer(suspend_handle_id) }); } }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public Event createEvent(String eventType) throws DOMException { return ((DocumentEvent)getOwnerDocument()).createEvent(eventType); }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public boolean canDispatch(String namespaceURI, String type) throws DOMException { AbstractDocument doc = (AbstractDocument) getOwnerDocument(); return doc.canDispatch(namespaceURI, type); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setGlyphRef(String glyphRef) throws DOMException { setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setFormat(String format) throws DOMException { setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setX(float x) throws DOMException { setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf(x)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setY(float y) throws DOMException { setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf(y)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setDx(float dx) throws DOMException { setAttributeNS(null, SVG_DX_ATTRIBUTE, String.valueOf(dx)); }
// in sources/org/apache/batik/dom/svg/SVGOMGlyphRefElement.java
public void setDy(float dy) throws DOMException { setAttributeNS(null, SVG_DY_ATTRIBUTE, String.valueOf(dy)); }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public static SVGPoint getPointAtLength(final SVGOMPathElement path, final float distance) { final SVGPathContext pathCtx = (SVGPathContext)path.getSVGContext(); if (pathCtx == null) return null; return new SVGPoint() { public float getX() { Point2D pt = pathCtx.getPointAtLength(distance); return (float)pt.getX(); } public float getY() { Point2D pt = pathCtx.getPointAtLength(distance); return (float)pt.getY(); } public void setX(float x) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } public void setY(float y) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } public SVGPoint matrixTransform ( SVGMatrix matrix ) { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public void setX(float x) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGPathSupport.java
public void setY(float y) throws DOMException { throw path.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAltGlyphElement.java
public void setGlyphRef(String glyphRef) throws DOMException { setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef); }
// in sources/org/apache/batik/dom/svg/SVGOMAltGlyphElement.java
public void setFormat(String format) throws DOMException { setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format); }
// in sources/org/apache/batik/dom/svg/SVGOMScriptElement.java
public void setType(String type) throws DOMException { setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform initialize(SVGTransform newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform insertItemBefore(SVGTransform newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform replaceItem(SVGTransform newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public SVGTransform appendItem(SVGTransform newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.transform.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
public void setXMLbase(String xmlbase) throws DOMException { setAttributeNS(XML_NAMESPACE_URI, XML_BASE_QNAME, xmlbase); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException(DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/dom/svg/SVGStyleSheetProcessingInstruction.java
public void setData(String data) throws DOMException { super.setData(data); styleSheet = null; }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Element createElement(String tagName) throws DOMException { return new GenericElement(tagName.intern(), this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public CDATASection createCDATASection(String data) throws DOMException { return new GenericCDATASection(data, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { if ("xml-stylesheet".equals(target)) { return new SVGStyleSheetProcessingInstruction (data, this, (StyleSheetFactory)getImplementation()); } return new GenericProcessingInstruction(target, data, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Attr createAttribute(String name) throws DOMException { return new GenericAttr(name.intern(), this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public EntityReference createEntityReference(String name) throws DOMException { return new GenericEntityReference(name, this); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI == null) { return new GenericAttr(qualifiedName.intern(), this); } else { return new GenericAttrNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { SVGDOMImplementation impl = (SVGDOMImplementation)implementation; return impl.createElementNS(this, namespaceURI, qualifiedName); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint initialize(SVGPoint newItem) throws DOMException, SVGException { return (SVGPoint) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint getItem(int index) throws DOMException { return (SVGPoint) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint insertItemBefore(SVGPoint newItem, int index) throws DOMException, SVGException { return (SVGPoint) insertItemBeforeImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint replaceItem(SVGPoint newItem, int index) throws DOMException, SVGException { return (SVGPoint) replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint removeItem(int index) throws DOMException { return (SVGPoint) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public SVGPoint appendItem(SVGPoint newItem) throws DOMException, SVGException { return (SVGPoint) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getPoints().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint initialize(SVGPoint newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint insertItemBefore(SVGPoint newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint replaceItem(SVGPoint newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public SVGPoint appendItem(SVGPoint newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.point.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getPathSegList().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg initialize(SVGPathSeg newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg insertItemBefore(SVGPathSeg newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg replaceItem(SVGPathSeg newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSeg appendItem(SVGPathSeg newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.pathseg.list", null); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform initialize(SVGTransform newItem) throws DOMException, SVGException { return (SVGTransform) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform getItem(int index) throws DOMException { return (SVGTransform) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform insertItemBefore(SVGTransform newItem, int index) throws DOMException, SVGException { return (SVGTransform) insertItemBeforeImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform replaceItem(SVGTransform newItem, int index) throws DOMException, SVGException { return (SVGTransform) replaceItemImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform removeItem(int index) throws DOMException { return (SVGTransform) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public SVGTransform appendItem(SVGTransform newItem) throws DOMException, SVGException { return (SVGTransform) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
protected SVGMatrix createMatrix() { return new AbstractSVGMatrix() { protected AffineTransform getAffineTransform() { return SVGTransformItem.this.affineTransform; } public void setA(float a) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setA(a); SVGTransformItem.this.resetAttribute(); } public void setB(float b) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setB(b); SVGTransformItem.this.resetAttribute(); } public void setC(float c) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setC(c); SVGTransformItem.this.resetAttribute(); } public void setD(float d) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setD(d); SVGTransformItem.this.resetAttribute(); } public void setE(float e) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setE(e); SVGTransformItem.this.resetAttribute(); } public void setF(float f) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setF(f); SVGTransformItem.this.resetAttribute(); } }; }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setA(float a) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setA(a); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setB(float b) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setB(b); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setC(float c) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setC(c); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setD(float d) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setD(d); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setE(float e) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setE(e); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void setF(float f) throws DOMException { SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX; super.setF(f); SVGTransformItem.this.resetAttribute(); }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setX(float x) throws DOMException { this.x = x; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setY(float y) throws DOMException { this.y = y; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setWidth(float width) throws DOMException { this.w = width; }
// in sources/org/apache/batik/dom/svg/SVGOMRect.java
public void setHeight(float height) throws DOMException { this.h = height; }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public static SVGRect getBBox(Element elt) { final SVGOMElement svgelt = (SVGOMElement)elt; SVGContext svgctx = svgelt.getSVGContext(); if (svgctx == null) return null; if (svgctx.getBBox() == null) return null; return new SVGRect() { public float getX() { return (float)svgelt.getSVGContext().getBBox().getX(); } public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getY() { return (float)svgelt.getSVGContext().getBBox().getY(); } public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getWidth() { return (float)svgelt.getSVGContext().getBBox().getWidth(); } public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getHeight() { return (float)svgelt.getSVGContext().getBBox().getHeight(); } public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } }; }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setX(float x) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setY(float y) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setWidth(float width) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
public void setHeight(float height) throws DOMException { throw svgelt.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedString.java
public void setBaseVal(String baseVal) throws DOMException { element.setAttributeNS(namespaceURI, localName, baseVal); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber getItem(int index) throws DOMException { if (hasAnimVal) { return super.getItem(index); } return getBaseVal().getItem(index); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public void clear() throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException, SVGException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber removeItem(int index) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public SVGNumber appendItem(SVGNumber newItem) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.number.list", null); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public float getSubStringLength(int charnum, int nchars) throws DOMException { return SVGTextContentSupport.getSubStringLength(this, charnum, nchars); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGPoint getStartPositionOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getStartPositionOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGPoint getEndPositionOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getEndPositionOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public SVGRect getExtentOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getExtentOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public float getRotationOfChar(int charnum) throws DOMException { return SVGTextContentSupport.getRotationOfChar(this, charnum); }
// in sources/org/apache/batik/dom/svg/SVGOMTextContentElement.java
public void selectSubString(int charnum, int nchars) throws DOMException { SVGTextContentSupport.selectSubString(this, charnum, nchars); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
protected SVGMatrix createMatrix() { return new AbstractSVGMatrix() { protected AffineTransform getAffineTransform() { return SVGOMTransform.this.affineTransform; } public void setA(float a) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setA(a); } public void setB(float b) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setB(b); } public void setC(float c) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setC(c); } public void setD(float d) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setD(d); } public void setE(float e) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setE(e); } public void setF(float f) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setF(f); } }; }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setA(float a) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setA(a); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setB(float b) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setB(b); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setC(float c) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setC(c); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setD(float d) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setD(d); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setE(float e) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setE(e); }
// in sources/org/apache/batik/dom/svg/SVGOMTransform.java
public void setF(float f) throws DOMException { SVGOMTransform.this.setType(SVG_TRANSFORM_MATRIX); super.setF(f); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
protected void setAttributeValue(String value) throws DOMException { try { changing = true; element.setAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, value); malformed = false; } finally { changing = false; } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
protected void setAttributeValue(String value) throws DOMException { }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { Document result = new SVGOMDocument(doctype, this); // BUG 32108: return empty document if qualifiedName is null. if (qualifiedName != null) result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); return result; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValue(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValueInSpecifiedUnits(float value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setValueAsString(String value) throws DOMException { throw element.createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.angle", null); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public void setBaseVal(short baseVal) throws DOMException { if (baseVal == SVGMarkerElement.SVG_MARKER_ORIENT_AUTO) { baseEnumerationVal = baseVal; if (baseAngleVal == null) { baseAngleVal = new BaseSVGAngle(); } baseAngleVal.unitType = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; baseAngleVal.value = 0; baseAngleVal.reset(); } else if (baseVal == SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE) { baseEnumerationVal = baseVal; if (baseAngleVal == null) { baseAngleVal = new BaseSVGAngle(); } baseAngleVal.reset(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength initialize(SVGLength newItem) throws DOMException, SVGException { return (SVGLength) initializeImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength getItem(int index) throws DOMException { return (SVGLength) getItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength insertItemBefore(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) insertItemBeforeImpl(newItem, index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength replaceItem(SVGLength newItem, int index) throws DOMException, SVGException { return (SVGLength) replaceItemImpl(newItem,index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength removeItem(int index) throws DOMException { return (SVGLength) removeItemImpl(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public SVGLength appendItem(SVGLength newItem) throws DOMException, SVGException { return (SVGLength) appendItemImpl(newItem); }
// in sources/org/apache/batik/dom/svg/AbstractElement.java
public Node removeNamedItemNS( String namespaceURI, String localName ) throws DOMException { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( localName == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{""} ); } AbstractAttr n = (AbstractAttr)remove( namespaceURI, localName ); if ( n == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{localName} ); } n.setOwnerElement( null ); String prefix = n.getPrefix(); // Reset the attribute to its default value if ( !resetAttribute( namespaceURI, prefix, localName ) ) { // Mutation event fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); } return n; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
public void clear() throws DOMException { revalidate(); if (itemList != null) { // Remove all the items. clear(itemList); // Set the DOM attribute. resetAttribute(); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem initializeImpl(Object newItem) throws DOMException, SVGException { checkItemType(newItem); // Clear the list, creating it if it doesn't exist yet. if (itemList == null) { itemList = new ArrayList(1); } else { clear(itemList); } SVGItem item = removeIfNeeded(newItem); // Add the item. itemList.add(item); // Set the item's parent. item.setParent(this); // Update the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem getItemImpl(int index) throws DOMException { revalidate(); if (index < 0 || itemList == null || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } return (SVGItem)itemList.get(index); }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem insertItemBeforeImpl(Object newItem, int index) throws DOMException, SVGException { checkItemType(newItem); revalidate(); if (index < 0) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } if (index > itemList.size()) { index = itemList.size(); } SVGItem item = removeIfNeeded(newItem); // Insert the item at its position. itemList.add(index, item); // Set the item's parent. item.setParent(this); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem replaceItemImpl(Object newItem, int index) throws DOMException, SVGException { checkItemType(newItem); revalidate(); if (index < 0 || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } SVGItem item = removeIfNeeded(newItem); // Replace the item in the list. itemList.set(index, item); // Set the item's parent. item.setParent(this); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem removeItemImpl(int index) throws DOMException { revalidate(); if (index < 0 || index >= itemList.size()) { throw createDOMException (DOMException.INDEX_SIZE_ERR, "index.out.of.bounds", new Object[] { new Integer(index) } ); } SVGItem item = (SVGItem)itemList.remove(index); // Set the item to have no parent list. item.setParent(null); // Reset the DOM attribute. resetAttribute(); return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected SVGItem appendItemImpl(Object newItem) throws DOMException, SVGException { checkItemType(newItem); revalidate(); SVGItem item = removeIfNeeded(newItem); itemList.add(item); // Set the item's parent. item.setParent(this); if (itemList.size() <= 1) { resetAttribute(); } else { resetAttribute(item); } return item; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
protected void setValueAsString(List value) throws DOMException { String finalValue = null; Iterator it = value.iterator(); if (it.hasNext()) { SVGItem item = (SVGItem) it.next(); StringBuffer buf = new StringBuffer( value.size() * 8 ); buf.append( item.getValueAsString() ); while (it.hasNext()) { item = (SVGItem) it.next(); buf.append(getItemSeparator()); buf.append(item.getValueAsString()); } finalValue = buf.toString(); } setAttributeValue(finalValue); valid = true; }
// in sources/org/apache/batik/dom/svg/SVGOMPoint.java
public void setX(float x) throws DOMException { this.x = x; }
// in sources/org/apache/batik/dom/svg/SVGOMPoint.java
public void setY(float y) throws DOMException { this.y = y; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node insertBefore(Node newChild, Node refChild) throws DOMException { if ((refChild != null) && ((childNodes == null) || (refChild.getParentNode() != this))) throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(refChild.getNodeType()), refChild.getNodeName() }); checkAndRemove(newChild, false); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getFirstChild(); while (n != null) { Node ns = n.getNextSibling(); insertBefore(n, refChild); n = ns; } return newChild; } else { // Node modification if (childNodes == null) { childNodes = new ChildNodes(); } ExtendedNode n = childNodes.insert((ExtendedNode)newChild, (ExtendedNode)refChild); n.setParentNode(this); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; } }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if ((childNodes == null) || (oldChild.getParentNode() != this) ) throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(oldChild.getNodeType()), oldChild.getNodeName() }); checkAndRemove(newChild, true); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getLastChild(); if (n == null) return newChild; Node ps = n.getPreviousSibling(); replaceChild(n, oldChild); Node ns = n; n = ps; while (n != null) { ps = n.getPreviousSibling(); insertBefore(n, ns); ns = n; n = ps; } return newChild; } // Mutation event fireDOMNodeRemovedEvent(oldChild); getCurrentDocument().nodeToBeRemoved(oldChild); nodeToBeRemoved(oldChild); // Node modification ExtendedNode n = (ExtendedNode)newChild; ExtendedNode o = childNodes.replace(n, (ExtendedNode)oldChild); n.setParentNode(this); o.setParentNode(null); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node removeChild(Node oldChild) throws DOMException { if (childNodes == null || oldChild.getParentNode() != this) { throw createDOMException (DOMException.NOT_FOUND_ERR, "child.missing", new Object[] { new Integer(oldChild.getNodeType()), oldChild.getNodeName() }); } if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } // Mutation event fireDOMNodeRemovedEvent(oldChild); getCurrentDocument().nodeToBeRemoved(oldChild); nodeToBeRemoved(oldChild); // Node modification ExtendedNode result = childNodes.remove((ExtendedNode)oldChild); result.setParentNode(null); // Mutation event fireDOMSubtreeModifiedEvent(); return result; }
// in sources/org/apache/batik/dom/AbstractParentNode.java
public Node appendChild(Node newChild) throws DOMException { checkAndRemove(newChild, false); if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) { Node n = newChild.getFirstChild(); while (n != null) { Node ns = n.getNextSibling(); appendChild(n); n = ns; } return newChild; } else { if (childNodes == null) childNodes = new ChildNodes(); // Node modification ExtendedNode n = childNodes.append((ExtendedNode)newChild); n.setParentNode(this); nodeAdded(n); // Mutation event fireDOMNodeInsertedEvent(n); fireDOMSubtreeModifiedEvent(); return n; } }
// in sources/org/apache/batik/dom/traversal/TraversalSupport.java
public NodeIterator createNodeIterator(AbstractDocument doc, Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException { if (root == null) { throw doc.createDOMException (DOMException.NOT_SUPPORTED_ERR, "null.root", null); } NodeIterator result = new DOMNodeIterator(doc, root, whatToShow, filter, entityReferenceExpansion); if (iterators == null) { iterators = new LinkedList(); } iterators.add(result); return result; }
// in sources/org/apache/batik/dom/events/DocumentEventSupport.java
public Event createEvent(String eventType) throws DOMException { EventFactory ef = (EventFactory)eventFactories.get(eventType.toLowerCase()); if (ef == null) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Bad event type: " + eventType); } return ef.createEvent(); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Element createElement(String tagName) throws DOMException { return new GenericElement(tagName.intern(), this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public CDATASection createCDATASection(String data) throws DOMException { return new GenericCDATASection(data, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { return new GenericProcessingInstruction(target, data, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Attr createAttribute(String name) throws DOMException { return new GenericAttr(name.intern(), this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public EntityReference createEntityReference(String name) throws DOMException { return new GenericEntityReference(name, this); }
// in sources/org/apache/batik/dom/GenericDocument.java
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (namespaceURI == null) { return new GenericElement(qualifiedName.intern(), this); } else { return new GenericElementNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/GenericDocument.java
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (namespaceURI == null) { return new GenericAttr(qualifiedName.intern(), this); } else { return new GenericAttrNS(namespaceURI.intern(), qualifiedName.intern(), this); } }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String getNodeValue() throws DOMException { return nodeValue; }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } // Node modification String val = this.nodeValue; this.nodeValue = (nodeValue == null) ? "" : nodeValue; // Mutation event fireDOMCharacterDataModifiedEvent(val, this.nodeValue); if (getParentNode() != null) { ((AbstractParentNode)getParentNode()). fireDOMSubtreeModifiedEvent(); } }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String getData() throws DOMException { return getNodeValue(); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void setData(String data) throws DOMException { setNodeValue(data); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public String substringData(int offset, int count) throws DOMException { checkOffsetCount(offset, count); String v = getNodeValue(); return v.substring(offset, Math.min(v.length(), offset + count)); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void appendData(String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } setNodeValue(getNodeValue() + ((arg == null) ? "" : arg)); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void insertData(int offset, String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (offset < 0 || offset > getLength()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } String v = getNodeValue(); setNodeValue(v.substring(0, offset) + arg + v.substring(offset, v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void deleteData(int offset, int count) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } checkOffsetCount(offset, count); String v = getNodeValue(); setNodeValue(v.substring(0, offset) + v.substring(Math.min(v.length(), offset + count), v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
public void replaceData(int offset, int count, String arg) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } checkOffsetCount(offset, count); String v = getNodeValue(); setNodeValue(v.substring(0, offset) + arg + v.substring(Math.min(v.length(), offset + count), v.length())); }
// in sources/org/apache/batik/dom/AbstractCharacterData.java
protected void checkOffsetCount(int offset, int count) throws DOMException { if (offset < 0 || offset >= getLength()) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "offset", new Object[] { new Integer(offset) }); } if (count < 0) { throw createDOMException(DOMException.INDEX_SIZE_ERR, "negative.count", new Object[] { new Integer(count) }); } }
// in sources/org/apache/batik/dom/StyleSheetProcessingInstruction.java
public void setData(String data) throws DOMException { super.setData(data); sheet = null; pseudoAttributes = null; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setAttribute(String name, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } Attr attr = getAttributeNode(name); if (attr == null) { attr = getOwnerDocument().createAttribute(name); attr.setValue(value); attributes.setNamedItem(attr); } else { attr.setValue(value); } }
// in sources/org/apache/batik/dom/AbstractElement.java
public void removeAttribute(String name) throws DOMException { if (!hasAttribute(name)) { return; } attributes.removeNamedItem(name); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr setAttributeNode(Attr newAttr) throws DOMException { if (newAttr == null) { return null; } if (attributes == null) { attributes = createAttributes(); } return (Attr)attributes.setNamedItemNS(newAttr); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } if (attributes == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { oldAttr.getName() }); } String nsURI = oldAttr.getNamespaceURI(); return (Attr)attributes.removeNamedItemNS(nsURI, (nsURI==null ? oldAttr.getNodeName() : oldAttr.getLocalName())); }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName); if (attr == null) { attr = getOwnerDocument().createAttributeNS(namespaceURI, qualifiedName); attr.setValue(value); attributes.setNamedItemNS(attr); } else { attr.setValue(value); } }
// in sources/org/apache/batik/dom/AbstractElement.java
public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } if (!hasAttributeNS(namespaceURI, localName)) { return; } attributes.removeNamedItemNS(namespaceURI, localName); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { if (newAttr == null) { return null; } if (attributes == null) { attributes = createAttributes(); } return (Attr)attributes.setNamedItemNS(newAttr); }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttribute(String name, boolean isId) throws DOMException { AbstractAttr a = (AbstractAttr) getAttributeNode(name); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { name }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { name }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttributeNS( String ns, String ln, boolean isId ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } AbstractAttr a = (AbstractAttr)getAttributeNodeNS( ns, ln ); if (a == null) { throw createDOMException(DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[] { ns, ln }); } if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public void setIdAttributeNode( Attr attr, boolean isId ) throws DOMException { AbstractAttr a = (AbstractAttr)attr; if (a.isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { a.getNodeName() }); } a.isIdAttr = isId; }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItem( Node arg ) throws DOMException { if ( arg == null ) { return null; } checkNode( arg ); return setNamedItem( null, arg.getNodeName(), arg ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node removeNamedItem( String name ) throws DOMException { return removeNamedItemNS( null, name ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItemNS( Node arg ) throws DOMException { if ( arg == null ) { return null; } String nsURI = arg.getNamespaceURI(); return setNamedItem( nsURI, ( nsURI == null ) ? arg.getNodeName() : arg.getLocalName(), arg ); }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node removeNamedItemNS( String namespaceURI, String localName ) throws DOMException { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( localName == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{""} ); } if ( namespaceURI != null && namespaceURI.length() == 0 ) { namespaceURI = null; } AbstractAttr n = (AbstractAttr)remove( namespaceURI, localName ); if ( n == null ) { throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{localName} ); } n.setOwnerElement( null ); // Mutation event fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n; }
// in sources/org/apache/batik/dom/AbstractElement.java
public Node setNamedItem( String ns, String name, Node arg ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } ( (AbstractAttr)arg ).setOwnerElement( AbstractElement.this ); AbstractAttr result = (AbstractAttr)put( ns, name, arg ); if ( result != null ) { result.setOwnerElement( null ); fireDOMAttrModifiedEvent( name, result, result.getNodeValue(), "", MutationEvent.REMOVAL ); } fireDOMAttrModifiedEvent( name, (Attr)arg, "", arg.getNodeValue(), MutationEvent.ADDITION ); return result; }
// in sources/org/apache/batik/extension/PrefixableStylableExtensionElement.java
public void setPrefix(String prefix) throws DOMException { if (isReadonly()) { throw createDOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } if (prefix != null && !prefix.equals("") && !DOMUtilities.isValidName(prefix)) { throw createDOMException (DOMException.INVALID_CHARACTER_ERR, "prefix", new Object[] { new Integer(getNodeType()), getNodeName(), prefix }); } this.prefix = prefix; }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean beginElement() throws DOMException { timedElement.beginElement(); return timedElement.canBegin(); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean beginElementAt(float offset) throws DOMException { timedElement.beginElement(offset); // XXX Not right, but who knows if it is possible to begin // at some arbitrary point in the future. return true; }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean endElement() throws DOMException { timedElement.endElement(); return timedElement.canEnd(); }
// in sources/org/apache/batik/bridge/SVGAnimationElementBridge.java
public boolean endElementAt(float offset) throws DOMException { timedElement.endElement(offset); // XXX Not right, but who knows if it is possible to begin // at some arbitrary point in the future. return true; }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + text + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + text + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + text + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void redFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().getGreen().getCssText() + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getGreen().getCssText() + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getGreen().getCssText() + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + text + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + text + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + text + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(0).getBlue().getCssText() + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + getValue().item(1).getBlue().getCssText() + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueTextChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + text + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + text + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ")"; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + text + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { String text; switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: text = "rgb(" + getValue().getRed().getCssText() + ", " + getValue().getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text = "rgb(" + getValue().item(0).getRed().getCssText() + ", " + getValue().item(0).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0) + " rgb(" + getValue().item(1).getRed().getCssText() + ", " + getValue().item(1).getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ") " + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorChanged(String text) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR: break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; case SVG_PAINTTYPE_URI_RGBCOLOR: text = getValue().item(0).getCssText() + ' ' + text; break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: text = getValue().item(0).getCssText() + ' ' + text + ' ' + getValue().item(2).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: textChanged(getValue().item(0).getCssText() + ' ' + rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_PAINTTYPE_CURRENTCOLOR: textChanged("currentcolor"); break; case SVG_PAINTTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorProfileChanged(String cp) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); sb.append(cp); iccc = (ICCColor)getValue().item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsCleared() throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorsInitialized(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorInsertedBefore(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorReplaced(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorRemoved(int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void colorAppend(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(" icc-color("); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.floatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public float getFloatValue(short unitType) throws DOMException { return convertFloatValue(unitType, valueProvider.getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.stringValueChanged(stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { return this; }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void floatValueChanged(short unit, float value) throws DOMException { textChanged(FloatValue.getCssText(unit, value)); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void stringValueChanged(short type, String value) throws DOMException { textChanged(StringValue.getCssText(type, value)); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void leftTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + text + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void leftFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void topTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + text + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void topFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + FloatValue.getCssText(unit, value) + ", " + val.getRight().getCssText() + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void rightTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + text + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void rightFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getBottom().getCssText() + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void bottomTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + text + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void bottomFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rect(" + val.getTop().getCssText() + ", " + val.getRight().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getLeft().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void redTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + text + ", " + val.getGreen().getCssText() + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void redFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + FloatValue.getCssText(unit, value) + ", " + val.getGreen().getCssText() + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void greenTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + val.getRed().getCssText() + ", " + text + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void greenFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + val.getRed().getCssText() + ", " + FloatValue.getCssText(unit, value) + ", " + val.getBlue().getCssText() + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void blueTextChanged(String text) throws DOMException { final Value val = getValue(); text = "rgb(" + val.getRed().getCssText() + ", " + val.getGreen().getCssText() + ", " + text + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void blueFloatValueChanged(short unit, float value) throws DOMException { final Value val = getValue(); String text = "rgb(" + val.getRed().getCssText() + ", " + val.getGreen().getCssText() + ", " + FloatValue.getCssText(unit, value) + ')'; textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listTextChanged(int idx, String text) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(text); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } text = sb.toString(); textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listFloatValueChanged(int idx, short unit, float value) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(FloatValue.getCssText(unit, value)); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void listStringValueChanged(int idx, short unit, String value) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(StringValue.getCssText(unit, value)); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public float getFloatValue(short unitType) throws DOMException { return convertFloatValue(unitType, getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.leftFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.topFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.rightFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listTextChanged(index, cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listFloatValueChanged(index, unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMValue.java
public void setStringValue(short stringType, String stringValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.listStringValueChanged(index, stringType, stringValue); } }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setCssText(String cssText) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public String removeProperty(String propertyName) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMComputedStyle.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { values = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public String removeProperty(String propertyName) throws DOMException { String result = getPropertyValue(propertyName); if (result.length() > 0) { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (values != null) { values.remove(propertyName); } handler.propertyRemoved(propertyName); } } return result; }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void setProperty(String propertyName, String value, String prio) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.propertyChanged(propertyName, value, prio); } }
// in sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (values == null || values.get(this) == null || StyleDeclarationValue.this.handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.textChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setColorProfile(String colorProfile) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { handler.colorProfileChanged(colorProfile); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void clear() throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { iccColors = null; handler.colorsCleared(); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber initialize(SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { float f = newItem.getValue(); iccColors = new ArrayList(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorsInitialized(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber getItem(int index) throws DOMException { if (getColorType() != SVG_COLORTYPE_RGBCOLOR_ICCCOLOR) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } Value value = valueProvider.getValue().item(1); float f = ((ICCColor)value).getColor(index); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); return result; }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber insertItemBefore(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index > n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(index, result); handler.colorInsertedBefore(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber replaceItem(SVGNumber newItem, int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } if (iccColors == null) { iccColors = new ArrayList(n); for (int i = iccColors.size(); i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.set(index, result); handler.colorReplaced(f, index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber removeItem(int index) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { int n = getNumberOfItems(); if (index < 0 || index >= n) { throw new DOMException(DOMException.INDEX_SIZE_ERR, ""); } SVGNumber result = null; if (iccColors != null) { result = (ColorNumber)iccColors.get(index); } if (result == null) { Value value = valueProvider.getValue().item(1); result = new ColorNumber(((ICCColor)value).getColor(index)); } handler.colorRemoved(index); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public SVGNumber appendItem (SVGNumber newItem) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { if (iccColors == null) { int n = getNumberOfItems(); iccColors = new ArrayList(n); for (int i = 0; i < n; i++) { iccColors.add(null); } } float f = newItem.getValue(); SVGNumber result = new ColorNumber(f); iccColors.add(result); handler.colorAppend(f); return result; } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append( value.getGreen().getCssText()); sb.append(','); sb.append( value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(text); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void redFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(text); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void greenFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.getBlue().getCssText()); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(','); sb.append(value.item(0).getBlue().getCssText()); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueTextChanged(String text) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(text); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void blueFloatValueChanged(short unit, float fValue) throws DOMException { StringBuffer sb = new StringBuffer(40); Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: sb.append("rgb("); sb.append(value.getRed().getCssText()); sb.append(','); sb.append(value.getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: sb.append("rgb("); sb.append(value.item(0).getRed().getCssText()); sb.append(','); sb.append(value.item(0).getGreen().getCssText()); sb.append(','); sb.append(FloatValue.getCssText(unit, fValue)); sb.append(')'); sb.append(value.item(1).getCssText()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(sb.toString()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorChanged(String text) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR: break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: text += getValue().item(1).getCssText(); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } textChanged(text); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void rgbColorICCColorChanged(String rgb, String icc) throws DOMException { switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorChanged(short type, String rgb, String icc) throws DOMException { switch (type) { case SVG_COLORTYPE_CURRENTCOLOR: textChanged(CSSConstants.CSS_CURRENTCOLOR_VALUE); break; case SVG_COLORTYPE_RGBCOLOR: textChanged(rgb); break; case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: textChanged(rgb + ' ' + icc); break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorProfileChanged(String cp) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); sb.append(cp); ICCColor iccc = (ICCColor)value.item(1); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsCleared() throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorsInitialized(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorInsertedBefore(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorReplaced(float f, int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorRemoved(int idx) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append(','); sb.append(iccc.getColor(i)); } for (int i = idx + 1; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void colorAppend(float f) throws DOMException { Value value = getValue(); switch (getColorType()) { case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer( value.item(0).getCssText()); sb.append(" icc-color("); ICCColor iccc = (ICCColor)value.item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < iccc.getLength(); i++) { sb.append(','); sb.append(iccc.getColor(i)); } sb.append(','); sb.append(f); sb.append(')'); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public float getFloatValue(short unitType) throws DOMException { return CSSOMValue.convertFloatValue(unitType, getValue()); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public String getStringValue() throws DOMException { return valueProvider.getValue().getStringValue(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Counter getCounterValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public Rect getRectValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public RGBColor getRGBColorValue() throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setStringValue(short stringType, String stringValue) throws DOMException { throw new DOMException(DOMException.INVALID_ACCESS_ERR, ""); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.redFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.greenFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setCssText(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueTextChanged(cssText); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public void setFloatValue(short unitType, float floatValue) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.blueFloatValueChanged(unitType, floatValue); } }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/dom/CSSOMSVGStyleDeclaration.java
public void textChanged(String text) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } String prio = getPropertyPriority(property); CSSOMSVGStyleDeclaration.this. handler.propertyChanged(property, text, prio); }
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValueManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/svg12/MarginShorthandManager.java
public void setValues(CSSEngine eng, ShorthandManager.PropertyHandler ph, LexicalUnit lu, boolean imp) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) return; LexicalUnit []lus = new LexicalUnit[4]; int cnt=0; while (lu != null) { if (cnt == 4) throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); lus[cnt++] = lu; lu = lu.getNextLexicalUnit(); } switch (cnt) { case 1: lus[3] = lus[2] = lus[1] = lus[0]; break; case 2: lus[2] = lus[0]; lus[3] = lus[1]; break; case 3: lus[3] = lus[1]; break; default: } ph.property(SVG12CSSConstants.CSS_MARGIN_TOP_PROPERTY, lus[0], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_RIGHT_PROPERTY, lus[1], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_BOTTOM_PROPERTY, lus[2], imp); ph.property(SVG12CSSConstants.CSS_MARGIN_LEFT_PROPERTY, lus[3], imp); }
// in sources/org/apache/batik/css/engine/value/svg12/LineHeightManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVG12ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: { String s = lu.getStringValue().toLowerCase(); if (SVG12CSSConstants.CSS_NORMAL_VALUE.equals(s)) return SVG12ValueConstants.NORMAL_VALUE; throw createInvalidIdentifierDOMException(lu.getStringValue()); } default: return super.createValue(lu, engine); } }
// in sources/org/apache/batik/css/engine/value/svg12/MarginLengthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/LengthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_EM: return new FloatValue(CSSPrimitiveValue.CSS_EMS, lu.getFloatValue()); case LexicalUnit.SAC_EX: return new FloatValue(CSSPrimitiveValue.CSS_EXS, lu.getFloatValue()); case LexicalUnit.SAC_PIXEL: return new FloatValue(CSSPrimitiveValue.CSS_PX, lu.getFloatValue()); case LexicalUnit.SAC_CENTIMETER: return new FloatValue(CSSPrimitiveValue.CSS_CM, lu.getFloatValue()); case LexicalUnit.SAC_MILLIMETER: return new FloatValue(CSSPrimitiveValue.CSS_MM, lu.getFloatValue()); case LexicalUnit.SAC_INCH: return new FloatValue(CSSPrimitiveValue.CSS_IN, lu.getFloatValue()); case LexicalUnit.SAC_POINT: return new FloatValue(CSSPrimitiveValue.CSS_PT, lu.getFloatValue()); case LexicalUnit.SAC_PICA: return new FloatValue(CSSPrimitiveValue.CSS_PC, lu.getFloatValue()); case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/LengthManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_PERCENTAGE: case CSSPrimitiveValue.CSS_EMS: case CSSPrimitiveValue.CSS_EXS: case CSSPrimitiveValue.CSS_PX: case CSSPrimitiveValue.CSS_CM: case CSSPrimitiveValue.CSS_MM: case CSSPrimitiveValue.CSS_IN: case CSSPrimitiveValue.CSS_PT: case CSSPrimitiveValue.CSS_PC: case CSSPrimitiveValue.CSS_NUMBER: return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getTop() throws DOMException { return top; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getRight() throws DOMException { return right; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getBottom() throws DOMException { return bottom; }
// in sources/org/apache/batik/css/engine/value/RectValue.java
public Value getLeft() throws DOMException { return left; }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeAdjustManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return InheritValue.INSTANCE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return ValueConstants.AUTO_VALUE; } } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/ClipManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (!value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { throw createInvalidIdentifierDOMException(value); } return ValueConstants.AUTO_VALUE; }
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } ListValue lv = new ListValue(' '); do { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { String s = lu.getStringValue().toLowerCase().intern(); Object obj = values.get(s); if (obj == null) { throw createInvalidIdentifierDOMException (lu.getStringValue()); } lv.append((Value)obj); lu = lu.getNextLexicalUnit(); } else { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } } while (lu != null); return lv; } throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/css2/TextDecorationManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (!value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { throw createInvalidIdentifierDOMException(value); } return ValueConstants.NONE_VALUE; }
// in sources/org/apache/batik/css/engine/value/css2/FontFamilyManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: case LexicalUnit.SAC_STRING_VALUE: } ListValue result = new ListValue(); for (;;) { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_STRING_VALUE: result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, lu.getStringValue())); lu = lu.getNextLexicalUnit(); break; case LexicalUnit.SAC_IDENT: StringBuffer sb = new StringBuffer(lu.getStringValue()); lu = lu.getNextLexicalUnit(); if (lu != null && isIdentOrNumber(lu)) { do { sb.append(' '); switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: sb.append(lu.getStringValue()); break; case LexicalUnit.SAC_INTEGER: //Some font names contain integer values but are not quoted! //Example: "Univers 45 Light" sb.append(Integer.toString(lu.getIntegerValue())); } lu = lu.getNextLexicalUnit(); } while (lu != null && isIdentOrNumber(lu)); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); Value v = (Value)values.get(s); result.append((v != null) ? v : new StringValue (CSSPrimitiveValue.CSS_STRING, id)); } } if (lu == null) return result; if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); lu = lu.getNextLexicalUnit(); if (lu == null) throw createMalformedLexicalUnitDOMException(); } }
// in sources/org/apache/batik/css/engine/value/css2/SrcManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: case LexicalUnit.SAC_STRING_VALUE: case LexicalUnit.SAC_URI: } ListValue result = new ListValue(); for (;;) { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_STRING_VALUE: result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, lu.getStringValue())); lu = lu.getNextLexicalUnit(); break; case LexicalUnit.SAC_URI: String uri = resolveURI(engine.getCSSBaseURI(), lu.getStringValue()); result.append(new URIValue(lu.getStringValue(), uri)); lu = lu.getNextLexicalUnit(); if ((lu != null) && (lu.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION)) { if (!lu.getFunctionName().equalsIgnoreCase("format")) { break; } // Format really does us no good so just ignore it. // TODO: Should probably turn this into a ListValue // and append the format function CSS Value. lu = lu.getNextLexicalUnit(); } break; case LexicalUnit.SAC_IDENT: StringBuffer sb = new StringBuffer(lu.getStringValue()); lu = lu.getNextLexicalUnit(); if (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { do { sb.append(' '); sb.append(lu.getStringValue()); lu = lu.getNextLexicalUnit(); } while (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); Value v = (Value)values.get(s); result.append((v != null) ? v : new StringValue (CSSPrimitiveValue.CSS_STRING, id)); } break; } if (lu == null) { return result; } if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } } }
// in sources/org/apache/batik/css/engine/value/css2/CursorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { ListValue result = new ListValue(); switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: do { result.append(new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue()))); lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createMalformedLexicalUnitDOMException(); } } while (lu.getLexicalUnitType() == LexicalUnit.SAC_URI); if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } // Fall through... case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } result.append((Value)v); lu = lu.getNextLexicalUnit(); } if (lu != null) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } return result; }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s); } return (Value)v; default: break; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INTEGER) { int i = lu.getIntegerValue(); switch (i) { case 100: return ValueConstants.NUMBER_100; case 200: return ValueConstants.NUMBER_200; case 300: return ValueConstants.NUMBER_300; case 400: return ValueConstants.NUMBER_400; case 500: return ValueConstants.NUMBER_500; case 600: return ValueConstants.NUMBER_600; case 700: return ValueConstants.NUMBER_700; case 800: return ValueConstants.NUMBER_800; case 900: return ValueConstants.NUMBER_900; } throw createInvalidFloatValueDOMException(i); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/css2/FontWeightManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { int i = (int)floatValue; if (floatValue == i) { switch (i) { case 100: return ValueConstants.NUMBER_100; case 200: return ValueConstants.NUMBER_200; case 300: return ValueConstants.NUMBER_300; case 400: return ValueConstants.NUMBER_400; case 500: return ValueConstants.NUMBER_500; case 600: return ValueConstants.NUMBER_600; case 700: return ValueConstants.NUMBER_700; case 800: return ValueConstants.NUMBER_800; case 900: return ValueConstants.NUMBER_900; } } } throw createInvalidFloatValueDOMException(floatValue); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR) { lu = lu.getParameters(); Value red = createColorComponent(lu); lu = lu.getNextLexicalUnit().getNextLexicalUnit(); Value green = createColorComponent(lu); lu = lu.getNextLexicalUnit().getNextLexicalUnit(); Value blue = createColorComponent(lu); return createRGBColor(red, green, blue); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
protected Value createColorComponent(LexicalUnit lu) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createInvalidRGBComponentUnitDOMException (lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getRed() throws DOMException { return red; }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getGreen() throws DOMException { return green; }
// in sources/org/apache/batik/css/engine/value/RGBColorValue.java
public Value getBlue() throws DOMException { return blue; }
// in sources/org/apache/batik/css/engine/value/StringValue.java
public String getStringValue() throws DOMException { return value; }
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } }
// in sources/org/apache/batik/css/engine/value/svg/StrokeMiterlimitManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { if (unitType == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(unitType, floatValue); } throw createInvalidFloatTypeDOMException(unitType); }
// in sources/org/apache/batik/css/engine/value/svg/StrokeWidthManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/KerningManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/OpacityManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { if (type == CSSPrimitiveValue.CSS_NUMBER) { return new FloatValue(type, floatValue); } throw createInvalidFloatTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); default: ListValue lv = new ListValue(' '); do { Value v = super.createValue(lu, engine); lv.append(v); lu = lu.getNextLexicalUnit(); if (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA) { lu = lu.getNextLexicalUnit(); } } while (lu != null); return lv; } }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDasharrayManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); case LexicalUnit.SAC_IDENT: String id = lu.getStringValue().toLowerCase().intern(); if (id == CSSConstants.CSS_ACCUMULATE_VALUE) { return SVGValueConstants.ACCUMULATE_VALUE; } if (id != CSSConstants.CSS_NEW_VALUE) { throw createInvalidIdentifierDOMException(id); } ListValue result = new ListValue(' '); result.append(SVGValueConstants.NEW_VALUE); lu = lu.getNextLexicalUnit(); if (lu == null) { return result; } result.append(super.createValue(lu, engine)); for (int i = 1; i < 4; i++) { lu = lu.getNextLexicalUnit(); if (lu == null){ throw createMalformedLexicalUnitDOMException(); } result.append(super.createValue(lu, engine)); } return result; } }
// in sources/org/apache/batik/css/engine/value/svg/EnableBackgroundManager.java
public Value createFloatValue(short unitType, float floatValue) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationVerticalManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/FilterManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type == CSSPrimitiveValue.CSS_IDENT) { if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } throw createInvalidIdentifierDOMException(value); } if (type == CSSPrimitiveValue.CSS_URI) { return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/MarkerManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: Object v = values.get(lu.getStringValue().toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } return (Value)v; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/BaselineShiftManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/value/svg/SVGColorManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_CURRENTCOLOR_VALUE)) { return SVGValueConstants.CURRENTCOLOR_VALUE; } } Value v = super.createValue(lu, engine); lu = lu.getNextLexicalUnit(); if (lu == null) { return v; } if (lu.getLexicalUnitType() != LexicalUnit.SAC_FUNCTION || !lu.getFunctionName().equalsIgnoreCase("icc-color")) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getParameters(); if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } ListValue result = new ListValue(' '); result.append(v); ICCColor icc = new ICCColor(lu.getStringValue()); result.append(icc); lu = lu.getNextLexicalUnit(); while (lu != null) { if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } lu = lu.getNextLexicalUnit(); if (lu == null) { throw createInvalidLexicalUnitDOMException((short)-1); } icc.append(getColorValue(lu)); lu = lu.getNextLexicalUnit(); } return result; }
// in sources/org/apache/batik/css/engine/value/svg/StrokeDashoffsetManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT) { return SVGValueConstants.INHERIT_VALUE; } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/ClipPathManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/MaskManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } break; case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/SVGPaintManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return SVGValueConstants.NONE_VALUE; } // Fall through default: return super.createValue(lu, engine); case LexicalUnit.SAC_URI: } String value = lu.getStringValue(); String uri = resolveURI(engine.getCSSBaseURI(), value); lu = lu.getNextLexicalUnit(); if (lu == null) { return new URIValue(value, uri); } ListValue result = new ListValue(' '); result.append(new URIValue(value, uri)); if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { result.append(SVGValueConstants.NONE_VALUE); return result; } } Value v = super.createValue(lu, engine); if (v.getCssValueType() == CSSValue.CSS_CUSTOM) { ListValue lv = (ListValue)v; for (int i = 0; i < lv.getLength(); i++) { result.append(lv.item(i)); } } else { result.append(v); } return result; }
// in sources/org/apache/batik/css/engine/value/svg/MarkerShorthandManager.java
public void setValues(CSSEngine eng, ShorthandManager.PropertyHandler ph, LexicalUnit lu, boolean imp) throws DOMException { ph.property(CSSConstants.CSS_MARKER_END_PROPERTY, lu, imp); ph.property(CSSConstants.CSS_MARKER_MID_PROPERTY, lu, imp); ph.property(CSSConstants.CSS_MARKER_START_PROPERTY, lu, imp); }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public String getColorProfile() throws DOMException { return colorProfile; }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public int getNumberOfColors() throws DOMException { return count; }
// in sources/org/apache/batik/css/engine/value/svg/ICCColor.java
public float getColor(int i) throws DOMException { return colors[i]; }
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase(); if (s.equals(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } if (s.equals(CSSConstants.CSS_SRGB_VALUE)) { return SVGValueConstants.SRGB_VALUE; } return new StringValue(CSSPrimitiveValue.CSS_IDENT, s); case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/ColorProfileManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_IDENT: String s = value.toLowerCase(); if (s.equals(CSSConstants.CSS_AUTO_VALUE)) { return SVGValueConstants.AUTO_VALUE; } if (s.equals(CSSConstants.CSS_SRGB_VALUE)) { return SVGValueConstants.SRGB_VALUE; } return new StringValue(CSSPrimitiveValue.CSS_IDENT, s); case CSSPrimitiveValue.CSS_URI: return new URIValue(value, resolveURI(engine.getCSSBaseURI(), value)); } throw createInvalidStringTypeDOMException(type); }
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NORMAL_VALUE)) { return SVGValueConstants.NORMAL_VALUE; } throw createInvalidIdentifierDOMException(lu.getStringValue()); } return super.createValue(lu, engine); }
// in sources/org/apache/batik/css/engine/value/svg/SpacingManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } if (value.equalsIgnoreCase(CSSConstants.CSS_NORMAL_VALUE)) { return SVGValueConstants.NORMAL_VALUE; } throw createInvalidIdentifierDOMException(value); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return SVGValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_DEGREE: return new FloatValue(CSSPrimitiveValue.CSS_DEG, lu.getFloatValue()); case LexicalUnit.SAC_GRADIAN: return new FloatValue(CSSPrimitiveValue.CSS_GRAD, lu.getFloatValue()); case LexicalUnit.SAC_RADIAN: return new FloatValue(CSSPrimitiveValue.CSS_RAD, lu.getFloatValue()); // For SVG angle properties unit defaults to 'deg'. case LexicalUnit.SAC_INTEGER: { int n = lu.getIntegerValue(); return new FloatValue(CSSPrimitiveValue.CSS_DEG, n); } case LexicalUnit.SAC_REAL: { float n = lu.getFloatValue(); return new FloatValue(CSSPrimitiveValue.CSS_DEG, n); } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
// in sources/org/apache/batik/css/engine/value/svg/GlyphOrientationManager.java
public Value createFloatValue(short type, float floatValue) throws DOMException { switch (type) { case CSSPrimitiveValue.CSS_DEG: case CSSPrimitiveValue.CSS_GRAD: case CSSPrimitiveValue.CSS_RAD: return new FloatValue(type, floatValue); } throw createInvalidFloatValueDOMException(floatValue); }
// in sources/org/apache/batik/css/engine/value/ListValue.java
public int getLength() throws DOMException { return length; }
// in sources/org/apache/batik/css/engine/value/ListValue.java
public Value item(int index) throws DOMException { return items[index]; }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public float getFloatValue() throws DOMException { return computedValue.getFloatValue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getStringValue() throws DOMException { return computedValue.getStringValue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getRed() throws DOMException { return computedValue.getRed(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getGreen() throws DOMException { return computedValue.getGreen(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getBlue() throws DOMException { return computedValue.getBlue(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public int getLength() throws DOMException { return computedValue.getLength(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value item(int index) throws DOMException { return computedValue.item(index); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getTop() throws DOMException { return computedValue.getTop(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getRight() throws DOMException { return computedValue.getRight(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getBottom() throws DOMException { return computedValue.getBottom(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public Value getLeft() throws DOMException { return computedValue.getLeft(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getIdentifier() throws DOMException { return computedValue.getIdentifier(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getListStyle() throws DOMException { return computedValue.getListStyle(); }
// in sources/org/apache/batik/css/engine/value/ComputedValue.java
public String getSeparator() throws DOMException { return computedValue.getSeparator(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public float getFloatValue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getStringValue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getRed() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getGreen() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getBlue() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public int getLength() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value item(int index) throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getTop() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getRight() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getBottom() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public Value getLeft() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getIdentifier() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getListStyle() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/AbstractValue.java
public String getSeparator() throws DOMException { throw createDOMException(); }
// in sources/org/apache/batik/css/engine/value/RectManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_FUNCTION: if (!lu.getFunctionName().equalsIgnoreCase("rect")) { break; } case LexicalUnit.SAC_RECT_FUNCTION: lu = lu.getParameters(); Value top = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value right = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value bottom = createRectComponent(lu); lu = lu.getNextLexicalUnit(); if (lu == null || lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) { throw createMalformedRectDOMException(); } lu = lu.getNextLexicalUnit(); Value left = createRectComponent(lu); return new RectValue(top, right, bottom, left); } throw createMalformedRectDOMException(); }
// in sources/org/apache/batik/css/engine/value/RectManager.java
private Value createRectComponent(LexicalUnit lu) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_AUTO_VALUE)) { return ValueConstants.AUTO_VALUE; } break; case LexicalUnit.SAC_EM: return new FloatValue(CSSPrimitiveValue.CSS_EMS, lu.getFloatValue()); case LexicalUnit.SAC_EX: return new FloatValue(CSSPrimitiveValue.CSS_EXS, lu.getFloatValue()); case LexicalUnit.SAC_PIXEL: return new FloatValue(CSSPrimitiveValue.CSS_PX, lu.getFloatValue()); case LexicalUnit.SAC_CENTIMETER: return new FloatValue(CSSPrimitiveValue.CSS_CM, lu.getFloatValue()); case LexicalUnit.SAC_MILLIMETER: return new FloatValue(CSSPrimitiveValue.CSS_MM, lu.getFloatValue()); case LexicalUnit.SAC_INCH: return new FloatValue(CSSPrimitiveValue.CSS_IN, lu.getFloatValue()); case LexicalUnit.SAC_POINT: return new FloatValue(CSSPrimitiveValue.CSS_PT, lu.getFloatValue()); case LexicalUnit.SAC_PICA: return new FloatValue(CSSPrimitiveValue.CSS_PC, lu.getFloatValue()); case LexicalUnit.SAC_INTEGER: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); case LexicalUnit.SAC_REAL: return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, lu.getFloatValue()); case LexicalUnit.SAC_PERCENTAGE: return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, lu.getFloatValue()); } throw createMalformedRectDOMException(); }
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = getIdentifiers().get(s); if (v == null) { throw createInvalidIdentifierDOMException(lu.getStringValue()); } return (Value)v; default: throw createInvalidLexicalUnitDOMException (lu.getLexicalUnitType()); } }
// in sources/org/apache/batik/css/engine/value/IdentifierManager.java
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = getIdentifiers().get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, uri); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(InputSource is, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); parseStyleSheet(ss, is, uri); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void parseStyleSheet(StyleSheet ss, ParsedURL uri) throws DOMException { if (uri == null) { String s = Messages.formatMessage ("syntax.error.at", new Object[] { "Null Document reference", "" }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return; } try { // Check that access to the uri is allowed cssContext.checkLoadExternalResource(uri, documentURI); parseStyleSheet(ss, new InputSource(uri.toString()), uri); } catch (SecurityException e) { throw e; } catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public StyleSheet parseStyleSheet(String rules, ParsedURL uri, String media) throws DOMException { StyleSheet ss = new StyleSheet(); try { ss.setMedia(parser.parseMedia(media)); } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; } parseStyleSheet(ss, rules, uri); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
public void parseStyleSheet(StyleSheet ss, String rules, ParsedURL uri) throws DOMException { try { parseStyleSheet(ss, new InputSource(new StringReader(rules)), uri); } catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } }
1
            
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (DOMException ex) { handler.fatalError(new TranscoderException(ex)); }
0 0
unknown (Lib) DataFormatException 0 0 0 1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
1
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
1
unknown (Lib) EOFException 13
            
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b, int off, int len) throws IOException { int n = 0; do { int count = this.read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final boolean readBoolean() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (ch != 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final byte readByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 8) + (ch2 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch2 << 8) + (ch1 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readChar() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readCharLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readInt() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readIntLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedInt() throws IOException { long ch1 = this.read(); long ch2 = this.read(); long ch3 = this.read(); long ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
0 0 0 0 0
runtime (Lib) Error 70
            
// in sources/org/apache/batik/apps/rasterizer/DestinationType.java
public Object readResolve(){ switch(code){ case PNG_CODE: return PNG; case JPEG_CODE: return JPEG; case TIFF_CODE: return TIFF; case PDF_CODE: return PDF; default: throw new Error("unknown code:" + code ); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
public String getURI(){ try{ String uri = file.toURL().toString(); if (ref != null && !"".equals(ref)){ uri += '#' + ref; } return uri; } catch(MalformedURLException e){ throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/svggen/SVGTransform.java
final String convertTransform(TransformStackElement transformElement){ StringBuffer transformString = new StringBuffer(); double[] transformParameters = transformElement.getTransformParameters(); switch(transformElement.getType().toInt()){ case TransformType.TRANSFORM_TRANSLATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_TRANSLATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_ROTATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_ROTATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(radiansToDegrees*transformParameters[0])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SCALE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_SCALE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SHEAR: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(1); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(1); transformString.append(COMMA); transformString.append(0); transformString.append(COMMA); transformString.append(0); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_GENERAL: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[2])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[3])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[4])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[5])); transformString.append(CLOSE_PARENTHESIS); } break; default: // This should never happen. If it does, there is a // serious error. throw new Error(); } return transformString.toString(); }
// in sources/org/apache/batik/svggen/SVGAlphaComposite.java
private Element compositeToSVG(AlphaComposite composite) { // operator is equivalent to rule String operator = null; // input1 is equivalent to Src String input1 = null; // input2 is equivalent to Dst String input2 = null; // k2 is used only for arithmetic // to obtain the equivalent of SRC String k2 = "0"; // ID used to identify the composite String id = null; switch(composite.getRule()){ case AlphaComposite.CLEAR: operator = SVG_ARITHMETIC_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_CLEAR; break; case AlphaComposite.SRC: operator = SVG_ARITHMETIC_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC; k2 = SVG_DIGIT_ONE_VALUE; break; case AlphaComposite.SRC_IN: operator = SVG_IN_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC_IN; break; case AlphaComposite.SRC_OUT: operator = SVG_OUT_VALUE; input1 = SVG_SOURCE_GRAPHIC_VALUE; input2 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_SRC_OUT; break; case AlphaComposite.DST_IN: operator = SVG_IN_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_IN; break; case AlphaComposite.DST_OUT: operator = SVG_OUT_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_OUT; break; case AlphaComposite.DST_OVER: operator = SVG_OVER_VALUE; input2 = SVG_SOURCE_GRAPHIC_VALUE; input1 = SVG_BACKGROUND_IMAGE_VALUE; id = ID_PREFIX_ALPHA_COMPOSITE_DST_OVER; break; default: throw new Error("invalid rule:" + composite.getRule() ); } Element compositeFilter = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FILTER_TAG); compositeFilter.setAttributeNS(null, SVG_ID_ATTRIBUTE, id); compositeFilter.setAttributeNS(null, SVG_FILTER_UNITS_ATTRIBUTE, SVG_OBJECT_BOUNDING_BOX_VALUE); compositeFilter.setAttributeNS(null, SVG_X_ATTRIBUTE, SVG_ZERO_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_Y_ATTRIBUTE, SVG_ZERO_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, SVG_HUNDRED_PERCENT_VALUE); compositeFilter.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, SVG_HUNDRED_PERCENT_VALUE); Element feComposite = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_COMPOSITE_TAG); feComposite.setAttributeNS(null, SVG_OPERATOR_ATTRIBUTE, operator); feComposite.setAttributeNS(null, SVG_IN_ATTRIBUTE, input1); feComposite.setAttributeNS(null, SVG_IN2_ATTRIBUTE, input2); feComposite.setAttributeNS(null, SVG_K2_ATTRIBUTE, k2); feComposite.setAttributeNS(null, SVG_RESULT_ATTRIBUTE, SVG_COMPOSITE_VALUE); Element feFlood = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FLOOD_TAG); feFlood.setAttributeNS(null, SVG_FLOOD_COLOR_ATTRIBUTE, "white"); feFlood.setAttributeNS(null, SVG_FLOOD_OPACITY_ATTRIBUTE, "1"); feFlood.setAttributeNS(null, SVG_RESULT_ATTRIBUTE, SVG_FLOOD_VALUE); Element feMerge = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_TAG); Element feMergeNodeFlood = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_NODE_TAG); feMergeNodeFlood.setAttributeNS(null, SVG_IN_ATTRIBUTE, SVG_FLOOD_VALUE); Element feMergeNodeComposite = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_MERGE_NODE_TAG); feMergeNodeComposite.setAttributeNS(null, SVG_IN_ATTRIBUTE, SVG_COMPOSITE_VALUE); feMerge.appendChild(feMergeNodeFlood); feMerge.appendChild(feMergeNodeComposite); compositeFilter.appendChild(feFlood); compositeFilter.appendChild(feComposite); compositeFilter.appendChild(feMerge); return compositeFilter; }
// in sources/org/apache/batik/svggen/SVGPath.java
public static String toSVGPathData(Shape path, SVGGeneratorContext gc) { StringBuffer d = new StringBuffer( 40 ); PathIterator pi = path.getPathIterator(null); float[] seg = new float[6]; int segType = 0; while (!pi.isDone()) { segType = pi.currentSegment(seg); switch(segType) { case PathIterator.SEG_MOVETO: d.append(PATH_MOVE); appendPoint(d, seg[0], seg[1], gc); break; case PathIterator.SEG_LINETO: d.append(PATH_LINE_TO); appendPoint(d, seg[0], seg[1], gc); break; case PathIterator.SEG_CLOSE: d.append(PATH_CLOSE); break; case PathIterator.SEG_QUADTO: d.append(PATH_QUAD_TO); appendPoint(d, seg[0], seg[1], gc); appendPoint(d, seg[2], seg[3], gc); break; case PathIterator.SEG_CUBICTO: d.append(PATH_CUBIC_TO); appendPoint(d, seg[0], seg[1], gc); appendPoint(d, seg[2], seg[3], gc); appendPoint(d, seg[4], seg[5], gc); break; default: throw new Error("invalid segmentType:" + segType ); } pi.next(); } // while !isDone if (d.length() > 0) return d.toString().trim(); else { // This is a degenerate case: there was no initial moveTo // in the path and no data at all. However, this happens // in the Java 2D API (e.g., when clipping to a rectangle // with negative height/width, the clip will be a GeneralPath // with no data, which causes everything to be clipped) // It is the responsibility of the users of SVGPath to detect // instances where the converted element (see #toSVG above) // returns null, which only happens for degenerate cases. return ""; } }
// in sources/org/apache/batik/svggen/SVGPolygon.java
public Element toSVG(Polygon polygon) { Element svgPolygon = generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_POLYGON_TAG); StringBuffer points = new StringBuffer(" "); PathIterator pi = polygon.getPathIterator(null); float[] seg = new float[6]; while(!pi.isDone()){ int segType = pi.currentSegment(seg); switch(segType){ case PathIterator.SEG_MOVETO: appendPoint(points, seg[0], seg[1]); break; case PathIterator.SEG_LINETO: appendPoint(points, seg[0], seg[1]); break; case PathIterator.SEG_CLOSE: break; case PathIterator.SEG_QUADTO: case PathIterator.SEG_CUBICTO: default: throw new Error("invalid segmentType:" + segType ); } pi.next(); } // while !isDone svgPolygon.setAttributeNS(null, SVG_POINTS_ATTRIBUTE, points.substring(0, points.length() - 1)); return svgPolygon; }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object run() { try { return cx.compileReader (new StringReader(scriptStr), SOURCE_NAME_SVG, 1, rhinoClassLoader); } catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); } }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs){ boolean retVal = true; if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); } gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.transform(inverseTransform); } else{ AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.setTransform(savTransform); } return retVal; }
// in sources/org/apache/batik/ext/awt/g2d/TransformType.java
public Object readResolve() { switch(val){ case TRANSFORM_TRANSLATE: return TransformType.TRANSLATE; case TRANSFORM_ROTATE: return TransformType.ROTATE; case TRANSFORM_SCALE: return TransformType.SCALE; case TRANSFORM_SHEAR: return TransformType.SHEAR; case TRANSFORM_GENERAL: return TransformType.GENERAL; default: throw new Error("Unknown TransformType value:" + val ); } }
// in sources/org/apache/batik/ext/awt/color/ICCColorSpaceExt.java
public float[] intendedToRGB(float[] values){ switch(intent){ case ABSOLUTE_COLORIMETRIC: return absoluteColorimetricToRGB(values); case PERCEPTUAL: case AUTO: return perceptualToRGB(values); case RELATIVE_COLORIMETRIC: return relativeColorimetricToRGB(values); case SATURATION: return saturationToRGB(values); default: throw new Error("invalid intent:" + intent ); } }
// in sources/org/apache/batik/ext/awt/image/CompositeRule.java
private Object readResolve() throws java.io.ObjectStreamException { switch(rule){ case RULE_OVER: return OVER; case RULE_IN: return IN; case RULE_OUT: return OUT; case RULE_ATOP: return ATOP; case RULE_XOR: return XOR; case RULE_ARITHMETIC: return this; case RULE_MULTIPLY: return MULTIPLY; case RULE_SCREEN: return SCREEN; case RULE_DARKEN: return DARKEN; case RULE_LIGHTEN: return LIGHTEN; default: throw new Error("Unknown Composite Rule type"); } }
// in sources/org/apache/batik/ext/awt/image/CompositeRule.java
public String toString() { switch(rule){ case RULE_OVER: return "[CompositeRule: OVER]"; case RULE_IN: return "[CompositeRule: IN]"; case RULE_OUT: return "[CompositeRule: OUT]"; case RULE_ATOP: return "[CompositeRule: ATOP]"; case RULE_XOR: return "[CompositeRule: XOR]"; case RULE_ARITHMETIC: return ("[CompositeRule: ARITHMATIC k1:" + k1 + " k2: " + k2 + " k3: " + k3 + " k4: " + k4 + ']' ); case RULE_MULTIPLY: return "[CompositeRule: MULTIPLY]"; case RULE_SCREEN: return "[CompositeRule: SCREEN]"; case RULE_DARKEN: return "[CompositeRule: DARKEN]"; case RULE_LIGHTEN: return "[CompositeRule: LIGHTEN]"; default: throw new Error("Unknown Composite Rule type"); } }
// in sources/org/apache/batik/ext/awt/image/ARGBChannel.java
public Object readResolve() { switch(val){ case CHANNEL_R: return R; case CHANNEL_G: return G; case CHANNEL_B: return B; case CHANNEL_A: return A; default: throw new Error("Unknown ARGBChannel value"); } }
// in sources/org/apache/batik/ext/awt/image/PadMode.java
private Object readResolve() throws java.io.ObjectStreamException { switch(mode){ case MODE_ZERO_PAD: return ZERO_PAD; case MODE_REPLICATE: return REPLICATE; case MODE_WRAP: return WRAP; default: throw new Error("Unknown Pad Mode type"); } }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
public WritableRaster copyData(WritableRaster argbWR){ try{ RenderedImage img = getSource(); /** * Check that the number of color components match in the input * image and in the replacing profile. */ ColorModel imgCM = img.getColorModel(); ColorSpace imgCS = imgCM.getColorSpace(); int nImageComponents = imgCS.getNumComponents(); int nProfileComponents = colorSpace.getNumComponents(); if(nImageComponents != nProfileComponents){ // Should we go in error???? Here we simply trace an error // and return null System.err.println("Input image and associated color profile have" + " mismatching number of color components: conversion is not possible"); return argbWR; } /** * Get the data from the source for the requested region */ int w = argbWR.getWidth(); int h = argbWR.getHeight(); int minX = argbWR.getMinX(); int minY = argbWR.getMinY(); WritableRaster srcWR = imgCM.createCompatibleWritableRaster(w, h); srcWR = srcWR.createWritableTranslatedChild(minX, minY); img.copyData(srcWR); /** * If the source data is not a ComponentColorModel using a * BandedSampleModel, do the conversion now. */ if(!(imgCM instanceof ComponentColorModel) || !(img.getSampleModel() instanceof BandedSampleModel) || (imgCM.hasAlpha() && imgCM.isAlphaPremultiplied() )) { ComponentColorModel imgCompCM = new ComponentColorModel (imgCS, // Same ColorSpace as img imgCM.getComponentSize(), // Number of bits/comp imgCM.hasAlpha(), // Same alpha as img false, // unpremult alpha (so we can remove it next). imgCM.getTransparency(), // Same trans as img DataBuffer.TYPE_BYTE); // 8 bit/component. WritableRaster wr = Raster.createBandedRaster (DataBuffer.TYPE_BYTE, argbWR.getWidth(), argbWR.getHeight(), imgCompCM.getNumComponents(), new Point(0, 0)); BufferedImage imgComp = new BufferedImage (imgCompCM, wr, imgCompCM.isAlphaPremultiplied(), null); BufferedImage srcImg = new BufferedImage (imgCM, srcWR.createWritableTranslatedChild(0, 0), imgCM.isAlphaPremultiplied(), null); Graphics2D g = imgComp.createGraphics(); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g.drawImage(srcImg, 0, 0, null); img = imgComp; imgCM = imgCompCM; srcWR = wr.createWritableTranslatedChild(minX, minY); } /** * Now, the input image is using a component color * model. We can therefore create an image with the new * profile, using a ComponentColorModel as well, because * we know the number of components match (this was * checked at the begining of this routine). */ ComponentColorModel newCM = new ComponentColorModel (colorSpace, // **** New ColorSpace **** imgCM.getComponentSize(), // Array of number of bits per components false, // No alpa false, // Not premultiplied Transparency.OPAQUE, // No transparency DataBuffer.TYPE_BYTE); // 8 Bits // Build a raster with bands 0, 1 and 2 of img's raster DataBufferByte data = (DataBufferByte)srcWR.getDataBuffer(); srcWR = Raster.createBandedRaster (data, argbWR.getWidth(), argbWR.getHeight(), argbWR.getWidth(), new int[]{0, 1, 2}, new int[]{0, 0, 0}, new Point(0, 0)); BufferedImage newImg = new BufferedImage (newCM, srcWR, newCM.isAlphaPremultiplied(), null); /** * Now, convert the image to sRGB */ ComponentColorModel sRGBCompCM = new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{8, 8, 8}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); WritableRaster wr = Raster.createBandedRaster (DataBuffer.TYPE_BYTE, argbWR.getWidth(), argbWR.getHeight(), sRGBCompCM.getNumComponents(), new Point(0, 0)); BufferedImage sRGBImage = new BufferedImage (sRGBCompCM, wr, false, null); ColorConvertOp colorConvertOp = new ColorConvertOp(null); colorConvertOp.filter(newImg, sRGBImage); /** * Integrate alpha back into the image if there is any */ if (imgCM.hasAlpha()){ DataBufferByte rgbData = (DataBufferByte)wr.getDataBuffer(); byte[][] imgBanks = data.getBankData(); byte[][] rgbBanks = rgbData.getBankData(); byte[][] argbBanks = {rgbBanks[0], rgbBanks[1], rgbBanks[2], imgBanks[3]}; DataBufferByte argbData = new DataBufferByte(argbBanks, imgBanks[0].length); srcWR = Raster.createBandedRaster (argbData, argbWR.getWidth(), argbWR.getHeight(), argbWR.getWidth(), new int[]{0, 1, 2, 3}, new int[]{0, 0, 0, 0}, new Point(0, 0)); sRGBCompCM = new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{8, 8, 8, 8}, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); sRGBImage = new BufferedImage(sRGBCompCM, srcWR, false, null); } /*BufferedImage result = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);*/ BufferedImage result = new BufferedImage(sRGBCM, argbWR.createWritableTranslatedChild(0, 0), false, null); /////////////////////////////////////////////// // BUG IN ColorConvertOp: The following breaks: // colorConvertOp.filter(sRGBImage, result); // // Using Graphics2D instead.... /////////////////////////////////////////////// Graphics2D g = result.createGraphics(); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g.drawImage(sRGBImage, 0, 0, null); g.dispose(); return argbWR; }catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable8Bit.java
private static TransferFunction getTransferFunction (ComponentTransferFunction function){ TransferFunction txfFunc = null; if(function == null){ txfFunc = new IdentityTransfer(); } else{ switch(function.getType()){ case ComponentTransferFunction.IDENTITY: txfFunc = new IdentityTransfer(); break; case ComponentTransferFunction.TABLE: txfFunc = new TableTransfer(tableFloatToInt(function.getTableValues())); break; case ComponentTransferFunction.DISCRETE: txfFunc = new DiscreteTransfer(tableFloatToInt(function.getTableValues())); break; case ComponentTransferFunction.LINEAR: txfFunc = new LinearTransfer(function.getSlope(), function.getIntercept()); break; case ComponentTransferFunction.GAMMA: txfFunc = new GammaTransfer(function.getAmplitude(), function.getExponent(), function.getOffset()); break; default: // Should never happen throw new Error(); } } return txfFunc; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFEncodeParam.java
public void setCompression(int compression) { switch(compression) { case COMPRESSION_NONE: case COMPRESSION_PACKBITS: case COMPRESSION_JPEG_TTN2: case COMPRESSION_DEFLATE: // Do nothing. break; default: throw new Error("TIFFEncodeParam0"); } this.compression = compression; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFEncodeParam.java
public void setDeflateLevel(int deflateLevel) { if(deflateLevel < 1 && deflateLevel > 9 && deflateLevel != Deflater.DEFAULT_COMPRESSION) { throw new Error("TIFFEncodeParam1"); } this.deflateLevel = deflateLevel; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public void decodeNextScanline(byte[] buffer, int lineOffset, int bitOffset) { int bits = 0, code = 0, isT = 0; int current, entry, twoBits; boolean isWhite = true; // Initialize starting of the changing elements array changingElemSize = 0; // While scanline not complete while (bitOffset < w) { while (isWhite) { // White run current = nextNBits(10); entry = white[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits == 12) { // Additional Make up code // Get the next 2 bits twoBits = nextLesserThan8Bits(2); // Consolidate the 2 new bits and last 2 bits into 4 bits current = ((current << 2) & 0x000c) | twoBits; entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits bitOffset += code; // Skip white run updatePointer(4 - bits); } else if (bits == 0) { // ERROR throw new Error("TIFFFaxDecoder0"); } else if (bits == 15) { // EOL throw new Error("TIFFFaxDecoder1"); } else { // 11 bits - 0000 0111 1111 1111 = 0x07ff code = (entry >>> 5) & 0x07ff; bitOffset += code; updatePointer(10 - bits); if (isT == 0) { isWhite = false; currChangingElems[changingElemSize++] = bitOffset; } } } // Check whether this run completed one width, if so // advance to next byte boundary for compression = 2. if (bitOffset == w) { if (compression == 2) { advancePointer(); } break; } while ( ! isWhite ) { // Black run current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code == 100) { current = nextNBits(9); entry = black[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits == 12) { // Additional makeup codes updatePointer(5); current = nextLesserThan8Bits(4); entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(4 - bits); } else if (bits == 15) { // EOL code throw new Error("TIFFFaxDecoder2"); } else { setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(9 - bits); if (isT == 0) { isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); entry = twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; bits = (entry >>> 1) & 0x0f; setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(2 - bits); isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } else { // Is a Terminating code setToBlack(buffer, lineOffset, bitOffset, code); bitOffset += code; updatePointer(4 - bits); isWhite = true; currChangingElems[changingElemSize++] = bitOffset; } } // Check whether this run completed one width if (bitOffset == w) { if (compression == 2) { advancePointer(); } break; } } currChangingElems[changingElemSize++] = bitOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public void decode2D(byte[] buffer, byte[] compData, int startX, int height, long tiffT4Options) { this.data = compData; compression = 3; bitPointer = 0; bytePointer = 0; int scanlineStride = (w + 7)/8; int a0, a1, b1, b2; int[] b = new int[2]; int entry, code, bits; boolean isWhite; int currIndex = 0; int[] temp; // fillBits - dealt with this in readEOL // 1D/2D encoding - dealt with this in readEOL // uncompressedMode - haven't dealt with this yet. oneD = (int)(tiffT4Options & 0x01); uncompressedMode = (int)((tiffT4Options & 0x02) >> 1); fillBits = (int)((tiffT4Options & 0x04) >> 2); // The data must start with an EOL code if (readEOL() != 1) { throw new Error("TIFFFaxDecoder3"); } int lineOffset = 0; int bitOffset; // Then the 1D encoded scanline data will occur, changing elements // array gets set. decodeNextScanline(buffer, lineOffset, startX); lineOffset += scanlineStride; for (int lines = 1; lines < height; lines++) { // Every line must begin with an EOL followed by a bit which // indicates whether the following scanline is 1D or 2D encoded. if (readEOL() == 0) { // 2D encoded scanline follows // Initialize previous scanlines changing elements, and // initialize current scanline's changing elements array temp = prevChangingElems; prevChangingElems = currChangingElems; currChangingElems = temp; currIndex = 0; // a0 has to be set just before the start of this scanline. a0 = -1; isWhite = true; bitOffset = startX; lastChangingElement = 0; while (bitOffset < w) { // Get the next changing element getNextChangingElement(a0, isWhite, b); b1 = b[0]; b2 = b[1]; // Get the next seven bits entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table entry = (int)(twoDCodes[entry] & 0xff); // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code == 0) { if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, b2 - bitOffset); } bitOffset = a0 = b2; // Set pointer to consume the correct number of bits. updatePointer(7 - bits); } else if (code == 1) { // Horizontal updatePointer(7 - bits); // identify the next 2 codes. int number; if (isWhite) { number = decodeWhiteCodeWord(); bitOffset += number; currChangingElems[currIndex++] = bitOffset; number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; currChangingElems[currIndex++] = bitOffset; } else { number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; currChangingElems[currIndex++] = bitOffset; number = decodeWhiteCodeWord(); bitOffset += number; currChangingElems[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { // Vertical a1 = b1 + (code - 5); currChangingElems[currIndex++] = a1; // We write the current color till a1 - 1 pos, // since a1 is where the next color starts if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, a1 - bitOffset); } bitOffset = a0 = a1; isWhite = !isWhite; updatePointer(7 - bits); } else { throw new Error("TIFFFaxDecoder4"); } } // Add the changing element beyond the current scanline for the // other color too currChangingElems[currIndex++] = bitOffset; changingElemSize = currIndex; } else { // 1D encoded scanline follows decodeNextScanline(buffer, lineOffset, startX); } lineOffset += scanlineStride; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
public synchronized void decodeT6(byte[] buffer, byte[] compData, int startX, int height, long tiffT6Options) { this.data = compData; compression = 4; bitPointer = 0; bytePointer = 0; int scanlineStride = (w + 7)/8; int a0, a1, b1, b2; int entry, code, bits; boolean isWhite; int currIndex; int[] temp; // Return values from getNextChangingElement int[] b = new int[2]; // uncompressedMode - have written some code for this, but this // has not been tested due to lack of test images using this optional uncompressedMode = (int)((tiffT6Options & 0x02) >> 1); // Local cached reference int[] cce = currChangingElems; // Assume invisible preceding row of all white pixels and insert // both black and white changing elements beyond the end of this // imaginary scanline. changingElemSize = 0; cce[changingElemSize++] = w; cce[changingElemSize++] = w; int lineOffset = 0; int bitOffset; for (int lines = 0; lines < height; lines++) { // a0 has to be set just before the start of the scanline. a0 = -1; isWhite = true; // Assign the changing elements of the previous scanline to // prevChangingElems and start putting this new scanline's // changing elements into the currChangingElems. temp = prevChangingElems; prevChangingElems = currChangingElems; cce = currChangingElems = temp; currIndex = 0; // Start decoding the scanline at startX in the raster bitOffset = startX; // Reset search start position for getNextChangingElement lastChangingElement = 0; // Till one whole scanline is decoded while (bitOffset < w) { // Get the next changing element getNextChangingElement(a0, isWhite, b); b1 = b[0]; b2 = b[1]; // Get the next seven bits entry = nextLesserThan8Bits(7); // Run these through the 2DCodes table entry = (int)(twoDCodes[entry] & 0xff); // Get the code and the number of bits used up code = (entry & 0x78) >>> 3; bits = entry & 0x07; if (code == 0) { // Pass // We always assume WhiteIsZero format for fax. if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, b2 - bitOffset); } bitOffset = a0 = b2; // Set pointer to only consume the correct number of bits. updatePointer(7 - bits); } else if (code == 1) { // Horizontal // Set pointer to only consume the correct number of bits. updatePointer(7 - bits); // identify the next 2 alternating color codes. int number; if (isWhite) { // Following are white and black runs number = decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; } else { // First a black run and then a white run follows number = decodeBlackCodeWord(); setToBlack(buffer, lineOffset, bitOffset, number); bitOffset += number; cce[currIndex++] = bitOffset; number = decodeWhiteCodeWord(); bitOffset += number; cce[currIndex++] = bitOffset; } a0 = bitOffset; } else if (code <= 8) { // Vertical a1 = b1 + (code - 5); cce[currIndex++] = a1; // We write the current color till a1 - 1 pos, // since a1 is where the next color starts if (!isWhite) { setToBlack(buffer, lineOffset, bitOffset, a1 - bitOffset); } bitOffset = a0 = a1; isWhite = !isWhite; updatePointer(7 - bits); } else if (code == 11) { if (nextLesserThan8Bits(3) != 7) { throw new Error("TIFFFaxDecoder5"); } int zeros = 0; boolean exit = false; while (!exit) { while (nextLesserThan8Bits(1) != 1) { zeros++; } if (zeros > 5) { // Exit code // Zeros before exit code zeros = zeros - 6; if (!isWhite && (zeros > 0)) { cce[currIndex++] = bitOffset; } // Zeros before the exit code bitOffset += zeros; if (zeros > 0) { // Some zeros have been written isWhite = true; } // Read in the bit which specifies the color of // the following run if (nextLesserThan8Bits(1) == 0) { if (!isWhite) { cce[currIndex++] = bitOffset; } isWhite = true; } else { if (isWhite) { cce[currIndex++] = bitOffset; } isWhite = false; } exit = true; } if (zeros == 5) { if (!isWhite) { cce[currIndex++] = bitOffset; } bitOffset += zeros; // Last thing written was white isWhite = true; } else { bitOffset += zeros; cce[currIndex++] = bitOffset; setToBlack(buffer, lineOffset, bitOffset, 1); ++bitOffset; // Last thing written was black isWhite = false; } } } else { throw new Error("TIFFFaxDecoder5"); } } // Add the changing element beyond the current scanline for the // other color too cce[currIndex++] = bitOffset; // Number of changing elements in this scanline. changingElemSize = currIndex; lineOffset += scanlineStride; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int decodeWhiteCodeWord() { int current, entry, bits, isT, twoBits, code = -1; int runLength = 0; boolean isWhite = true; while (isWhite) { current = nextNBits(10); entry = white[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x0f; if (bits == 12) { // Additional Make up code // Get the next 2 bits twoBits = nextLesserThan8Bits(2); // Consolidate the 2 new bits and last 2 bits into 4 bits current = ((current << 2) & 0x000c) | twoBits; entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits runLength += code; updatePointer(4 - bits); } else if (bits == 0) { // ERROR throw new Error("TIFFFaxDecoder0"); } else if (bits == 15) { // EOL throw new Error("TIFFFaxDecoder1"); } else { // 11 bits - 0000 0111 1111 1111 = 0x07ff code = (entry >>> 5) & 0x07ff; runLength += code; updatePointer(10 - bits); if (isT == 0) { isWhite = false; } } } return runLength; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int decodeBlackCodeWord() { int current, entry, bits, isT, code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code == 100) { current = nextNBits(9); entry = black[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits == 12) { // Additional makeup codes updatePointer(5); current = nextLesserThan8Bits(4); entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits runLength += code; updatePointer(4 - bits); } else if (bits == 15) { // EOL code throw new Error("TIFFFaxDecoder2"); } else { runLength += code; updatePointer(9 - bits); if (isT == 0) { isWhite = true; } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); entry = twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; runLength += code; bits = (entry >>> 1) & 0x0f; updatePointer(2 - bits); isWhite = true; } else { // Is a Terminating code runLength += code; updatePointer(4 - bits); isWhite = true; } } return runLength; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int readEOL() { if (fillBits == 0) { if (nextNBits(12) != 1) { throw new Error("TIFFFaxDecoder6"); } } else if (fillBits == 1) { // First EOL code word xxxx 0000 0000 0001 will occur // As many fill bits will be present as required to make // the EOL code of 12 bits end on a byte boundary. int bitsLeft = 8 - bitPointer; if (nextNBits(bitsLeft) != 0) { throw new Error("TIFFFaxDecoder8"); } // If the number of bitsLeft is less than 8, then to have a 12 // bit EOL sequence, two more bytes are certainly going to be // required. The first of them has to be all zeros, so ensure // that. if (bitsLeft < 4) { if (nextNBits(8) != 0) { throw new Error("TIFFFaxDecoder8"); } } // There might be a random number of fill bytes with 0s, so // loop till the EOL of 0000 0001 is found, as long as all // the bytes preceding it are 0's. int n; while ((n = nextNBits(8)) != 1) { // If not all zeros if (n != 0) { throw new Error("TIFFFaxDecoder8"); } } } // If one dimensional encoding mode, then always return 1 if (oneD == 0) { return 1; } else { // Otherwise for 2D encoding mode, // The next one bit signifies 1D/2D encoding of next line. return nextLesserThan8Bits(1); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int nextNBits(int bitsToGet) { byte b, next, next2next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = data[bp + 1]; next2next = 0x00; } else { next = data[bp + 1]; next2next = data[bp + 2]; } } else if (fillOrder == 2) { b = flipTable[data[bp] & 0xff]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = flipTable[data[bp + 1] & 0xff]; next2next = 0x00; } else { next = flipTable[data[bp + 1] & 0xff]; next2next = flipTable[data[bp + 2] & 0xff]; } } else { throw new Error("TIFFFaxDecoder7"); } int bitsLeft = 8 - bitPointer; int bitsFromNextByte = bitsToGet - bitsLeft; int bitsFromNext2NextByte = 0; if (bitsFromNextByte > 8) { bitsFromNext2NextByte = bitsFromNextByte - 8; bitsFromNextByte = 8; } bytePointer++; int i1 = (b & table1[bitsLeft]) << (bitsToGet - bitsLeft); int i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); int i3 = 0; if (bitsFromNext2NextByte != 0) { i2 <<= bitsFromNext2NextByte; i3 = (next2next & table2[bitsFromNext2NextByte]) >>> (8 - bitsFromNext2NextByte); i2 |= i3; bytePointer++; bitPointer = bitsFromNext2NextByte; } else { if (bitsFromNextByte == 8) { bitPointer = 0; bytePointer++; } else { bitPointer = bitsFromNextByte; } } int i = i1 | i2; return i; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFFaxDecoder.java
private int nextLesserThan8Bits(int bitsToGet) { byte b, next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; } else { next = data[bp + 1]; } } else if (fillOrder == 2) { b = flipTable[data[bp] & 0xff]; if (bp == l) { next = 0x00; } else { next = flipTable[data[bp + 1] & 0xff]; } } else { throw new Error("TIFFFaxDecoder7"); } int bitsLeft = 8 - bitPointer; int bitsFromNextByte = bitsToGet - bitsLeft; int shift = bitsLeft - bitsToGet; int i1, i2; if (shift >= 0) { i1 = (b & table1[bitsLeft]) >>> shift; bitPointer += bitsToGet; if (bitPointer == 8) { bitPointer = 0; bytePointer++; } } else { i1 = (b & table1[bitsLeft]) << (-shift); i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte); i1 |= i2; bytePointer++; bitPointer = bitsFromNextByte; } return i1; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValues(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: byte[] bytes = field.getAsBytes(); for (int i=0; i<count; i++) { output.write(bytes[i]); } break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); for (int i=0; i<count; i++) { writeUnsignedShort(chars[i]); } break; case TIFFField.TIFF_SSHORT: short[] shorts = field.getAsShorts(); for (int i=0; i<count; i++) { writeUnsignedShort(shorts[i]); } break; // unsigned 32 bits case TIFFField.TIFF_LONG: case TIFFField.TIFF_SLONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; case TIFFField.TIFF_FLOAT: float[] floats = field.getAsFloats(); for (int i=0; i<count; i++) { int intBits = Float.floatToIntBits(floats[i]); writeLong(intBits); } break; case TIFFField.TIFF_DOUBLE: double[] doubles = field.getAsDoubles(); for (int i=0; i<count; i++) { long longBits = Double.doubleToLongBits(doubles[i]); writeLong(longBits >>> 32); // write upper 32 bits writeLong(longBits & 0xffffffffL); // write lower 32 bits } break; case TIFFField.TIFF_RATIONAL: case TIFFField.TIFF_SRATIONAL: long[][] rationals = field.getAsRationals(); for (int i=0; i<count; i++) { writeLong(rationals[i][0]); writeLong(rationals[i][1]); } break; case TIFFField.TIFF_ASCII: for (int i=0; i<count; i++) { byte[] stringBytes = field.getAsString(i).getBytes(); output.write(stringBytes); if(stringBytes[stringBytes.length-1] != (byte)0) { output.write((byte)0); } } break; default: throw new Error("TIFFImageEncoder10"); } }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
public double getValue(){ try{ String t = getText(0, getLength()); if(t != null && t.length() > 0){ return Double.parseDouble(t); } else{ return 0; } }catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); } }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new Error("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new Error("Writer expected"); } prettyPrint(r, w); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
public int[] getSelected(Mark startMark, Mark finishMark) { if (startMark == null || finishMark == null) { return null; } BasicTextPainter.BasicMark start; BasicTextPainter.BasicMark finish; try { start = (BasicTextPainter.BasicMark) startMark; finish = (BasicTextPainter.BasicMark) finishMark; } catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); } TextNode textNode = start.getTextNode(); if (textNode == null) return null; if (textNode != finish.getTextNode()) throw new Error("Markers are from different TextNodes!"); AttributedCharacterIterator aci; aci = textNode.getAttributedCharacterIterator(); if (aci == null) return null; int[] result = new int[2]; result[0] = start.getHit().getCharIndex(); result[1] = finish.getHit().getCharIndex(); // get the list of text runs List textRuns = getTextRuns(textNode, aci); Iterator trI = textRuns.iterator(); int startGlyphIndex = -1; int endGlyphIndex = -1; TextSpanLayout startLayout=null, endLayout=null; while (trI.hasNext()) { TextRun tr = (TextRun)trI.next(); TextSpanLayout tsl = tr.getLayout(); if (startGlyphIndex == -1) { startGlyphIndex = tsl.getGlyphIndex(result[0]); if (startGlyphIndex != -1) startLayout = tsl; } if (endGlyphIndex == -1) { endGlyphIndex = tsl.getGlyphIndex(result[1]); if (endGlyphIndex != -1) endLayout = tsl; } if ((startGlyphIndex != -1) && (endGlyphIndex != -1)) break; } if ((startLayout == null) || (endLayout == null)) return null; int startCharCount = startLayout.getCharacterCount (startGlyphIndex, startGlyphIndex); int endCharCount = endLayout.getCharacterCount (endGlyphIndex, endGlyphIndex); if (startCharCount > 1) { if (result[0] > result[1] && startLayout.isLeftToRight()) { result[0] += startCharCount-1; } else if (result[1] > result[0] && !startLayout.isLeftToRight()) { result[0] -= startCharCount-1; } } if (endCharCount > 1) { if (result[1] > result[0] && endLayout.isLeftToRight()) { result[1] += endCharCount-1; } else if (result[0] > result[1] && !endLayout.isLeftToRight()) { result[1] -= endCharCount-1; } } return result; }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
public Shape getHighlightShape(Mark beginMark, Mark endMark) { if (beginMark == null || endMark == null) { return null; } BasicTextPainter.BasicMark begin; BasicTextPainter.BasicMark end; try { begin = (BasicTextPainter.BasicMark) beginMark; end = (BasicTextPainter.BasicMark) endMark; } catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); } TextNode textNode = begin.getTextNode(); if (textNode == null) return null; if (textNode != end.getTextNode()) throw new Error("Markers are from different TextNodes!"); AttributedCharacterIterator aci; aci = textNode.getAttributedCharacterIterator(); if (aci == null) return null; int beginIndex = begin.getHit().getCharIndex(); int endIndex = end.getHit().getCharIndex(); if (beginIndex > endIndex) { // Swap them... BasicTextPainter.BasicMark tmpMark = begin; begin = end; end = tmpMark; int tmpIndex = beginIndex; beginIndex = endIndex; endIndex = tmpIndex; } // get the list of text runs List textRuns = getTextRuns(textNode, aci); GeneralPath highlightedShape = new GeneralPath(); // for each text run, append any highlight it may contain for // the current selection for (int i = 0; i < textRuns.size(); ++i) { TextRun textRun = (TextRun)textRuns.get(i); TextSpanLayout layout = textRun.getLayout(); Shape layoutHighlightedShape = layout.getHighlightShape (beginIndex, endIndex); // append the highlighted shape of this layout to the // overall hightlighted shape if (( layoutHighlightedShape != null) && (!layoutHighlightedShape.getBounds().isEmpty())) { highlightedShape.append(layoutHighlightedShape, false); } } return highlightedShape; }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
private double[] computeInSlope(double[] prev, int prevSegType, double[] curr, int currSegType){ // Compute point into which the slope runs Point2D currEndPoint = getSegmentTerminatingPoint(curr, currSegType); double dx = 0; double dy = 0; switch(currSegType){ case PathIterator.SEG_LINETO: { // This is equivalent to a line from the previous segment's // terminating point and the current end point. Point2D prevEndPoint = getSegmentTerminatingPoint(prev, prevSegType); dx = currEndPoint.getX() - prevEndPoint.getX(); dy = currEndPoint.getY() - prevEndPoint.getY(); } break; case PathIterator.SEG_QUADTO: // If the current segment is a line, quad or cubic curve. // the slope is about equal to that of the line from the // last control point and the curEndPoint dx = currEndPoint.getX() - curr[0]; dy = currEndPoint.getY() - curr[1]; break; case PathIterator.SEG_CUBICTO: // If the current segment is a quad or cubic curve. // the slope is about equal to that of the line from the // last control point and the curEndPoint dx = currEndPoint.getX() - curr[2]; dy = currEndPoint.getY() - curr[3]; break; case ExtendedPathIterator.SEG_ARCTO: { // If the current segment is an ARCTO then we build the // arc and ask for it's end angle and get the tangent there. Point2D prevEndPoint = getSegmentTerminatingPoint(prev, prevSegType); boolean large = (curr[3]!=0.); boolean goLeft = (curr[4]!=0.); Arc2D arc = ExtendedGeneralPath.computeArc (prevEndPoint.getX(), prevEndPoint.getY(), curr[0], curr[1], curr[2], large, goLeft, curr[5], curr[6]); double theta = arc.getAngleStart()+arc.getAngleExtent(); theta = Math.toRadians(theta); dx = -arc.getWidth()/2.0*Math.sin(theta); dy = arc.getHeight()/2.0*Math.cos(theta); // System.out.println("In Theta: " + Math.toDegrees(theta) + // " Dx/Dy: " + dx + "/" + dy); if (curr[2] != 0) { double ang = Math.toRadians(-curr[2]); double sinA = Math.sin(ang); double cosA = Math.cos(ang); double tdx = dx*cosA - dy*sinA; double tdy = dx*sinA + dy*cosA; dx = tdx; dy = tdy; } // System.out.println(" Rotate: " + curr[2] + // " Dx/Dy: " + dx + "/" + dy); if (goLeft) { dx = -dx; } else { dy = -dy; } // System.out.println(" GoLeft? " + goLeft + // " Dx/Dy: " + dx + "/" + dy); } break; case PathIterator.SEG_CLOSE: // Should not have any close at this point throw new Error("should not have SEG_CLOSE here"); case PathIterator.SEG_MOVETO: // Cannot compute the slope default: return null; } if (dx == 0 && dy == 0) { return null; } return normalize(new double[] { dx, dy }); }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
protected Point2D getSegmentTerminatingPoint(double[] coords, int segType) { switch(segType){ case PathIterator.SEG_CUBICTO: return new Point2D.Double(coords[4], coords[5]); case PathIterator.SEG_LINETO: return new Point2D.Double(coords[0], coords[1]); case PathIterator.SEG_MOVETO: return new Point2D.Double(coords[0], coords[1]); case PathIterator.SEG_QUADTO: return new Point2D.Double(coords[2], coords[3]); case ExtendedPathIterator.SEG_ARCTO: return new Point2D.Double(coords[5], coords[6]); case PathIterator.SEG_CLOSE: default: throw new Error( "invalid segmentType:" + segType ); // Should never happen: close segments are replaced with lineTo } }
// in sources/org/apache/batik/gvt/TextNode.java
public void setSelection(Mark begin, Mark end) { if ((begin.getTextNode() != this) || (end.getTextNode() != this)) throw new Error("Markers not from this TextNode"); beginMark = begin; endMark = end; }
// in sources/org/apache/batik/gvt/TextNode.java
private Object readResolve() throws java.io.ObjectStreamException { switch(type){ case ANCHOR_START: return START; case ANCHOR_MIDDLE: return MIDDLE; case ANCHOR_END: return END; default: throw new Error("Unknown Anchor type"); } }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
public void setPositionTransform(AffineTransform at) { fireGraphicsNodeChangeStarted(); invalidateGeometryCache(); this.positionTransform = at; if (positionTransform != null) { transform = new AffineTransform(positionTransform); if (viewingTransform != null) transform.concatenate(viewingTransform); } else if (viewingTransform != null) transform = new AffineTransform(viewingTransform); else transform = new AffineTransform(); if (transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else{ // The transform is not invertible. Use the same // transform. inverseTransform = transform; } fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
public void setViewingTransform(AffineTransform at) { fireGraphicsNodeChangeStarted(); invalidateGeometryCache(); this.viewingTransform = at; if (positionTransform != null) { transform = new AffineTransform(positionTransform); if (viewingTransform != null) transform.concatenate(viewingTransform); } else if (viewingTransform != null) transform = new AffineTransform(viewingTransform); else transform = new AffineTransform(); if(transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else{ // The transform is not invertible. Use the same // transform. inverseTransform = transform; } fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
public void setTransform(AffineTransform newTransform) { fireGraphicsNodeChangeStarted(); this.transform = newTransform; if(transform.getDeterminant() != 0){ try{ inverseTransform = transform.createInverse(); }catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); } } else { // The transform is not invertible. Use the same // transform. inverseTransform = transform; } if (parent != null) parent.invalidateGeometryCache(); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/text/ConcreteTextSelector.java
public void setSelection(Mark begin, Mark end) { TextNode node = begin.getTextNode(); if (node != end.getTextNode()) { throw new Error("Markers not from same TextNode"); } node.setSelection(begin, end); selectionNode = node; selectionNodeRoot = node.getRoot(); Object selection = getSelection(); Shape shape = node.getHighlightShape(); dispatchSelectionEvent(new SelectionEvent (selection, SelectionEvent.SELECTION_DONE, shape)); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
public ComponentTransferFunction createComponentTransferFunction (Element filterElement, Element funcElement) { int type = convertType(funcElement, ctx); switch (type) { case ComponentTransferFunction.DISCRETE: { float [] v = convertTableValues(funcElement, ctx); if (v == null) { return ConcreteComponentTransferFunction.getIdentityTransfer(); } else { return ConcreteComponentTransferFunction.getDiscreteTransfer(v); } } case ComponentTransferFunction.IDENTITY: { return ConcreteComponentTransferFunction.getIdentityTransfer(); } case ComponentTransferFunction.GAMMA: { // 'amplitude' attribute - default is 1 float amplitude = convertNumber(funcElement, SVG_AMPLITUDE_ATTRIBUTE, 1, ctx); // 'exponent' attribute - default is 1 float exponent = convertNumber(funcElement, SVG_EXPONENT_ATTRIBUTE, 1, ctx); // 'offset' attribute - default is 0 float offset = convertNumber(funcElement, SVG_OFFSET_ATTRIBUTE, 0, ctx); return ConcreteComponentTransferFunction.getGammaTransfer (amplitude, exponent, offset); } case ComponentTransferFunction.LINEAR: { // 'slope' attribute - default is 1 float slope = convertNumber(funcElement, SVG_SLOPE_ATTRIBUTE, 1, ctx); // 'intercept' attribute - default is 0 float intercept = convertNumber(funcElement, SVG_INTERCEPT_ATTRIBUTE, 0, ctx); return ConcreteComponentTransferFunction.getLinearTransfer (slope, intercept); } case ComponentTransferFunction.TABLE: { float [] v = convertTableValues(funcElement, ctx); if (v == null) { return ConcreteComponentTransferFunction.getIdentityTransfer(); } else { return ConcreteComponentTransferFunction.getTableTransfer(v); } } default: throw new Error("invalid convertType:" + type ); // can't be reached } }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
public Filter createFilter(BridgeContext ctx, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Filter inputFilter, Rectangle2D filterRegion, Map filterMap) { // 'in' attribute Filter in = getIn(filterElement, filteredElement, filteredNode, inputFilter, filterMap, ctx); if (in == null) { return null; // disable the filter } // Default region is the size of in (if in is SourceGraphic or // SourceAlpha it will already include a pad/crop to the // proper filter region size). Rectangle2D defaultRegion = in.getBounds2D(); Rectangle2D primitiveRegion = SVGUtilities.convertFilterPrimitiveRegion(filterElement, filteredElement, filteredNode, defaultRegion, filterRegion, ctx); int type = convertType(filterElement, ctx); ColorMatrixRable colorMatrix; switch (type) { case ColorMatrixRable.TYPE_HUE_ROTATE: float a = convertValuesToHueRotate(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildHueRotate(a); break; case ColorMatrixRable.TYPE_LUMINANCE_TO_ALPHA: colorMatrix = ColorMatrixRable8Bit.buildLuminanceToAlpha(); break; case ColorMatrixRable.TYPE_MATRIX: float [][] matrix = convertValuesToMatrix(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildMatrix(matrix); break; case ColorMatrixRable.TYPE_SATURATE: float s = convertValuesToSaturate(filterElement, ctx); colorMatrix = ColorMatrixRable8Bit.buildSaturate(s); break; default: throw new Error("invalid convertType:" + type ); // can't be reached } colorMatrix.setSource(in); // handle the 'color-interpolation-filters' property handleColorInterpolationFilters(colorMatrix, filterElement); Filter filter = new PadRable8Bit(colorMatrix, primitiveRegion, PadMode.ZERO_PAD); // update the filter Map updateFilterMap(filterElement, filter, filterMap); return filter; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public void putBridge(String namespaceURI, String localName, Bridge bridge) { // start assert if (!(namespaceURI.equals(bridge.getNamespaceURI()) && localName.equals(bridge.getLocalName()))) { throw new Error("Invalid Bridge: "+ namespaceURI+"/"+bridge.getNamespaceURI()+" "+ localName+"/"+bridge.getLocalName()+" "+ bridge.getClass()); } // end assert if (namespaceURIMap == null) { namespaceURIMap = new HashMap(); } namespaceURI = ((namespaceURI == null)? "" : namespaceURI); HashMap localNameMap = (HashMap) namespaceURIMap.get(namespaceURI); if (localNameMap == null) { localNameMap = new HashMap(); namespaceURIMap.put(namespaceURI, localNameMap); } localNameMap.put(localName, bridge); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Rectangle2D convertFilterPrimitiveRegion(Element filterPrimitiveElement, Element filterElement, Element filteredElement, GraphicsNode filteredNode, Rectangle2D defaultRegion, Rectangle2D filterRegion, BridgeContext ctx) { // 'primitiveUnits' - default is userSpaceOnUse String units = ""; if (filterElement != null) { units = getChainableAttributeNS(filterElement, null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, ctx); } short unitsType; if (units.length() == 0) { unitsType = USER_SPACE_ON_USE; } else { unitsType = parseCoordinateSystem (filterElement, SVG_FILTER_UNITS_ATTRIBUTE, units, ctx); } String xStr = "", yStr = "", wStr = "", hStr = ""; if (filterPrimitiveElement != null) { // 'x' attribute - default is defaultRegion.getX() xStr = filterPrimitiveElement.getAttributeNS(null, SVG_X_ATTRIBUTE); // 'y' attribute - default is defaultRegion.getY() yStr = filterPrimitiveElement.getAttributeNS(null, SVG_Y_ATTRIBUTE); // 'width' attribute - default is defaultRegion.getWidth() wStr = filterPrimitiveElement.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE); // 'height' attribute - default is defaultRegion.getHeight() hStr = filterPrimitiveElement.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE); } double x = defaultRegion.getX(); double y = defaultRegion.getY(); double w = defaultRegion.getWidth(); double h = defaultRegion.getHeight(); // resolve units in the (referenced) filteredElement's coordinate system UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, filteredElement); switch (unitsType) { case OBJECT_BOUNDING_BOX: Rectangle2D bounds = filteredNode.getGeometryBounds(); if (bounds != null) { if (xStr.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, SVG_X_ATTRIBUTE, uctx); x = bounds.getX() + x*bounds.getWidth(); } if (yStr.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, SVG_Y_ATTRIBUTE, uctx); y = bounds.getY() + y*bounds.getHeight(); } if (wStr.length() != 0) { w = UnitProcessor.svgHorizontalLengthToObjectBoundingBox (wStr, SVG_WIDTH_ATTRIBUTE, uctx); w *= bounds.getWidth(); } if (hStr.length() != 0) { h = UnitProcessor.svgVerticalLengthToObjectBoundingBox (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); h *= bounds.getHeight(); } } break; case USER_SPACE_ON_USE: if (xStr.length() != 0) { x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, SVG_X_ATTRIBUTE, uctx); } if (yStr.length() != 0) { y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, SVG_Y_ATTRIBUTE, uctx); } if (wStr.length() != 0) { w = UnitProcessor.svgHorizontalLengthToUserSpace (wStr, SVG_WIDTH_ATTRIBUTE, uctx); } if (hStr.length() != 0) { h = UnitProcessor.svgVerticalLengthToUserSpace (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); } break; default: throw new Error("invalid unitsType:" + unitsType); // can't be reached } Rectangle2D region = new Rectangle2D.Double(x, y, w, h); // Now, extend filter primitive region with dx/dy/dw/dh // settings (Batik extension). The dx/dy/dw/dh padding is // *always* in userSpaceOnUse space. units = ""; if (filterElement != null) { units = getChainableAttributeNS (filterElement, null, SVG12Constants.SVG_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE, ctx); } if (units.length() == 0) { unitsType = USER_SPACE_ON_USE; } else { unitsType = parseCoordinateSystem (filterElement, SVG12Constants.SVG_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE, units, ctx); } String dxStr = "", dyStr = "", dwStr = "", dhStr = ""; if (filterPrimitiveElement != null) { // 'batik:dx' attribute - default is 0 dxStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MX_ATRIBUTE); // 'batik:dy' attribute - default is 0 dyStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MY_ATRIBUTE); // 'batik:dw' attribute - default is 0 dwStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MW_ATRIBUTE); // 'batik:dh' attribute - default is 0 dhStr = filterPrimitiveElement.getAttributeNS (null, SVG12Constants.SVG_MH_ATRIBUTE); } if (dxStr.length() == 0) { dxStr = SVG12Constants.SVG_FILTER_MX_DEFAULT_VALUE; } if (dyStr.length() == 0) { dyStr = SVG12Constants.SVG_FILTER_MY_DEFAULT_VALUE; } if (dwStr.length() == 0) { dwStr = SVG12Constants.SVG_FILTER_MW_DEFAULT_VALUE; } if (dhStr.length() == 0) { dhStr = SVG12Constants.SVG_FILTER_MH_DEFAULT_VALUE; } region = extendRegion(dxStr, dyStr, dwStr, dhStr, unitsType, filteredNode, region, uctx); Rectangle2D.intersect(region, filterRegion, region); return region; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
protected static Rectangle2D convertRegion(String xStr, String yStr, String wStr, String hStr, short unitsType, GraphicsNode targetNode, UnitProcessor.Context uctx) { // construct the mask region in the appropriate coordinate system double x, y, w, h; switch (unitsType) { case OBJECT_BOUNDING_BOX: x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, SVG_X_ATTRIBUTE, uctx); y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, SVG_Y_ATTRIBUTE, uctx); w = UnitProcessor.svgHorizontalLengthToObjectBoundingBox (wStr, SVG_WIDTH_ATTRIBUTE, uctx); h = UnitProcessor.svgVerticalLengthToObjectBoundingBox (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); Rectangle2D bounds = targetNode.getGeometryBounds(); if (bounds != null ) { x = bounds.getX() + x*bounds.getWidth(); y = bounds.getY() + y*bounds.getHeight(); w *= bounds.getWidth(); h *= bounds.getHeight(); } else { x = y = w = h = 0; } break; case USER_SPACE_ON_USE: x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, SVG_X_ATTRIBUTE, uctx); y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, SVG_Y_ATTRIBUTE, uctx); w = UnitProcessor.svgHorizontalLengthToUserSpace (wStr, SVG_WIDTH_ATTRIBUTE, uctx); h = UnitProcessor.svgVerticalLengthToUserSpace (hStr, SVG_HEIGHT_ATTRIBUTE, uctx); break; default: throw new Error("invalid unitsType:" + unitsType ); // can't be reached } return new Rectangle2D.Double(x, y, w, h); }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public void installSecurityManager(){ Policy policy = Policy.getPolicy(); BatikSecurityManager securityManager = new BatikSecurityManager(); // // If there is a java.security.policy property defined, // it takes precedence over the one passed to this object. // Otherwise, we default to the one passed to the constructor // ClassLoader cl = appMainClass.getClassLoader(); String securityPolicyProperty = System.getProperty(PROPERTY_JAVA_SECURITY_POLICY); if (securityPolicyProperty == null || securityPolicyProperty.equals("")) { // Specify app's security policy in the // system property. URL policyURL = getPolicyURL(); System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, policyURL.toString()); } // // The following detects whether the application is running in the // development environment, in which case it will set the // app.dev.base property or if it is running in the binary // distribution, in which case it will set the app.jar.base // property. These properties are expanded in the security // policy files. // Property expansion is used to provide portability of the // policy files between various code bases (e.g., file base, // server base, etc..). // URL mainClassURL = cl.getResource(appMainClassRelativeURL); if (mainClassURL == null){ // Something is really wrong: we would be running a class // which can't be found.... throw new Error(appMainClassRelativeURL); } String expandedMainClassName = mainClassURL.toString(); if (expandedMainClassName.startsWith(JAR_PROTOCOL) ) { setJarBase(expandedMainClassName); } else { setDevBase(expandedMainClassName); } // Install new security manager System.setSecurityManager(securityManager); lastSecurityManagerInstalled = securityManager; // Forces re-loading of the security policy policy.refresh(); if (securityPolicyProperty == null || securityPolicyProperty.equals("")) { System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, ""); } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
private void setJarBase(String expandedMainClassName){ // // Only set the app.jar.base if it is not already defined // String curAppJarBase = System.getProperty(PROPERTY_APP_JAR_BASE); if (curAppJarBase == null) { expandedMainClassName = expandedMainClassName.substring(JAR_PROTOCOL.length()); int codeBaseEnd = expandedMainClassName.indexOf(JAR_URL_FILE_SEPARATOR + appMainClassRelativeURL); if (codeBaseEnd == -1){ // Something is seriously wrong. This should *never* happen // as the APP_SECURITY_POLICY_URL is such that it will be // a substring of its corresponding URL value throw new Error(); } String appCodeBase = expandedMainClassName.substring(0, codeBaseEnd); // At this point appCodeBase contains the JAR file name // Now, we extract it. codeBaseEnd = appCodeBase.lastIndexOf('/'); if (codeBaseEnd == -1) { appCodeBase = ""; } else { appCodeBase = appCodeBase.substring(0, codeBaseEnd); } System.setProperty(PROPERTY_APP_JAR_BASE, appCodeBase); } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
private void setDevBase(String expandedMainClassName){ // // Only set the app.code.base property if it is not already // defined. // String curAppCodeBase = System.getProperty(PROPERTY_APP_DEV_BASE); if (curAppCodeBase == null) { int codeBaseEnd = expandedMainClassName.indexOf(APP_MAIN_CLASS_DIR + appMainClassRelativeURL); if (codeBaseEnd == -1){ // Something is seriously wrong. This should *never* happen // as the APP_SECURITY_POLICY_URL is such that it will be // a substring of its corresponding URL value throw new Error(); } String appCodeBase = expandedMainClassName.substring(0, codeBaseEnd); System.setProperty(PROPERTY_APP_DEV_BASE, appCodeBase); } }
11
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(BadLocationException e){ // Will not happen because we are sure // we use the proper range throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
catch (ClassCastException cce) { throw new Error ("This Mark was not instantiated by this TextPainter class!"); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
0 0 0 0
runtime (Domain) EventException
public class EventException extends RuntimeException {
    public EventException(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
    // EventExceptionCode
    /**
     *  If the <code>Event.type</code> was not specified by initializing the 
     * event before the method was called. Specification of the 
     * <code>Event.type</code> as <code>null</code> or an empty string will 
     * also trigger this exception. 
     */
    public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
    /**
     *  If the <code>Event</code> object is already dispatched in the tree. 
     * @since DOM Level 3
     */
    public static final short DISPATCH_REQUEST_ERR      = 1;

}
0 0 3
            
// in sources/org/apache/batik/dom/svg12/XBLEventSupport.java
public boolean dispatchEvent(NodeEventTarget target, Event evt) throws EventException { // System.err.println("\t[] dispatching " + e.getType() + " on " + ((Node) target).getNodeName()); if (evt == null) { return false; } if (!(evt instanceof AbstractEvent)) { throw createEventException (DOMException.NOT_SUPPORTED_ERR, "unsupported.event", new Object[] {}); } AbstractEvent e = (AbstractEvent) evt; String type = e.getType(); if (type == null || type.length() == 0) { throw createEventException (EventException.UNSPECIFIED_EVENT_TYPE_ERR, "unspecified.event", new Object[] {}); } // fix event status setTarget(e, target); stopPropagation(e, false); stopImmediatePropagation(e, false); preventDefault(e, false); // dump the tree hierarchy from top to the target NodeEventTarget[] ancestors = getAncestors(target); int bubbleLimit = e.getBubbleLimit(); int minAncestor = 0; if (isSingleScopeEvent(e)) { // DOM Mutation events are dispatched only within the // one shadow scope AbstractNode targetNode = (AbstractNode) target; Node boundElement = targetNode.getXblBoundElement(); if (boundElement != null) { minAncestor = ancestors.length; while (minAncestor > 0) { AbstractNode ancestorNode = (AbstractNode) ancestors[minAncestor - 1]; if (ancestorNode.getXblBoundElement() != boundElement) { break; } minAncestor--; } } } else if (bubbleLimit != 0) { // Other events may have a bubble limit (such as UI events) minAncestor = ancestors.length - bubbleLimit + 1; if (minAncestor < 0) { minAncestor = 0; } } // System.err.println("\t== ancestors:"); // for (int i = 0; i < ancestors.length; i++) { // if (i < minAncestor) { // System.err.print("\t "); // } else { // System.err.print("\t * "); // } // System.err.println(((Node) ancestors[i]).getNodeName()); // } AbstractEvent[] es = getRetargettedEvents(target, ancestors, e); boolean preventDefault = false; // CAPTURING_PHASE : fire event listeners from top to EventTarget HashSet stoppedGroups = new HashSet(); HashSet toBeStoppedGroups = new HashSet(); for (int i = 0; i < minAncestor; i++) { NodeEventTarget node = ancestors[i]; // System.err.println("\t-- CAPTURING " + e.getType() + " " + ((Node) node).getNodeName()); setCurrentTarget(es[i], node); setEventPhase(es[i], Event.CAPTURING_PHASE); fireImplementationEventListeners(node, es[i], true); } for (int i = minAncestor; i < ancestors.length; i++) { NodeEventTarget node = ancestors[i]; // System.err.println("\t-- * CAPTURING " + e.getType() + " " + ((Node) node).getNodeName()); setCurrentTarget(es[i], node); setEventPhase(es[i], Event.CAPTURING_PHASE); fireImplementationEventListeners(node, es[i], true); fireEventListeners(node, es[i], true, stoppedGroups, toBeStoppedGroups); fireHandlerGroupEventListeners(node, es[i], true, stoppedGroups, toBeStoppedGroups); preventDefault = preventDefault || es[i].getDefaultPrevented(); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); } // AT_TARGET : fire local event listeners // System.err.println("\t-- * AT_TARGET " + e.getType() + " " + ((Node) target).getNodeName()); setEventPhase(e, Event.AT_TARGET); setCurrentTarget(e, target); fireImplementationEventListeners(target, e, false); fireEventListeners(target, e, false, stoppedGroups, toBeStoppedGroups); fireHandlerGroupEventListeners(node, e, false, stoppedGroups, toBeStoppedGroups); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); preventDefault = preventDefault || e.getDefaultPrevented(); // BUBBLING_PHASE : fire event listeners from target to top if (e.getBubbles()) { for (int i = ancestors.length - 1; i >= minAncestor; i--) { NodeEventTarget node = ancestors[i]; // System.err.println("\t-- * BUBBLING " + e.getType() + " " + ((Node) node).getNodeName()); setCurrentTarget(es[i], node); setEventPhase(es[i], Event.BUBBLING_PHASE); fireImplementationEventListeners(node, es[i], false); fireEventListeners(node, es[i], false, stoppedGroups, toBeStoppedGroups); fireHandlerGroupEventListeners (node, es[i], false, stoppedGroups, toBeStoppedGroups); preventDefault = preventDefault || es[i].getDefaultPrevented(); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); } for (int i = minAncestor - 1; i >= 0; i--) { NodeEventTarget node = ancestors[i]; // System.err.println("\t-- BUBBLING " + e.getType() + " " + ((Node) node).getNodeName()); setCurrentTarget(es[i], node); setEventPhase(es[i], Event.BUBBLING_PHASE); fireImplementationEventListeners(node, es[i], false); preventDefault = preventDefault || es[i].getDefaultPrevented(); } } if (!preventDefault) { runDefaultActions(e); } return preventDefault; }
// in sources/org/apache/batik/dom/AbstractNode.java
public boolean dispatchEvent(Event evt) throws EventException { if (eventSupport == null) { initializeEventSupport(); } return eventSupport.dispatchEvent(this, evt); }
// in sources/org/apache/batik/dom/events/EventSupport.java
public boolean dispatchEvent(NodeEventTarget target, Event evt) throws EventException { if (evt == null) { return false; } if (!(evt instanceof AbstractEvent)) { throw createEventException(DOMException.NOT_SUPPORTED_ERR, "unsupported.event", new Object[] { }); } AbstractEvent e = (AbstractEvent) evt; String type = e.getType(); if (type == null || type.length() == 0) { throw createEventException (EventException.UNSPECIFIED_EVENT_TYPE_ERR, "unspecified.event", new Object[] {}); } // fix event status e.setTarget(target); e.stopPropagation(false); e.stopImmediatePropagation(false); e.preventDefault(false); // dump the tree hierarchy from top to the target NodeEventTarget[] ancestors = getAncestors(target); // CAPTURING_PHASE : fire event listeners from top to EventTarget e.setEventPhase(Event.CAPTURING_PHASE); HashSet stoppedGroups = new HashSet(); HashSet toBeStoppedGroups = new HashSet(); for (int i = 0; i < ancestors.length; i++) { NodeEventTarget node = ancestors[i]; e.setCurrentTarget(node); fireEventListeners(node, e, true, stoppedGroups, toBeStoppedGroups); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); } // AT_TARGET : fire local event listeners e.setEventPhase(Event.AT_TARGET); e.setCurrentTarget(target); fireEventListeners(target, e, false, stoppedGroups, toBeStoppedGroups); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); // BUBBLING_PHASE : fire event listeners from target to top if (e.getBubbles()) { e.setEventPhase(Event.BUBBLING_PHASE); for (int i = ancestors.length - 1; i >= 0; i--) { NodeEventTarget node = ancestors[i]; e.setCurrentTarget(node); fireEventListeners(node, e, false, stoppedGroups, toBeStoppedGroups); stoppedGroups.addAll(toBeStoppedGroups); toBeStoppedGroups.clear(); } } if (!e.getDefaultPrevented()) { runDefaultActions(e); } return e.getDefaultPrevented(); }
0 0 0
checked (Lib) Exception 1
            
// in sources/org/apache/batik/svggen/font/SVGFont.java
protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii) throws Exception { // StringBuffer sb = new StringBuffer(); // int horiz_advance_x = font.getHmtxTable().getAdvanceWidth( // font.getHheaTable().getNumberOfHMetrics() - 1); int horiz_advance_x = font.getOS2Table().getAvgCharWidth(); ps.print(XML_OPEN_TAG_START); ps.print(SVG_FONT_TAG); ps.print(XML_SPACE); // ps.print("<font "); if (id != null) { ps.print(SVG_ID_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("id=\""); ps.print(id); ps.print(XML_CHAR_QUOT); ps.print(XML_SPACE); // ps.print("\" "); } ps.print(SVG_HORIZ_ADV_X_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("horiz-adv-x=\""); ps.print(horiz_advance_x); ps.print(XML_CHAR_QUOT); ps.print(XML_OPEN_TAG_END_CHILDREN); // ps.println("\">"); ps.print(getSVGFontFaceElement(font)); // Decide upon a cmap table to use for our character to glyph look-up CmapFormat cmapFmt = null; if (forceAscii) { // We've been asked to use the ASCII/Macintosh cmap format cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMacintosh, Table.encodingRoman ); } else { // The default behaviour is to use the Unicode cmap encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUGL ); if (cmapFmt == null) { // This might be a symbol font, so we'll look for an "undefined" encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUndefined ); } } if (cmapFmt == null) { throw new Exception("Cannot find a suitable cmap table"); } // If this font includes arabic script, we want to specify // substitutions for initial, medial, terminal & isolated // cases. GsubTable gsub = (GsubTable) font.getTable(Table.GSUB); SingleSubst initialSubst = null; SingleSubst medialSubst = null; SingleSubst terminalSubst = null; if (gsub != null) { Script s = gsub.getScriptList().findScript(SCRIPT_TAG_ARAB); if (s != null) { LangSys ls = s.getDefaultLangSys(); if (ls != null) { Feature init = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_INIT); Feature medi = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_MEDI); Feature fina = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_FINA); if (init != null) { initialSubst = (SingleSubst) gsub.getLookupList().getLookup(init, 0).getSubtable(0); } if (medi != null) { medialSubst = (SingleSubst) gsub.getLookupList().getLookup(medi, 0).getSubtable(0); } if (fina != null) { terminalSubst = (SingleSubst) gsub.getLookupList().getLookup(fina, 0).getSubtable(0); } } } } // Include the missing glyph ps.println(getGlyphAsSVG(font, font.getGlyph(0), 0, horiz_advance_x, initialSubst, medialSubst, terminalSubst, "")); try { if (first == -1) { if (!autoRange) first = DEFAULT_FIRST; else first = cmapFmt.getFirst(); } if (last == -1) { if (!autoRange) last = DEFAULT_LAST; else last = cmapFmt.getLast(); } // Include our requested range Set glyphSet = new HashSet(); for (int i = first; i <= last; i++) { int glyphIndex = cmapFmt.mapCharCode(i); // ps.println(String.valueOf(i) + " -> " + String.valueOf(glyphIndex)); // if (font.getGlyphs()[glyphIndex] != null) // sb.append(font.getGlyphs()[glyphIndex].toString() + "\n"); if (glyphIndex > 0) { // add glyph ID to set so we can filter later glyphSet.add(glyphIndex); ps.println(getGlyphAsSVG( font, font.getGlyph(glyphIndex), glyphIndex, horiz_advance_x, initialSubst, medialSubst, terminalSubst, (32 <= i && i <= 127) ? encodeEntities( String.valueOf( (char)i ) ) : XML_CHAR_REF_PREFIX + Integer.toHexString(i) + XML_CHAR_REF_SUFFIX)); } } // Output kerning pairs from the requested range KernTable kern = (KernTable) font.getTable(Table.kern); if (kern != null) { KernSubtable kst = kern.getSubtable(0); PostTable post = (PostTable) font.getTable(Table.post); for (int i = 0; i < kst.getKerningPairCount(); i++) { KerningPair kpair = kst.getKerningPair(i); // check if left and right are both in our glyph set if (glyphSet.contains(kpair.getLeft()) && glyphSet.contains(kpair.getRight())) { ps.println(getKerningPairAsSVG(kpair, post)); } } } } catch (Exception e) { System.err.println(e.getMessage()); } ps.print(XML_CLOSE_TAG_START); ps.print(SVG_FONT_TAG); ps.println(XML_CLOSE_TAG_END); // ps.println("</font>"); }
0 5
            
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
public void handle(ParsedURL purl, JSVGViewerFrame svgViewerFrame) throws Exception { String uri = purl.toString(); TransformerFactory tFactory = TransformerFactory.newInstance(); // First, load the input XML document into a generic DOM tree DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document inDoc = db.parse(uri); // Now, look for <?xml-stylesheet ...?> processing instructions String xslStyleSheetURI = extractXSLProcessingInstruction(inDoc); if (xslStyleSheetURI == null) { // Assume that the input file is a literal result template xslStyleSheetURI = uri; } ParsedURL parsedXSLStyleSheetURI = new ParsedURL(uri, xslStyleSheetURI); Transformer transformer = tFactory.newTransformer (new StreamSource(parsedXSLStyleSheetURI.toString())); // Set the URIResolver to properly handle document() and xsl:include transformer.setURIResolver (new DocumentURIResolver(parsedXSLStyleSheetURI.toString())); // Now, apply the transformation to the input document. // // <!> Due to issues with namespaces, the transform creates the // result in a stream which is parsed. This is sub-optimal // but this was the only solution found to be able to // generate content in the proper namespaces. // // SVGOMDocument outDoc = // (SVGOMDocument)impl.createDocument(svgNS, "svg", null); // outDoc.setURLObject(new URL(uri)); // transformer.transform // (new DOMSource(inDoc), // new DOMResult(outDoc.getDocumentElement())); // StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); transformer.transform(new DOMSource(inDoc), result); sw.flush(); sw.close(); String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; try { outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); } // Patch the result tree to go under the root node // checkAndPatch(outDoc); svgViewerFrame.getJSVGCanvas().setSVGDocument(outDoc); svgViewerFrame.setSVGDocument(outDoc, uri, outDoc.getTitle()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii) throws Exception { // StringBuffer sb = new StringBuffer(); // int horiz_advance_x = font.getHmtxTable().getAdvanceWidth( // font.getHheaTable().getNumberOfHMetrics() - 1); int horiz_advance_x = font.getOS2Table().getAvgCharWidth(); ps.print(XML_OPEN_TAG_START); ps.print(SVG_FONT_TAG); ps.print(XML_SPACE); // ps.print("<font "); if (id != null) { ps.print(SVG_ID_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("id=\""); ps.print(id); ps.print(XML_CHAR_QUOT); ps.print(XML_SPACE); // ps.print("\" "); } ps.print(SVG_HORIZ_ADV_X_ATTRIBUTE); ps.print(XML_EQUAL_QUOT); // ps.print("horiz-adv-x=\""); ps.print(horiz_advance_x); ps.print(XML_CHAR_QUOT); ps.print(XML_OPEN_TAG_END_CHILDREN); // ps.println("\">"); ps.print(getSVGFontFaceElement(font)); // Decide upon a cmap table to use for our character to glyph look-up CmapFormat cmapFmt = null; if (forceAscii) { // We've been asked to use the ASCII/Macintosh cmap format cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMacintosh, Table.encodingRoman ); } else { // The default behaviour is to use the Unicode cmap encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUGL ); if (cmapFmt == null) { // This might be a symbol font, so we'll look for an "undefined" encoding cmapFmt = font.getCmapTable().getCmapFormat( Table.platformMicrosoft, Table.encodingUndefined ); } } if (cmapFmt == null) { throw new Exception("Cannot find a suitable cmap table"); } // If this font includes arabic script, we want to specify // substitutions for initial, medial, terminal & isolated // cases. GsubTable gsub = (GsubTable) font.getTable(Table.GSUB); SingleSubst initialSubst = null; SingleSubst medialSubst = null; SingleSubst terminalSubst = null; if (gsub != null) { Script s = gsub.getScriptList().findScript(SCRIPT_TAG_ARAB); if (s != null) { LangSys ls = s.getDefaultLangSys(); if (ls != null) { Feature init = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_INIT); Feature medi = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_MEDI); Feature fina = gsub.getFeatureList().findFeature(ls, FEATURE_TAG_FINA); if (init != null) { initialSubst = (SingleSubst) gsub.getLookupList().getLookup(init, 0).getSubtable(0); } if (medi != null) { medialSubst = (SingleSubst) gsub.getLookupList().getLookup(medi, 0).getSubtable(0); } if (fina != null) { terminalSubst = (SingleSubst) gsub.getLookupList().getLookup(fina, 0).getSubtable(0); } } } } // Include the missing glyph ps.println(getGlyphAsSVG(font, font.getGlyph(0), 0, horiz_advance_x, initialSubst, medialSubst, terminalSubst, "")); try { if (first == -1) { if (!autoRange) first = DEFAULT_FIRST; else first = cmapFmt.getFirst(); } if (last == -1) { if (!autoRange) last = DEFAULT_LAST; else last = cmapFmt.getLast(); } // Include our requested range Set glyphSet = new HashSet(); for (int i = first; i <= last; i++) { int glyphIndex = cmapFmt.mapCharCode(i); // ps.println(String.valueOf(i) + " -> " + String.valueOf(glyphIndex)); // if (font.getGlyphs()[glyphIndex] != null) // sb.append(font.getGlyphs()[glyphIndex].toString() + "\n"); if (glyphIndex > 0) { // add glyph ID to set so we can filter later glyphSet.add(glyphIndex); ps.println(getGlyphAsSVG( font, font.getGlyph(glyphIndex), glyphIndex, horiz_advance_x, initialSubst, medialSubst, terminalSubst, (32 <= i && i <= 127) ? encodeEntities( String.valueOf( (char)i ) ) : XML_CHAR_REF_PREFIX + Integer.toHexString(i) + XML_CHAR_REF_SUFFIX)); } } // Output kerning pairs from the requested range KernTable kern = (KernTable) font.getTable(Table.kern); if (kern != null) { KernSubtable kst = kern.getSubtable(0); PostTable post = (PostTable) font.getTable(Table.post); for (int i = 0; i < kst.getKerningPairCount(); i++) { KerningPair kpair = kst.getKerningPair(i); // check if left and right are both in our glyph set if (glyphSet.contains(kpair.getLeft()) && glyphSet.contains(kpair.getRight())) { ps.println(getKerningPairAsSVG(kpair, post)); } } } } catch (Exception e) { System.err.println(e.getMessage()); } ps.print(XML_CLOSE_TAG_START); ps.print(SVG_FONT_TAG); ps.println(XML_CLOSE_TAG_END); // ps.println("</font>"); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_IEND_chunk(PNGChunk chunk) throws Exception { // Store text strings int textLen = textKeys.size(); String[] textArray = new String[2*textLen]; for (int i = 0; i < textLen; i++) { String key = (String)textKeys.get(i); String val = (String)textStrings.get(i); textArray[2*i] = key; textArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "text_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setText(textArray); } // Store compressed text strings int ztextLen = ztextKeys.size(); String[] ztextArray = new String[2*ztextLen]; for (int i = 0; i < ztextLen; i++) { String key = (String)ztextKeys.get(i); String val = (String)ztextStrings.get(i); ztextArray[2*i] = key; ztextArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "ztext_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setCompressedText(ztextArray); } // Parse prior IDAT chunks InputStream seqStream = new SequenceInputStream( Collections.enumeration( streamVec ) ); InputStream infStream = new InflaterInputStream(seqStream, new Inflater()); dataStream = new DataInputStream(infStream); // Create an empty WritableRaster int depth = bitDepth; if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && output8BitGray) { depth = 8; } if ((colorType == PNG_COLOR_PALETTE) && expandPalette) { depth = 8; } int bytesPerRow = (outputBands*width*depth + 7)/8; int scanlineStride = (depth == 16) ? (bytesPerRow/2) : bytesPerRow; theTile = createRaster(width, height, outputBands, scanlineStride, depth); if (performGammaCorrection && (gammaLut == null)) { initGammaLut(bitDepth); } if ((postProcess == POST_GRAY_LUT) || (postProcess == POST_GRAY_LUT_ADD_TRANS) || (postProcess == POST_GRAY_LUT_ADD_TRANS_EXP)) { initGrayLut(bitDepth); } decodeImage(interlaceMethod == 1); sampleModel = theTile.getSampleModel(); if ((colorType == PNG_COLOR_PALETTE) && !expandPalette) { if (outputHasAlphaPalette) { colorModel = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette, alphaPalette); } else { colorModel = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette); } } else if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && !output8BitGray) { byte[] palette = expandBits[bitDepth]; colorModel = new IndexColorModel(bitDepth, palette.length, palette, palette, palette); } else { colorModel = createComponentColorModel(sampleModel); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_IEND_chunk(PNGChunk chunk) throws Exception { // Store text strings int textLen = textKeys.size(); String[] textArray = new String[2*textLen]; for (int i = 0; i < textLen; i++) { String key = (String)textKeys.get(i); String val = (String)textStrings.get(i); textArray[2*i] = key; textArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "text_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setText(textArray); } // Store compressed text strings int ztextLen = ztextKeys.size(); String[] ztextArray = new String[2*ztextLen]; for (int i = 0; i < ztextLen; i++) { String key = (String)ztextKeys.get(i); String val = (String)ztextStrings.get(i); ztextArray[2*i] = key; ztextArray[2*i + 1] = val; if (emitProperties) { String uniqueKey = "ztext_" + i + ':' + key; properties.put(uniqueKey.toLowerCase(), val); } } if (encodeParam != null) { encodeParam.setCompressedText(ztextArray); } // Parse prior IDAT chunks InputStream seqStream = new SequenceInputStream( Collections.enumeration( streamVec )); InputStream infStream = new InflaterInputStream(seqStream, new Inflater()); dataStream = new DataInputStream(infStream); // Create an empty WritableRaster int depth = bitDepth; if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && output8BitGray) { depth = 8; } if ((colorType == PNG_COLOR_PALETTE) && expandPalette) { depth = 8; } int width = bounds.width; int height = bounds.height; int bytesPerRow = (outputBands*width*depth + 7)/8; int scanlineStride = (depth == 16) ? (bytesPerRow/2) : bytesPerRow; theTile = createRaster(width, height, outputBands, scanlineStride, depth); if (performGammaCorrection && (gammaLut == null)) { initGammaLut(bitDepth); } if ((postProcess == POST_GRAY_LUT) || (postProcess == POST_GRAY_LUT_ADD_TRANS) || (postProcess == POST_GRAY_LUT_ADD_TRANS_EXP)) { initGrayLut(bitDepth); } decodeImage(interlaceMethod == 1); // Free resources associated with compressed data. dataStream.close(); infStream.close(); seqStream.close(); streamVec = null; SampleModel sm = theTile.getSampleModel(); ColorModel cm; if ((colorType == PNG_COLOR_PALETTE) && !expandPalette) { if (outputHasAlphaPalette) { cm = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette, alphaPalette); } else { cm = new IndexColorModel(bitDepth, paletteEntries, redPalette, greenPalette, bluePalette); } } else if ((colorType == PNG_COLOR_GRAY) && (bitDepth < 8) && !output8BitGray) { byte[] palette = expandBits[bitDepth]; cm = new IndexColorModel(bitDepth, palette.length, palette, palette, palette); } else { cm = createComponentColorModel(sm); } init((CachableRed)null, bounds, cm, sm, 0, 0, properties); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
public static void main(String[] args) throws Exception{ if(args.length < 1){ System.err.println(USAGE); System.exit(0); } // // Builds a PrintTranscoder // PrintTranscoder transcoder = new PrintTranscoder(); // // Set the hints, from the command line arguments // // Language setTranscoderFloatHint(transcoder, KEY_LANGUAGE_STR, KEY_LANGUAGE); // User stylesheet setTranscoderFloatHint(transcoder, KEY_USER_STYLESHEET_URI_STR, KEY_USER_STYLESHEET_URI); // XML parser setTranscoderStringHint(transcoder, KEY_XML_PARSER_CLASSNAME_STR, KEY_XML_PARSER_CLASSNAME); // Scale to page setTranscoderBooleanHint(transcoder, KEY_SCALE_TO_PAGE_STR, KEY_SCALE_TO_PAGE); // AOI setTranscoderRectangleHint(transcoder, KEY_AOI_STR, KEY_AOI); // Image size setTranscoderFloatHint(transcoder, KEY_WIDTH_STR, KEY_WIDTH); setTranscoderFloatHint(transcoder, KEY_HEIGHT_STR, KEY_HEIGHT); // Pixel to millimeter setTranscoderFloatHint(transcoder, KEY_PIXEL_TO_MM_STR, KEY_PIXEL_UNIT_TO_MILLIMETER); // Page orientation setTranscoderStringHint(transcoder, KEY_PAGE_ORIENTATION_STR, KEY_PAGE_ORIENTATION); // Page size setTranscoderFloatHint(transcoder, KEY_PAGE_WIDTH_STR, KEY_PAGE_WIDTH); setTranscoderFloatHint(transcoder, KEY_PAGE_HEIGHT_STR, KEY_PAGE_HEIGHT); // Margins setTranscoderFloatHint(transcoder, KEY_MARGIN_TOP_STR, KEY_MARGIN_TOP); setTranscoderFloatHint(transcoder, KEY_MARGIN_RIGHT_STR, KEY_MARGIN_RIGHT); setTranscoderFloatHint(transcoder, KEY_MARGIN_BOTTOM_STR, KEY_MARGIN_BOTTOM); setTranscoderFloatHint(transcoder, KEY_MARGIN_LEFT_STR, KEY_MARGIN_LEFT); // Dialog options setTranscoderBooleanHint(transcoder, KEY_SHOW_PAGE_DIALOG_STR, KEY_SHOW_PAGE_DIALOG); setTranscoderBooleanHint(transcoder, KEY_SHOW_PRINTER_DIALOG_STR, KEY_SHOW_PRINTER_DIALOG); // // First, request the transcoder to transcode // each of the input files // for(int i=0; i<args.length; i++){ transcoder.transcode(new TranscoderInput(new File(args[i]).toURL().toString()), null); } // // Now, print... // transcoder.print(); System.exit(0); }
119
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); return; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) {}
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) {}
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (Exception ex) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception ex) { ex.printStackTrace(); uiSpecialization = null; }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (Exception e) { // As in other places. But this is ugly... }
// in sources/org/apache/batik/apps/rasterizer/DestinationType.java
catch(Exception e) { return null; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch (Exception e) { userStylesheetURL = userStylesheet; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/svgpp/Main.java
catch (Exception e) { e.printStackTrace(); printUsage(); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { System.err.println(e.getMessage()); }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); usage(); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (Exception e) { // should not happened }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (Exception e) { // should not happened }
// in sources/org/apache/batik/script/ImportInfo.java
catch (Exception ex) { // Just try the next file... // ex.printStackTrace(); }
// in sources/org/apache/batik/script/rhino/svg12/SVG12RhinoInterpreter.java
catch (Exception ex) { // cannot happen }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (Exception ex) { // cannot happen }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
// in sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
catch (Exception e) { System.err.println ("You have loaded the Batik jar files more than once\n" + "in the same JVM this is likely a problem with the\n" + "way you are loading the Batik jar files."); base = (int)(Math.random()*2000000); continue; }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIODebugUtil.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); return null; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
catch (Exception e) { stream = new MemoryCacheSeekableStream(is); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
catch ( Exception e ) { }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception ex) { return new DocumentError(type, severity, key, related, e); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { return new XPathException(type, key); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (Exception ex) { }
// in sources/org/apache/batik/dom/AbstractNode.java
catch (Exception e) { return new DOMException(type, key); }
// in sources/org/apache/batik/dom/svg/SVGOMElement.java
catch (Exception e) { return new SVGOMException(type, key); }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (Exception e) { return new EventException(code, key); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (Exception ex) { }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (Exception exc) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Exception e) { exception = e; fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (Exception e) { }
// in sources/org/apache/batik/gvt/svg12/MultiResGraphicsNode.java
catch (Exception ex) { ex.printStackTrace(); }
// in sources/org/apache/batik/gvt/text/GlyphLayout.java
catch (Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (Exception ex) { // Do nothing couldn't get Referenced URL. }
// in sources/org/apache/batik/bridge/FontFace.java
catch (Exception ex) { }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } else { e.printStackTrace(); // No UA so just output... } synchronized (this) { error = true; } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e) { if (e instanceof SecurityException) { userAgent.displayError(e); } updateRunnableQueue.invokeLater(new Runnable() { public void run() { try { h.getURLDone(false, null, null); } catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } } } }); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (Exception e){ if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (Exception ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { helpCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (Exception ex) { /* Nothing to do */ }
// in sources/org/apache/batik/bridge/RepaintManager.java
catch(Exception e) { e.printStackTrace(); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (Exception ex) { /* Nothing to do */ }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); return null; } }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception e) { userAgent.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (Exception ex) { userAgent.displayError(ex); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (ctx.getUserAgent() == null) { ex.printStackTrace(); } else { ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (Exception ex) { if (++exceptionCount < MAX_EXCEPTION_COUNT) { if (eng.ctx.getUserAgent() == null) { ex.printStackTrace(); } else { eng.ctx.getUserAgent().displayError(ex); } } }
// in sources/org/apache/batik/util/gui/xmleditor/XMLScanner.java
catch (Exception ex) { current = -1; }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (Exception ex) { is.reset(); return is; }
// in sources/org/apache/batik/util/Service.java
catch (Exception ex) { // Just try the next line }
// in sources/org/apache/batik/util/Service.java
catch (Exception ex) { // Just try the next file... }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
23
            
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
// in sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
catch(Exception e){ e.printStackTrace(); throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (Exception ex) { throw new BridgeException (bridgeContext, e, ex, ErrorConstants.ERR_URI_IMAGE_BROKEN, new Object[] {url, message }); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String s =Messages.formatMessage ("media.error", new Object[] { str, m }); throw new DOMException(DOMException.SYNTAX_ERR, s); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, an, attr.getNodeValue(), m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, style, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; // todo - better handling of NPE String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, pname, value, m}); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, prop, value, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = e.getClass().getName(); String s = Messages.formatMessage ("syntax.error.at", new Object[] { uri.toString(), m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("syntax.error.at", new Object[] { u, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); return ss; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { // e.printStackTrace(); String m = e.getMessage(); if (m == null) m = ""; String s = Messages.formatMessage ("stylesheet.syntax.error", new Object[] { uri.toString(), rules, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("property.syntax.error.at", new Object[] { u, property, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); }
7
unknown (Lib) FileNotFoundException 0 0 1
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
public InputStream openStream() throws FileNotFoundException{ return new FileInputStream(file); }
2
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch(FileNotFoundException fnfe) { System.err.println("Unable to open file-list: " + file); return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
1
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
0
unknown (Lib) IIOInvalidTreeException 0 0 0 3
            
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
3
            
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
3
checked (Lib) IOException 26
            
// in sources/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java
public File createNewFolder(File containingDir) throws IOException { if(containingDir == null) { throw new IOException(Resources.getString(EXCEPTION_CONTAINING_DIR_NULL)); } File newFolder = null; // Using NT's default folder name newFolder = createFileObject(containingDir, Resources.getString(NEW_FOLDER_NAME)); int i = 2; while (newFolder.exists() && (i < 100)) { newFolder = createFileObject (containingDir, Resources.getString(NEW_FOLDER_NAME) + " (" + i + ')' ); i++; } if(newFolder.exists()) { throw new IOException (Resources.formatMessage(EXCEPTION_DIRECTORY_ALREADY_EXISTS, new Object[]{newFolder.getAbsolutePath()})); } else { newFolder.mkdirs(); } return newFolder; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if ((page < 0) || (page >= getNumPages())) { throw new IOException("TIFFImageDecoder0"); } return new TIFFImage(input, (TIFFDecodeParam)param, page); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if (page != 0) { throw new IOException(PropertyUtil.getString("PNGImageDecoder19")); } return new PNGImage(input, (PNGDecodeParam)param); }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("MemoryCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("FileCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
public void read(DataInputStream is) throws IOException { reset(); setReading( true ); int dwIsAldus = readInt( is ); if ( dwIsAldus == WMFConstants.META_ALDUS_APM ) { // Read the aldus placeable header. int key = dwIsAldus; isAldus = true; readShort( is ); // metafile handle, always zero left = readShort( is ); top = readShort( is ); right = readShort( is ); bottom = readShort( is ); inch = readShort( is ); int reserved = readInt( is ); short checksum = readShort( is ); // inverse values if left > right or top > bottom if (left > right) { int _i = right; right = left; left = _i; xSign = -1; } if (top > bottom) { int _i = bottom; bottom = top; top = _i; ySign = -1; } width = right - left; height = bottom - top; // read the beginning of the header mtType = readShort( is ); mtHeaderSize = readShort( is ); } else { // read the beginning of the header, the first int corresponds to the first two parameters mtType = ((dwIsAldus << 16) >> 16); mtHeaderSize = dwIsAldus >> 16; } mtVersion = readShort( is ); mtSize = readInt( is ); mtNoObjects = readShort( is ); mtMaxRecord = readInt( is ); mtNoParameters = readShort( is ); numObjects = mtNoObjects; List tempList = new ArrayList( numObjects ); for ( int i = 0; i < numObjects; i++ ) { tempList.add( new GdiObject( i, false )); } objectVector.addAll( tempList ); boolean ret = readRecords(is); is.close(); if (!ret) throw new IOException("Unhandled exception while reading records"); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, InputStream inp) throws IOException { Document doc; InputSource is = new InputSource(inp); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { Document doc; InputSource is = new InputSource(r); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static void writeNode(Node n, Writer w, NSMap m, boolean isXML11) throws IOException { switch (n.getNodeType()) { case Node.ELEMENT_NODE: { if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); if (name.startsWith("xmlns")) { if (name.length() == 5) { m = m.declare("", a.getNodeValue()); } else { String prefix = name.substring(6); m = m.declare(prefix, a.getNodeValue()); } } } } w.write('<'); String ns = n.getNamespaceURI(); String tagName; if (ns == null) { tagName = n.getNodeName(); w.write(tagName); if (!"".equals(m.getNamespace(""))) { w.write(" xmlns=\"\""); m = m.declare("", ""); } } else { String prefix = n.getPrefix(); if (prefix == null) { prefix = ""; } if (ns.equals(m.getNamespace(prefix))) { tagName = n.getNodeName(); w.write(tagName); } else { prefix = m.getPrefixForElement(ns); if (prefix == null) { prefix = m.getNewPrefix(); tagName = prefix + ':' + n.getLocalName(); w.write(tagName + " xmlns:" + prefix + "=\"" + contentToString(ns, isXML11) + '"'); m = m.declare(prefix, ns); } else { if (prefix.equals("")) { tagName = n.getLocalName(); } else { tagName = prefix + ':' + n.getLocalName(); } w.write(tagName); } } } if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); String prefix = a.getPrefix(); String ans = a.getNamespaceURI(); if (ans != null && !("xmlns".equals(prefix) || name.equals("xmlns"))) { if (prefix != null && !ans.equals(m.getNamespace(prefix)) || prefix == null) { prefix = m.getPrefixForAttr(ans); if (prefix == null) { prefix = m.getNewPrefix(); m = m.declare(prefix, ans); w.write(" xmlns:" + prefix + "=\"" + contentToString(ans, isXML11) + '"'); } name = prefix + ':' + a.getLocalName(); } } w.write(' ' + name + "=\"" + contentToString(a.getNodeValue(), isXML11) + '"'); } } Node c = n.getFirstChild(); if (c != null) { w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null); w.write("</" + tagName + '>'); } else { w.write("/>"); } break; } case Node.TEXT_NODE: w.write(contentToString(n.getNodeValue(), isXML11)); break; case Node.CDATA_SECTION_NODE: { String data = n.getNodeValue(); if (data.indexOf("]]>") != -1) { throw new IOException("Unserializable CDATA section node"); } w.write("<![CDATA[" + assertValidCharacters(data, isXML11) + "]]>"); break; } case Node.ENTITY_REFERENCE_NODE: w.write('&' + n.getNodeName() + ';'); break; case Node.PROCESSING_INSTRUCTION_NODE: { String target = n.getNodeName(); String data = n.getNodeValue(); if (target.equalsIgnoreCase("xml") || target.indexOf(':') != -1 || data.indexOf("?>") != -1) { throw new IOException("Unserializable processing instruction node"); } w.write("<?" + target + ' ' + data + "?>"); break; } case Node.COMMENT_NODE: { w.write("<!--"); String data = n.getNodeValue(); int len = data.length(); if (len != 0 && data.charAt(len - 1) == '-' || data.indexOf("--") != -1) { throw new IOException("Unserializable comment node"); } w.write(data); w.write("-->"); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType dt = (DocumentType)n; w.write("<!DOCTYPE " + n.getOwnerDocument().getDocumentElement().getNodeName()); String pubID = dt.getPublicId(); if (pubID != null) { char q = getUsableQuote(pubID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } w.write(" PUBLIC " + q + pubID + q); } String sysID = dt.getSystemId(); if (sysID != null) { char q = getUsableQuote(sysID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } if (pubID == null) { w.write(" SYSTEM"); } w.write(" " + q + sysID + q); } String subset = dt.getInternalSubset(); if (subset != null) { w.write('[' + subset + ']'); } w.write('>'); break; } default: throw new IOException("Unknown DOM node type " + n.getNodeType()); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static String assertValidCharacters(String s, boolean isXML11) throws IOException { int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } } return s; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static String contentToString(String s, boolean isXML11) throws IOException { StringBuffer result = new StringBuffer(s.length()); int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; default: result.append(c); } } return result.toString(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(String ns, String root, String uri, InputSource is) throws IOException { Document ret = createDocument(is); Element docElem = ret.getDocumentElement(); String lname = root; String nsURI = ns; if (ns == null) { int idx = lname.indexOf(':'); String nsp = (idx == -1 || idx == lname.length()-1) ? "" : lname.substring(0, idx); nsURI = namespaces.get(nsp); if (idx != -1 && idx != lname.length()-1) { lname = lname.substring(idx+1); } } String docElemNS = docElem.getNamespaceURI(); if ((docElemNS != nsURI) && ((docElemNS == null) || (!docElemNS.equals(nsURI)))) throw new IOException ("Root element namespace does not match that requested:\n" + "Requested: " + nsURI + "\n" + "Found: " + docElemNS); if (docElemNS != null) { if (!docElem.getLocalName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getLocalName()); } else { if (!docElem.getNodeName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getNodeName()); } return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void reset() throws IOException { throw new IOException("Reset unsupported"); }
// in sources/org/apache/batik/util/ParsedURLData.java
protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { if (stream != null) return stream; hasBeenOpened = true; URL url = null; try { url = buildURL(); } catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); } if (url == null) return null; URLConnection urlC = url.openConnection(); if (urlC instanceof HttpURLConnection) { if (userAgent != null) urlC.setRequestProperty(HTTP_USER_AGENT_HEADER, userAgent); if (mimeTypes != null) { String acceptHeader = ""; while (mimeTypes.hasNext()) { acceptHeader += mimeTypes.next(); if (mimeTypes.hasNext()) acceptHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_HEADER, acceptHeader); } if (encodingTypes != null) { String encodingHeader = ""; while (encodingTypes.hasNext()) { encodingHeader += encodingTypes.next(); if (encodingTypes.hasNext()) encodingHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_ENCODING_HEADER, encodingHeader); } contentType = urlC.getContentType(); contentEncoding = urlC.getContentEncoding(); postConnectionURL = urlC.getURL(); } try { return (stream = urlC.getInputStream()); } catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void charError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("invalid.char", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void endOfStreamError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("end.of.stream", new Object[] { encoding })); }
4
            
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
518
            
// in sources/org/apache/batik/apps/svgbrowser/WindowsAltFileSystemView.java
public File createNewFolder(File containingDir) throws IOException { if(containingDir == null) { throw new IOException(Resources.getString(EXCEPTION_CONTAINING_DIR_NULL)); } File newFolder = null; // Using NT's default folder name newFolder = createFileObject(containingDir, Resources.getString(NEW_FOLDER_NAME)); int i = 2; while (newFolder.exists() && (i < 100)) { newFolder = createFileObject (containingDir, Resources.getString(NEW_FOLDER_NAME) + " (" + i + ')' ); i++; } if(newFolder.exists()) { throw new IOException (Resources.formatMessage(EXCEPTION_DIRECTORY_ALREADY_EXISTS, new Object[]{newFolder.getAbsolutePath()})); } else { newFolder.mkdirs(); } return newFolder; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public SquiggleInputHandler getInputHandler(ParsedURL purl) throws IOException { Iterator iter = getHandlers().iterator(); SquiggleInputHandler handler = null; while (iter.hasNext()) { SquiggleInputHandler curHandler = (SquiggleInputHandler)iter.next(); if (curHandler.accept(purl)) { handler = curHandler; break; } } // No handler found, use the default one. if (handler == null) { handler = defaultHandler; } return handler; }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
public void installCustomPolicyFile() throws IOException { String securityPolicyProperty = System.getProperty(PROPERTY_JAVA_SECURITY_POLICY); if (overrideSecurityPolicy || securityPolicyProperty == null || "".equals(securityPolicyProperty)) { // Access default policy file ParsedURL policyURL = new ParsedURL(securityEnforcer.getPolicyURL()); // Override the user policy String dir = System.getProperty(PROPERTY_USER_HOME); File batikConfigDir = new File(dir, BATIK_CONFIGURATION_SUBDIRECTORY); File policyFile = new File(batikConfigDir, SQUIGGLE_POLICY_FILE); // Copy original policy file into local policy file Reader r = new BufferedReader(new InputStreamReader(policyURL.openStream())); Writer w = new FileWriter(policyFile); char[] buf = new char[1024]; int n = 0; while ( (n=r.read(buf, 0, buf.length)) != -1 ) { w.write(buf, 0, n); } r.close(); // Now, append additional grants depending on the security // settings boolean grantScriptNetworkAccess = preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_NETWORK_ACCESS); boolean grantScriptFileAccess = preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_GRANT_SCRIPT_FILE_ACCESS); if (grantScriptNetworkAccess) { w.write(POLICY_GRANT_SCRIPT_NETWORK_ACCESS); } if (grantScriptFileAccess) { w.write(POLICY_GRANT_SCRIPT_FILE_ACCESS); } w.close(); // We now use the JAVA_SECURITY_POLICY property, so // we allow override on subsequent calls. overrideSecurityPolicy = true; System.setProperty(PROPERTY_JAVA_SECURITY_POLICY, policyFile.toURL().toString()); } }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
private void setPreferences() throws IOException { Iterator it = viewerFrames.iterator(); while (it.hasNext()) { setPreferences((JSVGViewerFrame)it.next()); } System.setProperty("proxyHost", preferenceManager.getString (PreferenceDialog.PREFERENCE_KEY_PROXY_HOST)); System.setProperty("proxyPort", preferenceManager.getString (PreferenceDialog.PREFERENCE_KEY_PROXY_PORT)); installCustomPolicyFile(); securityEnforcer.enforceSecurity (preferenceManager.getBoolean (PreferenceDialog.PREFERENCE_KEY_ENFORCE_SECURE_SCRIPTING) ); }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
public synchronized void load(InputStream is) throws IOException { BufferedReader r; r = new BufferedReader(new InputStreamReader(is, PREFERENCE_ENCODING)); DocumentFactory df = new SAXDocumentFactory (GenericDOMImplementation.getDOMImplementation(), xmlParserClassName); Document doc = df.createDocument("http://xml.apache.org/batik/preferences", "preferences", null, r); Element elt = doc.getDocumentElement(); for (Node n = elt.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { if (n.getNodeName().equals("property")) { String name = ((Element)n).getAttributeNS(null, "name"); StringBuffer cont = new StringBuffer(); for (Node c = n.getFirstChild(); c != null; c = c.getNextSibling()) { if (c.getNodeType() == Node.TEXT_NODE) { cont.append(c.getNodeValue()); } else { break; } } String val = cont.toString(); put(name, val); } } } }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
public synchronized void store(OutputStream os, String header) throws IOException { BufferedWriter w; w = new BufferedWriter(new OutputStreamWriter(os, PREFERENCE_ENCODING)); Map m = new HashMap(); enumerate(m); w.write("<preferences xmlns=\"http://xml.apache.org/batik/preferences\">\n"); Iterator it = m.keySet().iterator(); while (it.hasNext()) { String n = (String)it.next(); String v = (String)m.get(n); w.write("<property name=\"" + n + "\">"); try { w.write(DOMUtilities.contentToString(v, false)); } catch (IOException ex) { // unlikely to happen } w.write("</property>\n"); } w.write("</preferences>\n"); w.flush(); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterURLSource.java
public InputStream openStream() throws IOException { return purl.openStream(); }
// in sources/org/apache/batik/svggen/CachedImageHandlerBase64Encoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { Base64EncoderStream b64Encoder = new Base64EncoderStream(os); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, b64Encoder); b64Encoder.close(); }
// in sources/org/apache/batik/svggen/CachedImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); }
// in sources/org/apache/batik/svggen/CachedImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); }
// in sources/org/apache/batik/svggen/font/table/ClassDef.java
protected static ClassDef read(RandomAccessFile raf) throws IOException { ClassDef c = null; int format = raf.readUnsignedShort(); if (format == 1) { c = new ClassDefFormat1(raf); } else if (format == 2) { c = new ClassDefFormat2(raf); } return c; }
// in sources/org/apache/batik/svggen/font/table/TableFactory.java
public static Table create(DirectoryEntry de, RandomAccessFile raf) throws IOException { Table t = null; switch (de.getTag()) { case Table.BASE: break; case Table.CFF: break; case Table.DSIG: break; case Table.EBDT: break; case Table.EBLC: break; case Table.EBSC: break; case Table.GDEF: break; case Table.GPOS: t = new GposTable(de, raf); break; case Table.GSUB: t = new GsubTable(de, raf); break; case Table.JSTF: break; case Table.LTSH: break; case Table.MMFX: break; case Table.MMSD: break; case Table.OS_2: t = new Os2Table(de, raf); break; case Table.PCLT: break; case Table.VDMX: break; case Table.cmap: t = new CmapTable(de, raf); break; case Table.cvt: t = new CvtTable(de, raf); break; case Table.fpgm: t = new FpgmTable(de, raf); break; case Table.fvar: break; case Table.gasp: break; case Table.glyf: t = new GlyfTable(de, raf); break; case Table.hdmx: break; case Table.head: t = new HeadTable(de, raf); break; case Table.hhea: t = new HheaTable(de, raf); break; case Table.hmtx: t = new HmtxTable(de, raf); break; case Table.kern: t = new KernTable(de, raf); break; case Table.loca: t = new LocaTable(de, raf); break; case Table.maxp: t = new MaxpTable(de, raf); break; case Table.name: t = new NameTable(de, raf); break; case Table.prep: t = new PrepTable(de, raf); break; case Table.post: t = new PostTable(de, raf); break; case Table.vhea: break; case Table.vmtx: break; } return t; }
// in sources/org/apache/batik/svggen/font/table/Coverage.java
protected static Coverage read(RandomAccessFile raf) throws IOException { Coverage c = null; int format = raf.readUnsignedShort(); if (format == 1) { c = new CoverageFormat1(raf); } else if (format == 2) { c = new CoverageFormat2(raf); } return c; }
// in sources/org/apache/batik/svggen/font/table/Program.java
protected void readInstructions(RandomAccessFile raf, int count) throws IOException { instructions = new short[count]; for (int i = 0; i < count; i++) { instructions[i] = (short) raf.readUnsignedByte(); } }
// in sources/org/apache/batik/svggen/font/table/GsubTable.java
public LookupSubtable read(int type, RandomAccessFile raf, int offset) throws IOException { LookupSubtable s = null; switch (type) { case 1: s = SingleSubst.read(raf, offset); break; case 2: // s = MultipleSubst.read(raf, offset); break; case 3: // s = AlternateSubst.read(raf, offset); break; case 4: s = LigatureSubst.read(raf, offset); break; case 5: // s = ContextSubst.read(raf, offset); break; case 6: // s = ChainingSubst.read(raf, offset); break; } return s; }
// in sources/org/apache/batik/svggen/font/table/CmapFormat.java
protected static CmapFormat create(int format, RandomAccessFile raf) throws IOException { switch(format) { case 0: return new CmapFormat0(raf); case 2: return new CmapFormat2(raf); case 4: return new CmapFormat4(raf); case 6: return new CmapFormat6(raf); } return null; }
// in sources/org/apache/batik/svggen/font/table/NameRecord.java
protected void loadString(RandomAccessFile raf, int stringStorageOffset) throws IOException { StringBuffer sb = new StringBuffer(); raf.seek(stringStorageOffset + stringOffset); if (platformId == Table.platformAppleUnicode) { // Unicode (big-endian) for (int i = 0; i < stringLength/2; i++) { sb.append(raf.readChar()); } } else if (platformId == Table.platformMacintosh) { // Macintosh encoding, ASCII for (int i = 0; i < stringLength; i++) { sb.append((char) raf.readByte()); } } else if (platformId == Table.platformISO) { // ISO encoding, ASCII for (int i = 0; i < stringLength; i++) { sb.append((char) raf.readByte()); } } else if (platformId == Table.platformMicrosoft) { // Microsoft encoding, Unicode char c; for (int i = 0; i < stringLength/2; i++) { c = raf.readChar(); sb.append(c); } } record = sb.toString(); }
// in sources/org/apache/batik/svggen/font/table/SingleSubst.java
public static SingleSubst read(RandomAccessFile raf, int offset) throws IOException { SingleSubst s = null; raf.seek(offset); int format = raf.readUnsignedShort(); if (format == 1) { s = new SingleSubstFormat1(raf, offset); } else if (format == 2) { s = new SingleSubstFormat2(raf, offset); } return s; }
// in sources/org/apache/batik/svggen/font/table/KernSubtable.java
public static KernSubtable read(RandomAccessFile raf) throws IOException { KernSubtable table = null; /* int version =*/ raf.readUnsignedShort(); /* int length =*/ raf.readUnsignedShort(); int coverage = raf.readUnsignedShort(); int format = coverage >> 8; switch (format) { case 0: table = new KernSubtableFormat0(raf); break; case 2: table = new KernSubtableFormat2(raf); break; default: break; } return table; }
// in sources/org/apache/batik/svggen/font/table/LigatureSubst.java
public static LigatureSubst read(RandomAccessFile raf, int offset) throws IOException { LigatureSubst ls = null; raf.seek(offset); int format = raf.readUnsignedShort(); if (format == 1) { ls = new LigatureSubstFormat1(raf, offset); } return ls; }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void printIndent() throws IOException{ proxied.write(EOL); int temp = indentLevel; while(temp > 0){ if (temp > SPACES_LEN) { proxied.write(SPACES, 0, SPACES_LEN); temp -= SPACES_LEN; } else { proxied.write(SPACES, 0, temp); break; } } column = indentLevel; }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(int c) throws IOException { column++; proxied.write(c); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(char[] cbuf) throws IOException { column+=cbuf.length; proxied.write(cbuf); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(char[] cbuf, int off, int len) throws IOException{ column+=len; proxied.write(cbuf, off, len); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(String str) throws IOException { column+=str.length(); proxied.write(str); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void write(String str, int off, int len) throws IOException { column+=len; proxied.write(str, off, len); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void flush() throws IOException{ proxied.flush(); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public void close() throws IOException{ column = -1; proxied.close(); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Attr attr, IndentWriter out, boolean escaped) throws IOException{ String name = attr.getName(); out.write (name); out.write ("=\""); writeChildrenXml(attr, out, escaped); out.write ('"'); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Attr attr, IndentWriter out, boolean escaped) throws IOException { char[] data = attr.getValue().toCharArray(); if (data == null) return; int length = data.length; int start=0, last=0; while (last < length) { char c = data[last]; switch (c) { case '<': out.write (data, start, last - start); start = last + 1; out.write ("&lt;"); break; case '>': out.write (data, start, last - start); start = last + 1; out.write ("&gt;"); break; case '&': out.write (data, start, last - start); start = last + 1; out.write ("&amp;"); break; case '"': out.write (data, start, last - start); start = last + 1; out.write ("&quot;"); break; default: // to be able to escape characters if allowed if (escaped && (c > 0x007F)) { out.write (data, start, last - start); String hex = "0000"+Integer.toHexString(c); out.write("&#x"+hex.substring(hex.length()-4)+";"); start = last + 1; } break; } last++; } out.write (data, start, last - start); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Comment comment, IndentWriter out, boolean escaped) throws IOException { char[] data = comment.getData().toCharArray(); if (data == null) { out.write("<!---->"); return; } out.write ("<!--"); boolean sawDash = false; int length = data.length; int start=0, last=0; // "--" illegal in comments, insert a space. while (last < length) { char c = data[last]; if (c == '-') { if (sawDash) { out.write (data, start, last - start); start = last; out.write (' '); } sawDash = true; } else { sawDash = false; } last++; } out.write (data, start, last - start); if (sawDash) out.write (' '); out.write ("-->"); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Text text, IndentWriter out, boolean escaped) throws IOException { writeXml(text, out, false, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Text text, IndentWriter out, boolean trimWS, boolean escaped) throws IOException { char[] data = text.getData().toCharArray(); // XXX saw this once -- being paranoid if (data == null) { System.err.println ("Null text data??"); return; } int length = data.length; int start = 0, last = 0; if (trimWS) { while (last < length) { char c = data[last]; switch (c) { case ' ': case '\t': case '\n': case '\r': last++; continue; default: break; } break; } start = last; } while (last < length) { char c = data [last]; // escape markup delimiters only ... and do bulk // writes wherever possible, for best performance // // note that character data can't have the CDATA // termination "]]>"; escaping ">" suffices, and // doing it very generally helps simple parsers // that may not be quite correct. // switch(c) { case ' ': case '\t': case '\n': case '\r': if (trimWS) { int wsStart = last; last++; while (last < length) { switch(data[last]) { case ' ': case '\t': case '\n': case '\r': last++; continue; default: break; } break; } if (last == length) { out.write(data, start, wsStart-start); return; } else { continue; } } break; case '<': // not legal in char data out.write (data, start, last - start); start = last + 1; out.write ("&lt;"); break; case '>': // see above out.write (data, start, last - start); start = last + 1; out.write ("&gt;"); break; case '&': // not legal in char data out.write (data, start, last - start); start = last + 1; out.write ("&amp;"); break; default: // to be able to escape characters if allowed if (escaped && (c > 0x007F)) { out.write (data, start, last - start); String hex = "0000"+Integer.toHexString(c); out.write("&#x"+hex.substring(hex.length()-4)+";"); start = last + 1; } break; } last++; } out.write (data, start, last - start); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(CDATASection cdataSection, IndentWriter out, boolean escaped) throws IOException { char[] data = cdataSection.getData().toCharArray(); if (data == null) { out.write ("<![CDATA[]]>"); return; } out.write ("<![CDATA["); int length = data.length; int start = 0, last = 0; while (last < length) { char c = data [last]; // embedded "]]>" needs to be split into adjacent // CDATA blocks ... can be split at either point if (c == ']') { if (((last + 2) < data.length) && (data [last + 1] == ']') && (data [last + 2] == '>')) { out.write (data, start, last - start); start = last + 1; out.write ("]]]]><![CDATA[>"); continue; } } last++; } out.write (data, start, last - start); out.write ("]]>"); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { out.write (TAG_START, 0, 1); // "<" out.write (element.getTagName()); NamedNodeMap attributes = element.getAttributes(); if (attributes != null){ int nAttr = attributes.getLength(); for(int i=0; i<nAttr; i++){ Attr attr = (Attr)attributes.item(i); out.write(' '); writeXml(attr, out, escaped); } } boolean lastElem = (element.getParentNode().getLastChild()==element); // // Write empty nodes as "<EMPTY />" to make sure version 3 // and 4 web browsers can read empty tag output as HTML. // XML allows "<EMPTY/>" too, of course. // if (!element.hasChildNodes()) { if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write(TAG_END, 0, 2); // "/>" return; } Node child = element.getFirstChild(); out.printIndent (); out.write(TAG_END, 1, 1); // ">" if ((child.getNodeType() != Node.TEXT_NODE) || (element.getLastChild() != child)) { // one text node child.. out.setIndentLevel(out.getIndentLevel()+2); } writeChildrenXml(element, out, escaped); out.write (TAG_START, 0, 2); // "</" out.write (element.getTagName()); if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write (TAG_END, 1, 1); // ">" }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { Node child = element.getFirstChild(); while (child != null) { writeXml(child, out, escaped); child = child.getNextSibling(); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeDocumentHeader(IndentWriter out) throws IOException { String encoding = null; if (out.getProxied() instanceof OutputStreamWriter) { OutputStreamWriter osw = (OutputStreamWriter)out.getProxied(); encoding = java2std(osw.getEncoding()); } out.write ("<?xml version=\"1.0\""); if (encoding != null) { out.write (" encoding=\""); out.write (encoding); out.write ('\"'); } out.write ("?>"); out.write (EOL); // Write DOCTYPE declaration here. Skip until specification is released. out.write ("<!DOCTYPE svg PUBLIC '"); out.write (SVG_PUBLIC_ID); out.write ("'"); out.write (EOL); out.write (" '"); out.write (SVG_SYSTEM_ID); out.write ("'"); out.write (">"); out.write (EOL); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Document document, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { writeDocumentHeader(out); NodeList childList = document.getChildNodes(); writeXml(childList, out, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(NodeList childList, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { int length = childList.getLength (); if (length == 0) return; for (int i = 0; i < length; i++) { Node child = childList.item(i); writeXml(child, out, escaped); out.write (EOL); } }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, ""); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(Reader scriptreader, String description) throws IOException { // oops jacl doesn't accept reader in its eval method :-( StringBuffer sbuffer = new StringBuffer(); char[] buffer = new char[1024]; int val = 0; while ((val = scriptreader.read(buffer)) != -1) { sbuffer.append(buffer, 0, val); } String str = sbuffer.toString(); return evaluate(str); }
// in sources/org/apache/batik/script/ImportInfo.java
public void addImports(URL src) throws IOException { InputStream is = null; Reader r = null; BufferedReader br = null; try { is = src.openStream(); r = new InputStreamReader(is, "UTF-8"); br = new BufferedReader(r); String line; while ((line = br.readLine()) != null) { // First strip any comment... int idx = line.indexOf('#'); if (idx != -1) line = line.substring(0, idx); // Trim whitespace. line = line.trim(); // If nothing left then loop around... if (line.length() == 0) continue; // Line must start with 'class ' or 'package '. idx = line.indexOf(' '); if (idx == -1) continue; String prefix = line.substring(0,idx); line = line.substring(idx+1); boolean isPackage = packageStr.equals(prefix); boolean isClass = classStr.equals(prefix); if (!isPackage && !isClass) continue; while (line.length() != 0) { idx = line.indexOf(' '); String id; if (idx == -1) { id = line; line = ""; } else { id = line.substring(0, idx); line = line.substring(idx+1); } if (id.length() == 0) continue; if (isClass) addClass(id); else addPackage(id); } } } finally { // close and release all io-resources to avoid leaks if ( is != null ){ try { is.close(); } catch ( IOException ignored ){} is = null; } if ( r != null ){ try{ r.close(); } catch ( IOException ignored ){} r = null; } if ( br == null ){ try{ br.close(); } catch ( IOException ignored ){} br = null; } } }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, ""); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(Reader scriptreader, String description) throws IOException { // oups jpython doesn't accept reader in its eval method :-( StringBuffer sbuffer = new StringBuffer(); char[] buffer = new char[1024]; int val = 0; while ((val = scriptreader.read(buffer)) != -1) { sbuffer.append(buffer,0, val); } String str = sbuffer.toString(); return evaluate(str); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(Reader scriptreader) throws IOException { return evaluate(scriptreader, SOURCE_NAME_SVG); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final Reader scriptReader, final String description) throws IOException { ContextAction evaluateAction = new ContextAction() { public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } } }; try { return contextFactory.call(evaluateAction); } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (InterruptedBridgeException ibe) { throw ibe; } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public TIFFDirectory getPrivateIFD(long offset) throws IOException { return new TIFFDirectory(stream, offset, 0); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
public void encode(RenderedImage im) throws IOException { // Write the file header (8 bytes). writeFileHeader(); // Get the encoding parameters. TIFFEncodeParam encodeParam = (TIFFEncodeParam)param; Iterator iter = encodeParam.getExtraImages(); if(iter != null) { int ifdOffset = 8; RenderedImage nextImage = im; TIFFEncodeParam nextParam = encodeParam; boolean hasNext; do { hasNext = iter.hasNext(); ifdOffset = encode(nextImage, nextParam, ifdOffset, !hasNext); if(hasNext) { Object obj = iter.next(); if(obj instanceof RenderedImage) { nextImage = (RenderedImage)obj; nextParam = encodeParam; } else if(obj instanceof Object[]) { Object[] o = (Object[])obj; nextImage = (RenderedImage)o[0]; nextParam = (TIFFEncodeParam)o[1]; } } } while(hasNext); } else { encode(im, encodeParam, 8, true); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeFileHeader() throws IOException { // 8 byte image file header // Byte order used within the file - Big Endian output.write('M'); output.write('M'); // Magic value output.write(0); output.write(42); // Offset in bytes of the first IFD. writeLong(8); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeDirectory(int thisIFDOffset, SortedSet fields, int nextIFDOffset) throws IOException { // 2 byte count of number of directory entries (fields) int numEntries = fields.size(); long offsetBeyondIFD = thisIFDOffset + 12 * numEntries + 4 + 2; List tooBig = new ArrayList(); // Write number of fields in the IFD writeUnsignedShort(numEntries); Iterator iter = fields.iterator(); while(iter.hasNext()) { // 12 byte field entry TIFFField TIFFField field = (TIFFField)iter.next(); // byte 0-1 Tag that identifies a field int tag = field.getTag(); writeUnsignedShort(tag); // byte 2-3 The field type int type = field.getType(); writeUnsignedShort(type); // bytes 4-7 the number of values of the indicated type except // ASCII-valued fields which require the total number of bytes. int count = field.getCount(); int valueSize = getValueSize(field); writeLong(type == TIFFField.TIFF_ASCII ? valueSize : count); // bytes 8 - 11 the value or value offset if (valueSize > 4) { // We need an offset as data won't fit into 4 bytes writeLong(offsetBeyondIFD); offsetBeyondIFD += valueSize; tooBig.add(field); } else { writeValuesAsFourBytes(field); } } // Address of next IFD writeLong(nextIFDOffset); // Write the tag values that did not fit into 4 bytes for (int i = 0; i < tooBig.size(); i++) { writeValues((TIFFField)tooBig.get(i)); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValuesAsFourBytes(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: byte[] bytes = field.getAsBytes(); if (count > 4) count =4; for (int i=0; i<count; i++) output.write(bytes[i]); for (int i = 0; i < (4 - count); i++) output.write(0); break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); if (count > 2) count=2; for (int i=0; i<count; i++) writeUnsignedShort(chars[i]); for (int i = 0; i < (2 - count); i++) writeUnsignedShort(0); break; // unsigned 32 bits case TIFFField.TIFF_LONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeValues(TIFFField field) throws IOException { int dataType = field.getType(); int count = field.getCount(); switch (dataType) { // unsigned 8 bits case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: byte[] bytes = field.getAsBytes(); for (int i=0; i<count; i++) { output.write(bytes[i]); } break; // unsigned 16 bits case TIFFField.TIFF_SHORT: char[] chars = field.getAsChars(); for (int i=0; i<count; i++) { writeUnsignedShort(chars[i]); } break; case TIFFField.TIFF_SSHORT: short[] shorts = field.getAsShorts(); for (int i=0; i<count; i++) { writeUnsignedShort(shorts[i]); } break; // unsigned 32 bits case TIFFField.TIFF_LONG: case TIFFField.TIFF_SLONG: long[] longs = field.getAsLongs(); for (int i=0; i<count; i++) { writeLong(longs[i]); } break; case TIFFField.TIFF_FLOAT: float[] floats = field.getAsFloats(); for (int i=0; i<count; i++) { int intBits = Float.floatToIntBits(floats[i]); writeLong(intBits); } break; case TIFFField.TIFF_DOUBLE: double[] doubles = field.getAsDoubles(); for (int i=0; i<count; i++) { long longBits = Double.doubleToLongBits(doubles[i]); writeLong(longBits >>> 32); // write upper 32 bits writeLong(longBits & 0xffffffffL); // write lower 32 bits } break; case TIFFField.TIFF_RATIONAL: case TIFFField.TIFF_SRATIONAL: long[][] rationals = field.getAsRationals(); for (int i=0; i<count; i++) { writeLong(rationals[i][0]); writeLong(rationals[i][1]); } break; case TIFFField.TIFF_ASCII: for (int i=0; i<count; i++) { byte[] stringBytes = field.getAsString(i).getBytes(); output.write(stringBytes); if(stringBytes[stringBytes.length-1] != (byte)0) { output.write((byte)0); } } break; default: throw new Error("TIFFImageEncoder10"); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeUnsignedShort(int s) throws IOException { output.write((s & 0xff00) >>> 8); output.write( s & 0x00ff); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private void writeLong(long l) throws IOException { output.write( (int)((l & 0xff000000) >>> 24)); output.write( (int)((l & 0x00ff0000) >>> 16)); output.write( (int)((l & 0x0000ff00) >>> 8)); output.write( (int) (l & 0x000000ff) ); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private long getOffset(OutputStream out) throws IOException { if(out instanceof ByteArrayOutputStream) { return ((ByteArrayOutputStream)out).size(); } else if(out instanceof SeekableOutputStream) { return ((SeekableOutputStream)out).getFilePointer(); } else { // Shouldn't happen. throw new IllegalStateException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private void initialize(SeekableStream stream) throws IOException { long nextTagOffset; int i, j; IFDOffset = stream.getFilePointer(); numEntries = readUnsignedShort(stream); fields = new TIFFField[numEntries]; for (i = 0; i < numEntries; i++) { int tag = readUnsignedShort(stream); int type = readUnsignedShort(stream); int count = (int)(readUnsignedInt(stream)); int value = 0; // The place to return to to read the next tag nextTagOffset = stream.getFilePointer() + 4; try { // If the tag data can't fit in 4 bytes, the next 4 bytes // contain the starting offset of the data if (count*sizeOfType[type] > 4) { value = (int)(readUnsignedInt(stream)); stream.seek(value); } } catch (ArrayIndexOutOfBoundsException ae) { System.err.println(tag + " " + "TIFFDirectory4"); // if the data type is unknown we should skip this TIFF Field stream.seek(nextTagOffset); continue; } fieldIndex.put(new Integer(tag), new Integer(i)); Object obj = null; switch (type) { case TIFFField.TIFF_BYTE: case TIFFField.TIFF_SBYTE: case TIFFField.TIFF_UNDEFINED: case TIFFField.TIFF_ASCII: byte[] bvalues = new byte[count]; stream.readFully(bvalues, 0, count); if (type == TIFFField.TIFF_ASCII) { // Can be multiple strings int index = 0, prevIndex = 0; List v = new ArrayList(); while (index < count) { while ((index < count) && (bvalues[index++] != 0)); // When we encountered zero, means one string has ended v.add(new String(bvalues, prevIndex, (index - prevIndex)) ); prevIndex = index; } count = v.size(); String[] strings = new String[count]; v.toArray( strings ); obj = strings; } else { obj = bvalues; } break; case TIFFField.TIFF_SHORT: char[] cvalues = new char[count]; for (j = 0; j < count; j++) { cvalues[j] = (char)(readUnsignedShort(stream)); } obj = cvalues; break; case TIFFField.TIFF_LONG: long[] lvalues = new long[count]; for (j = 0; j < count; j++) { lvalues[j] = readUnsignedInt(stream); } obj = lvalues; break; case TIFFField.TIFF_RATIONAL: long[][] llvalues = new long[count][2]; for (j = 0; j < count; j++) { llvalues[j][0] = readUnsignedInt(stream); llvalues[j][1] = readUnsignedInt(stream); } obj = llvalues; break; case TIFFField.TIFF_SSHORT: short[] svalues = new short[count]; for (j = 0; j < count; j++) { svalues[j] = readShort(stream); } obj = svalues; break; case TIFFField.TIFF_SLONG: int[] ivalues = new int[count]; for (j = 0; j < count; j++) { ivalues[j] = readInt(stream); } obj = ivalues; break; case TIFFField.TIFF_SRATIONAL: int[][] iivalues = new int[count][2]; for (j = 0; j < count; j++) { iivalues[j][0] = readInt(stream); iivalues[j][1] = readInt(stream); } obj = iivalues; break; case TIFFField.TIFF_FLOAT: float[] fvalues = new float[count]; for (j = 0; j < count; j++) { fvalues[j] = readFloat(stream); } obj = fvalues; break; case TIFFField.TIFF_DOUBLE: double[] dvalues = new double[count]; for (j = 0; j < count; j++) { dvalues[j] = readDouble(stream); } obj = dvalues; break; default: System.err.println("TIFFDirectory0"); break; } fields[i] = new TIFFField(tag, type, count, obj); stream.seek(nextTagOffset); } // Read the offset of the next IFD. nextIFDOffset = readUnsignedInt(stream); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private short readShort(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readShort(); } else { return stream.readShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private int readUnsignedShort(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readUnsignedShort(); } else { return stream.readUnsignedShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private int readInt(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readInt(); } else { return stream.readIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private long readUnsignedInt(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readUnsignedInt(); } else { return stream.readUnsignedIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private long readLong(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readLong(); } else { return stream.readLongLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private float readFloat(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readFloat(); } else { return stream.readFloatLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private double readDouble(SeekableStream stream) throws IOException { if (isBigEndian) { return stream.readDouble(); } else { return stream.readDoubleLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private static int readUnsignedShort(SeekableStream stream, boolean isBigEndian) throws IOException { if (isBigEndian) { return stream.readUnsignedShort(); } else { return stream.readUnsignedShortLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
private static long readUnsignedInt(SeekableStream stream, boolean isBigEndian) throws IOException { if (isBigEndian) { return stream.readUnsignedInt(); } else { return stream.readUnsignedIntLE(); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
public static int getNumDirectories(SeekableStream stream) throws IOException{ long pointer = stream.getFilePointer(); // Save stream pointer stream.seek(0L); int endian = stream.readUnsignedShort(); if (!isValidEndianTag(endian)) { throw new IllegalArgumentException("TIFFDirectory1"); } boolean isBigEndian = (endian == 0x4d4d); int magic = readUnsignedShort(stream, isBigEndian); if (magic != 42) { throw new IllegalArgumentException("TIFFDirectory2"); } stream.seek(4L); long offset = readUnsignedInt(stream, isBigEndian); int numDirectories = 0; while (offset != 0L) { ++numDirectories; stream.seek(offset); long entries = readUnsignedShort(stream, isBigEndian); stream.skip(12*entries); offset = readUnsignedInt(stream, isBigEndian); } stream.seek(pointer); // Reset stream pointer return numDirectories; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public int getNumPages() throws IOException { return TIFFDirectory.getNumDirectories(input); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if ((page < 0) || (page >= getNumPages())) { throw new IOException("TIFFImageDecoder0"); } return new TIFFImage(input, (TIFFDecodeParam)param, page); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out) throws IOException { writeImage(image, out, null); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { Iterator iter; iter = ImageIO.getImageWritersByMIMEType(getMIMEType()); javax.imageio.ImageWriter iiowriter = null; try { iiowriter = (javax.imageio.ImageWriter)iter.next(); if (iiowriter != null) { iiowriter.addIIOWriteWarningListener(this); ImageOutputStream imgout = null; try { imgout = ImageIO.createImageOutputStream(out); ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params); ImageTypeSpecifier type; if (iwParam.getDestinationType() != null) { type = iwParam.getDestinationType(); } else { type = ImageTypeSpecifier.createFromRenderedImage(image); } //Handle metadata IIOMetadata meta = iiowriter.getDefaultImageMetadata( type, iwParam); //meta might be null for some JAI codecs as they don't support metadata if (params != null && meta != null) { meta = updateMetadata(meta, params); } //Write image iiowriter.setOutput(imgout); IIOImage iioimg = new IIOImage(image, null, meta); iiowriter.write(null, iioimg, iwParam); } finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } } } else { throw new UnsupportedOperationException("No ImageIO codec for writing " + getMIMEType() + " is available!"); } } finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b) throws IOException { dos.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b, int off, int len) throws IOException { dos.write(b, off, len); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(int b) throws IOException { dos.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeBoolean(boolean v) throws IOException { dos.writeBoolean(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeByte(int v) throws IOException { dos.writeByte(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeBytes(String s) throws IOException { dos.writeBytes(s); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeChar(int v) throws IOException { dos.writeChar(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeChars(String s) throws IOException { dos.writeChars(s); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeDouble(double v) throws IOException { dos.writeDouble(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeFloat(float v) throws IOException { dos.writeFloat(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeInt(int v) throws IOException { dos.writeInt(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeLong(long v) throws IOException { dos.writeLong(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeShort(int v) throws IOException { dos.writeShort(v); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeUTF(String str) throws IOException { dos.writeUTF(str); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void writeToStream(DataOutputStream output) throws IOException { byte[] typeSignature = new byte[4]; typeSignature[0] = (byte)type.charAt(0); typeSignature[1] = (byte)type.charAt(1); typeSignature[2] = (byte)type.charAt(2); typeSignature[3] = (byte)type.charAt(3); dos.flush(); baos.flush(); byte[] data = baos.toByteArray(); int len = data.length; output.writeInt(len); output.write(typeSignature); output.write(data, 0, len); int crc = 0xffffffff; crc = CRC.updateCRC(crc, typeSignature, 0, 4); crc = CRC.updateCRC(crc, data, 0, len); output.writeInt(crc ^ 0xffffffff); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void close() throws IOException { if ( baos != null ) { baos.close(); baos = null; } if( dos != null ) { dos.close(); dos= null; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void close() throws IOException { flush(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeInt(int x) throws IOException { out.write(x >> 24); out.write((x >> 16) & 0xff); out.write((x >> 8) & 0xff); out.write(x & 0xff); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void flush() throws IOException { if (bytesWritten == 0) return; // Length writeInt(bytesWritten); // 'IDAT' signature out.write(typeSignature); // Data out.write(buffer, 0, bytesWritten); int crc = 0xffffffff; crc = CRC.updateCRC(crc, typeSignature, 0, 4); crc = CRC.updateCRC(crc, buffer, 0, bytesWritten); // CRC writeInt(crc ^ 0xffffffff); // Reset buffer bytesWritten = 0; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b) throws IOException { this.write(b, 0, b.length); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int bytes = Math.min(segmentLength - bytesWritten, len); System.arraycopy(b, off, buffer, bytesWritten, bytes); off += bytes; len -= bytes; bytesWritten += bytes; if (bytesWritten == segmentLength) { flush(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void write(int b) throws IOException { buffer[bytesWritten++] = (byte)b; if (bytesWritten == segmentLength) { flush(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeMagic() throws IOException { dataOutput.write(magic); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void encodePass(OutputStream os, Raster ras, int xOffset, int yOffset, int xSkip, int ySkip) throws IOException { int minX = ras.getMinX(); int minY = ras.getMinY(); int width = ras.getWidth(); int height = ras.getHeight(); xOffset *= numBands; xSkip *= numBands; int samplesPerByte = 8/bitDepth; int numSamples = width*numBands; int[] samples = new int[numSamples]; int pixels = (numSamples - xOffset + xSkip - 1)/xSkip; int bytesPerRow = pixels*numBands; if (bitDepth < 8) { bytesPerRow = (bytesPerRow + samplesPerByte - 1)/samplesPerByte; } else if (bitDepth == 16) { bytesPerRow *= 2; } if (bytesPerRow == 0) { return; } currRow = new byte[bytesPerRow + bpp]; prevRow = new byte[bytesPerRow + bpp]; filteredRows = new byte[5][bytesPerRow + bpp]; int maxValue = (1 << bitDepth) - 1; for (int row = minY + yOffset; row < minY + height; row += ySkip) { ras.getPixels(minX, row, width, 1, samples); if (compressGray) { int shift = 8 - bitDepth; for (int i = 0; i < width; i++) { samples[i] >>= shift; } } int count = bpp; // leave first 'bpp' bytes zero int pos = 0; int tmp = 0; switch (bitDepth) { case 1: case 2: case 4: // Image can only have a single band int mask = samplesPerByte - 1; for (int s = xOffset; s < numSamples; s += xSkip) { int val = clamp(samples[s] >> bitShift, maxValue); tmp = (tmp << bitDepth) | val; if (pos++ == mask) { currRow[count++] = (byte)tmp; tmp = 0; pos = 0; } } // Left shift the last byte if (pos != 0) { tmp <<= (samplesPerByte - pos)*bitDepth; currRow[count++] = (byte)tmp; } break; case 8: for (int s = xOffset; s < numSamples; s += xSkip) { for (int b = 0; b < numBands; b++) { currRow[count++] = (byte)clamp(samples[s + b] >> bitShift, maxValue); } } break; case 16: for (int s = xOffset; s < numSamples; s += xSkip) { for (int b = 0; b < numBands; b++) { int val = clamp(samples[s + b] >> bitShift, maxValue); currRow[count++] = (byte)(val >> 8); currRow[count++] = (byte)(val & 0xff); } } break; } // Perform filtering int filterType = param.filterRow(currRow, prevRow, filteredRows, bytesPerRow, bpp); os.write(filterType); os.write(filteredRows[filterType], bpp, bytesPerRow); // Swap current and previous rows byte[] swap = currRow; currRow = prevRow; prevRow = swap; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIDAT() throws IOException { IDATOutputStream ios = new IDATOutputStream(dataOutput, 8192); DeflaterOutputStream dos = new DeflaterOutputStream(ios, new Deflater(9)); // Future work - don't convert entire image to a Raster It // might seem that you could just call image.getData() but // 'BufferedImage.subImage' doesn't appear to set the Width // and height properly of the Child Raster, so the Raster // you get back here appears larger than it should. // This solves that problem by bounding the raster to the // image's bounds... Raster ras = image.getData(new Rectangle(image.getMinX(), image.getMinY(), image.getWidth(), image.getHeight())); // System.out.println("Image: [" + // image.getMinY() + ", " + // image.getMinX() + ", " + // image.getWidth() + ", " + // image.getHeight() + "]"); // System.out.println("Ras: [" + // ras.getMinX() + ", " + // ras.getMinY() + ", " + // ras.getWidth() + ", " + // ras.getHeight() + "]"); if (skipAlpha) { int numBands = ras.getNumBands() - 1; int[] bandList = new int[numBands]; for (int i = 0; i < numBands; i++) { bandList[i] = i; } ras = ras.createChild(0, 0, ras.getWidth(), ras.getHeight(), 0, 0, bandList); } if (interlace) { // Interlacing pass 1 encodePass(dos, ras, 0, 0, 8, 8); // Interlacing pass 2 encodePass(dos, ras, 4, 0, 8, 8); // Interlacing pass 3 encodePass(dos, ras, 0, 4, 4, 8); // Interlacing pass 4 encodePass(dos, ras, 2, 0, 4, 4); // Interlacing pass 5 encodePass(dos, ras, 0, 2, 2, 4); // Interlacing pass 6 encodePass(dos, ras, 1, 0, 2, 2); // Interlacing pass 7 encodePass(dos, ras, 0, 1, 1, 2); } else { encodePass(dos, ras, 0, 0, 1, 1); } dos.finish(); dos.close(); ios.flush(); ios.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeIEND() throws IOException { ChunkStream cs = new ChunkStream("IEND"); cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeCHRM() throws IOException { if (param.isChromaticitySet() || param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("cHRM"); float[] chroma; if (!param.isSRGBIntentSet()) { chroma = param.getChromaticity(); } else { chroma = srgbChroma; // SRGB chromaticities } for (int i = 0; i < 8; i++) { cs.writeInt((int)(chroma[i]*100000)); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeGAMA() throws IOException { if (param.isGammaSet() || param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("gAMA"); float gamma; if (!param.isSRGBIntentSet()) { gamma = param.getGamma(); } else { gamma = 1.0F/2.2F; // SRGB gamma } // TD should include the .5 but causes regard to say // everything is different. cs.writeInt((int)(gamma*100000/*+0.5*/)); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeICCP() throws IOException { if (param.isICCProfileDataSet()) { ChunkStream cs = new ChunkStream("iCCP"); byte[] ICCProfileData = param.getICCProfileData(); cs.write(ICCProfileData); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int i = 0; i < len; i++) { cs.writeByte(significantBits[i]); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSRGB() throws IOException { if (param.isSRGBIntentSet()) { ChunkStream cs = new ChunkStream("sRGB"); int intent = param.getSRGBIntent(); cs.write(intent); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeBKGD() throws IOException { if (param.isBackgroundSet()) { ChunkStream cs = new ChunkStream("bKGD"); switch (colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAY_ALPHA: int gray = ((PNGEncodeParam.Gray)param).getBackgroundGray(); cs.writeShort(gray); break; case PNG_COLOR_PALETTE: int index = ((PNGEncodeParam.Palette)param).getBackgroundPaletteIndex(); cs.writeByte(index); break; case PNG_COLOR_RGB: case PNG_COLOR_RGB_ALPHA: int[] rgb = ((PNGEncodeParam.RGB)param).getBackgroundRGB(); cs.writeShort(rgb[0]); cs.writeShort(rgb[1]); cs.writeShort(rgb[2]); break; } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeHIST() throws IOException { if (param.isPaletteHistogramSet()) { ChunkStream cs = new ChunkStream("hIST"); int[] hist = param.getPaletteHistogram(); for (int i = 0; i < hist.length; i++) { cs.writeShort(hist[i]); } cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTRNS() throws IOException { if (param.isTransparencySet() && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { ChunkStream cs = new ChunkStream("tRNS"); if (param instanceof PNGEncodeParam.Palette) { byte[] t = ((PNGEncodeParam.Palette)param).getPaletteTransparency(); for (int i = 0; i < t.length; i++) { cs.writeByte(t[i]); } } else if (param instanceof PNGEncodeParam.Gray) { int t = ((PNGEncodeParam.Gray)param).getTransparentGray(); cs.writeShort(t); } else if (param instanceof PNGEncodeParam.RGB) { int[] t = ((PNGEncodeParam.RGB)param).getTransparentRGB(); cs.writeShort(t[0]); cs.writeShort(t[1]); cs.writeShort(t[2]); } cs.writeToStream(dataOutput); cs.close(); } else if (colorType == PNG_COLOR_PALETTE) { int lastEntry = Math.min(255, alphaPalette.length - 1); int nonOpaque; for (nonOpaque = lastEntry; nonOpaque >= 0; nonOpaque--) { if (alphaPalette[nonOpaque] != (byte)255) { break; } } if (nonOpaque >= 0) { ChunkStream cs = new ChunkStream("tRNS"); for (int i = 0; i <= nonOpaque; i++) { cs.writeByte(alphaPalette[i]); } cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeSPLT() throws IOException { if (param.isSuggestedPaletteSet()) { ChunkStream cs = new ChunkStream("sPLT"); System.out.println("sPLT not supported yet."); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTIME() throws IOException { if (param.isModificationTimeSet()) { ChunkStream cs = new ChunkStream("tIME"); Date date = param.getModificationTime(); TimeZone gmt = TimeZone.getTimeZone("GMT"); GregorianCalendar cal = new GregorianCalendar(gmt); cal.setTime(date); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); cs.writeShort(year); cs.writeByte(month + 1); cs.writeByte(day); cs.writeByte(hour); cs.writeByte(minute); cs.writeByte(second); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeTEXT() throws IOException { if (param.isTextSet()) { String[] text = param.getText(); for (int i = 0; i < text.length/2; i++) { byte[] keyword = text[2*i].getBytes(); byte[] value = text[2*i + 1].getBytes(); ChunkStream cs = new ChunkStream("tEXt"); cs.write(keyword, 0, Math.min(keyword.length, 79)); cs.write(0); cs.write(value); cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writeZTXT() throws IOException { if (param.isCompressedTextSet()) { String[] text = param.getCompressedText(); for (int i = 0; i < text.length/2; i++) { byte[] keyword = text[2*i].getBytes(); byte[] value = text[2*i + 1].getBytes(); ChunkStream cs = new ChunkStream("zTXt"); cs.write(keyword, 0, Math.min(keyword.length, 79)); cs.write(0); cs.write(0); DeflaterOutputStream dos = new DeflaterOutputStream(cs); dos.write(value); dos.finish(); dos.close(); cs.writeToStream(dataOutput); cs.close(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
private void writePrivateChunks() throws IOException { int numChunks = param.getNumPrivateChunks(); for (int i = 0; i < numChunks; i++) { String type = param.getPrivateChunkType(i); byte[] data = param.getPrivateChunkData(i); ChunkStream cs = new ChunkStream(type); cs.write(data); cs.writeToStream(dataOutput); cs.close(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void encode(RenderedImage im) throws IOException { this.image = im; this.width = image.getWidth(); this.height = image.getHeight(); SampleModel sampleModel = image.getSampleModel(); int[] sampleSize = sampleModel.getSampleSize(); // Set bitDepth to a sentinel value this.bitDepth = -1; this.bitShift = 0; // Allow user to override the bit depth of gray images if (param instanceof PNGEncodeParam.Gray) { PNGEncodeParam.Gray paramg = (PNGEncodeParam.Gray)param; if (paramg.isBitDepthSet()) { this.bitDepth = paramg.getBitDepth(); } if (paramg.isBitShiftSet()) { this.bitShift = paramg.getBitShift(); } } // Get bit depth from image if not set in param if (this.bitDepth == -1) { // Get bit depth from channel 0 of the image this.bitDepth = sampleSize[0]; // Ensure all channels have the same bit depth for (int i = 1; i < sampleSize.length; i++) { if (sampleSize[i] != bitDepth) { throw new RuntimeException(); } } // Round bit depth up to a power of 2 if (bitDepth > 2 && bitDepth < 4) { bitDepth = 4; } else if (bitDepth > 4 && bitDepth < 8) { bitDepth = 8; } else if (bitDepth > 8 && bitDepth < 16) { bitDepth = 16; } else if (bitDepth > 16) { throw new RuntimeException(); } } this.numBands = sampleModel.getNumBands(); this.bpp = numBands*((bitDepth == 16) ? 2 : 1); ColorModel colorModel = image.getColorModel(); if (colorModel instanceof IndexColorModel) { if (bitDepth < 1 || bitDepth > 8) { throw new RuntimeException(); } if (sampleModel.getNumBands() != 1) { throw new RuntimeException(); } IndexColorModel icm = (IndexColorModel)colorModel; int size = icm.getMapSize(); redPalette = new byte[size]; greenPalette = new byte[size]; bluePalette = new byte[size]; alphaPalette = new byte[size]; icm.getReds(redPalette); icm.getGreens(greenPalette); icm.getBlues(bluePalette); icm.getAlphas(alphaPalette); this.bpp = 1; if (param == null) { param = createGrayParam(redPalette, greenPalette, bluePalette, alphaPalette); } // If param is still null, it can't be expressed as gray if (param == null) { param = new PNGEncodeParam.Palette(); } if (param instanceof PNGEncodeParam.Palette) { // If palette not set in param, create one from the ColorModel. PNGEncodeParam.Palette parami = (PNGEncodeParam.Palette)param; if (parami.isPaletteSet()) { int[] palette = parami.getPalette(); size = palette.length/3; int index = 0; for (int i = 0; i < size; i++) { redPalette[i] = (byte)palette[index++]; greenPalette[i] = (byte)palette[index++]; bluePalette[i] = (byte)palette[index++]; alphaPalette[i] = (byte)255; } } this.colorType = PNG_COLOR_PALETTE; } else if (param instanceof PNGEncodeParam.Gray) { redPalette = greenPalette = bluePalette = alphaPalette = null; this.colorType = PNG_COLOR_GRAY; } else { throw new RuntimeException(); } } else if (numBands == 1) { if (param == null) { param = new PNGEncodeParam.Gray(); } this.colorType = PNG_COLOR_GRAY; } else if (numBands == 2) { if (param == null) { param = new PNGEncodeParam.Gray(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 1; if ((sampleSize[0] == 8) && (bitDepth < 8)) { compressGray = true; } bpp = (bitDepth == 16) ? 2 : 1; this.colorType = PNG_COLOR_GRAY; } else { if (this.bitDepth < 8) { this.bitDepth = 8; } this.colorType = PNG_COLOR_GRAY_ALPHA; } } else if (numBands == 3) { if (param == null) { param = new PNGEncodeParam.RGB(); } this.colorType = PNG_COLOR_RGB; } else if (numBands == 4) { if (param == null) { param = new PNGEncodeParam.RGB(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 3; bpp = (bitDepth == 16) ? 6 : 3; this.colorType = PNG_COLOR_RGB; } else { this.colorType = PNG_COLOR_RGB_ALPHA; } } interlace = param.getInterlacing(); writeMagic(); writeIHDR(); writeCHRM(); writeGAMA(); writeICCP(); writeSBIT(); writeSRGB(); writePLTE(); writeHIST(); writeTRNS(); writeBKGD(); writePHYS(); writeSPLT(); writeTIME(); writeTEXT(); writeZTXT(); writePrivateChunks(); writeIDAT(); writeIEND(); dataOutput.flush(); dataOutput.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public RenderedImage decodeAsRenderedImage(int page) throws IOException { if (page != 0) { throw new IOException(PropertyUtil.getString("PNGImageDecoder19")); } return new PNGImage(input, (PNGDecodeParam)param); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java
public void writeImage(RenderedImage image, OutputStream out) throws IOException { writeImage(image, out, null); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { PNGImageEncoder encoder = new PNGImageEncoder(out, null); encoder.encode(image); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public int getNumPages() throws IOException { return 1; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public Raster decodeAsRaster() throws IOException { return decodeAsRaster(0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public Raster decodeAsRaster(int page) throws IOException { RenderedImage im = decodeAsRenderedImage(page); return im.getData(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageDecoderImpl.java
public RenderedImage decodeAsRenderedImage() throws IOException { return decodeAsRenderedImage(0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ImageEncoderImpl.java
public void encode(Raster ras, ColorModel cm) throws IOException { RenderedImage im = new SingleTileRenderedImage(ras, cm); encode(im); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(int b) throws IOException { file.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(byte[] b) throws IOException { file.write(b); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void write(byte[] b, int off, int len) throws IOException { file.write(b, off, len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void flush() throws IOException { file.getFD().sync(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void close() throws IOException { file.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public long getFilePointer() throws IOException { return file.getFilePointer(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableOutputStream.java
public void seek(long pos) throws IOException { file.seek(pos); }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
private long readUntil(long pos) throws IOException { // We've already got enough data cached if (pos < length) { return pos; } // pos >= length but length isn't getting any bigger, so return it if (foundEOS) { return length; } int sector = (int)(pos >> SECTOR_SHIFT); // First unread sector int startSector = length >> SECTOR_SHIFT; // Read sectors until the desired sector for (int i = startSector; i <= sector; i++) { byte[] buf = new byte[SECTOR_SIZE]; data.add(buf); // Read up to SECTOR_SIZE bytes int len = SECTOR_SIZE; int off = 0; while (len > 0) { int nbytes = src.read(buf, off, len); // Found the end-of-stream if (nbytes == -1) { foundEOS = true; return length; } off += nbytes; len -= nbytes; // Record new data length length += nbytes; } } return length; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("MemoryCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read() throws IOException { long next = pointer + 1; long pos = readUntil(next); if (pos >= next) { byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); return buf[(int)(pointer++ & SECTOR_MASK)] & 0xff; } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public synchronized void reset() throws IOException { if (markPos != -1) { seek(markPos); } }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b) throws IOException { readFully(b, 0, b.length); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final void readFully(byte[] b, int off, int len) throws IOException { int n = 0; do { int count = this.read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public int skipBytes(int n) throws IOException { if (n <= 0) { return 0; } return (int)skip(n); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final boolean readBoolean() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (ch != 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final byte readByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedByte() throws IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final short readShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShort() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 8) + (ch2 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readUnsignedShortLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch2 << 8) + (ch1 << 0); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readChar() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 8) + (ch2 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final char readCharLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readInt() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final int readIntLE() throws IOException { int ch1 = this.read(); int ch2 = this.read(); int ch3 = this.read(); int ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedInt() throws IOException { long ch1 = this.read(); long ch2 = this.read(); long ch3 = this.read(); long ch4 = this.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readUnsignedIntLE() throws IOException { this.readFully(ruileBuf); long ch1 = (ruileBuf[0] & 0xff); long ch2 = (ruileBuf[1] & 0xff); long ch3 = (ruileBuf[2] & 0xff); long ch4 = (ruileBuf[3] & 0xff); return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readLong() throws IOException { return ((long)(readInt()) << 32) + (readInt() & 0xFFFFFFFFL); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final long readLongLE() throws IOException { int i1 = readIntLE(); int i2 = readIntLE(); return ((long)i2 << 32) + (i1 & 0xFFFFFFFFL); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final float readFloatLE() throws IOException { return Float.intBitsToFloat(readIntLE()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final double readDoubleLE() throws IOException { return Double.longBitsToDouble(readLongLE()); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final String readLine() throws IOException { StringBuffer input = new StringBuffer(); int c = -1; boolean eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; break; case '\r': eol = true; long cur = getFilePointer(); if ((read()) != '\n') { seek(cur); } break; default: input.append((char)c); break; } } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
public final String readUTF() throws IOException { return DataInputStream.readUTF(this); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int read() throws IOException { int result = src.read(); if (result != -1) { ++pointer; } return result; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int read(byte[] b, int off, int len) throws IOException { int result = src.read(b, off, len); if (result != -1) { pointer += result; } return result; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final long skip(long n) throws IOException { long skipped = src.skip(n); pointer += skipped; return skipped; }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final int available() throws IOException { return src.available(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final void close() throws IOException { src.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final synchronized void reset() throws IOException { if (markPos != -1) { pointer = markPos; } src.reset(); }
// in sources/org/apache/batik/ext/awt/image/codec/util/ForwardSeekableStream.java
public final void seek(long pos) throws IOException { while (pos - pointer > 0) { pointer += src.skip(pos - pointer); } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
private long readUntil(long pos) throws IOException { // We've already got enough data cached if (pos < length) { return pos; } // pos >= length but length isn't getting any bigger, so return it if (foundEOF) { return length; } long len = pos - length; cache.seek(length); while (len > 0) { // Copy a buffer's worth of data from the source to the cache // bufLen will always fit into an int so this is safe int nbytes = stream.read(buf, 0, (int)Math.min(len, bufLen)); if (nbytes == -1) { foundEOF = true; return length; } cache.setLength(cache.length() + nbytes); cache.write(buf, 0, nbytes); len -= nbytes; length += nbytes; } return pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void seek(long pos) throws IOException { if (pos < 0) { throw new IOException(PropertyUtil.getString("FileCacheSeekableStream0")); } pointer = pos; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read() throws IOException { long next = pointer + 1; long pos = readUntil(next); if (pos >= next) { cache.seek(pointer++); return cache.read(); } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public void close() throws IOException { super.close(); cache.close(); cacheFile.delete(); }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDocumentStart() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.S; case '<': switch (nextChar()) { case '?': int c1 = nextChar(); if (c1 == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)c1)) { throw createXMLException("invalid.pi.target"); } context = PI_CONTEXT; int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if (c1 == 'x' && c2 == 'm' && c3 == 'l') { context = XML_DECL_CONTEXT; return LexicalUnits.XML_DECL_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.doctype"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: if (depth == 0) { throw createXMLException("invalid.character"); } else { return nextInContent(); } } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInTopLevel() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.character"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInPI() throws IOException, XMLException { if (piEndRead) { piEndRead = false; context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.PI_END; } switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '?': if (nextChar() != '>') { throw createXMLException("pi.end.expected"); } nextChar(); if (inDTD) { context = DTD_DECLARATIONS_CONTEXT; } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } return LexicalUnits.PI_END; default: do { do { nextChar(); } while (current != -1 && current != '?'); nextChar(); } while (current != -1 && current != '>'); nextChar(); piEndRead = true; return LexicalUnits.PI_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInStartTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '/': if (nextChar() != '>') { throw createXMLException("malformed.tag.end"); } nextChar(); context = (--depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.EMPTY_ELEMENT_END; case '>': nextChar(); context = CONTENT_CONTEXT; return LexicalUnits.END_CHAR; case '=': nextChar(); return LexicalUnits.EQ; case '"': attrDelimiter = '"'; nextChar(); for (;;) { switch (current) { case '"': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } case '\'': attrDelimiter = '\''; nextChar(); for (;;) { switch (current) { case '\'': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttributeValue() throws IOException, XMLException { if (current == -1) { return LexicalUnits.EOF; } if (current == '&') { return readReference(); } else { loop: for (;;) { switch (current) { case '&': case '<': case -1: break loop; case '"': case '\'': if (current == attrDelimiter) { break loop; } } nextChar(); } switch (current) { case -1: break; case '<': throw createXMLException("invalid.character"); case '&': return LexicalUnits.ATTRIBUTE_FRAGMENT; case '\'': case '"': nextChar(); if (inDTD) { context = ATTLIST_CONTEXT; } else { context = START_TAG_CONTEXT; } } return LexicalUnits.LAST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInContent() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier("CDATA[", LexicalUnits.CDATA_START, -1); default: throw createXMLException("invalid.character"); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEndTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': if (--depth < 0) { throw createXMLException("unexpected.end.tag"); } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } nextChar(); return LexicalUnits.END_CHAR; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInCDATASection() throws IOException, XMLException { if (cdataEndRead) { cdataEndRead = false; context = CONTENT_CONTEXT; return LexicalUnits.SECTION_END; } while (current != -1) { while (current != ']' && current != -1) { nextChar(); } if (current != -1) { nextChar(); if (current == ']') { nextChar(); if (current == '>') { break; } } } } if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); cdataEndRead = true; return LexicalUnits.CHARACTER_DATA; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInXMLDecl() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case 'v': return readIdentifier("ersion", LexicalUnits.VERSION_IDENTIFIER, -1); case 'e': return readIdentifier("ncoding", LexicalUnits.ENCODING_IDENTIFIER, -1); case 's': return readIdentifier("tandalone", LexicalUnits.STANDALONE_IDENTIFIER, -1); case '=': nextChar(); return LexicalUnits.EQ; case '?': nextChar(); if (current != '>') { throw createXMLException("pi.end.expected"); } nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.PI_END; case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDoctype() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.END_CHAR; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); case '[': nextChar(); context = DTD_DECLARATIONS_CONTEXT; inDTD = true; return LexicalUnits.LSQUARE_BRACKET; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDTDDeclarations() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case ']': nextChar(); context = DOCTYPE_CONTEXT; inDTD = false; return LexicalUnits.RSQUARE_BRACKET; case '%': return readPEReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'E': switch (nextChar()) { case 'L': context = ELEMENT_DECLARATION_CONTEXT; return readIdentifier ("EMENT", LexicalUnits.ELEMENT_DECLARATION_START, -1); case 'N': context = ENTITY_CONTEXT; return readIdentifier("TITY", LexicalUnits.ENTITY_START, -1); default: throw createXMLException("invalid.character"); } case 'A': context = ATTLIST_CONTEXT; return readIdentifier("TTLIST", LexicalUnits.ATTLIST_START, -1); case 'N': context = NOTATION_CONTEXT; return readIdentifier("OTATION", LexicalUnits.NOTATION_START, -1); default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readString() throws IOException, XMLException { do { nextChar(); } while (current != -1 && current != attrDelimiter); if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readComment() throws IOException, XMLException { if (nextChar() != '-') { throw createXMLException("malformed.comment"); } int c = nextChar(); while (c != -1) { while (c != -1 && c != '-') { c = nextChar(); } c = nextChar(); if (c == '-') { break; } } if (c == -1) { throw createXMLException("unexpected.eof"); } c = nextChar(); if (c != '>') { throw createXMLException("malformed.comment"); } nextChar(); return LexicalUnits.COMMENT; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readIdentifier(String s, int type, int ntype) throws IOException, XMLException { int len = s.length(); for (int i = 0; i < len; i++) { nextChar(); if (current != s.charAt(i)) { if (ntype == -1) { throw createXMLException("invalid.character"); } else { while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return ntype; } } } nextChar(); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readName(int type) throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.name"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPIStart() throws IOException, XMLException { int c1 = nextChar(); if (c1 == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("malformed.pi.target"); } int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInElementDeclaration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'E': return readIdentifier("MPTY", LexicalUnits.EMPTY_IDENTIFIER, LexicalUnits.NAME); case 'A': return readIdentifier("NY", LexicalUnits.ANY_IDENTIFIER, LexicalUnits.NAME); case '?': nextChar(); return LexicalUnits.QUESTION; case '+': nextChar(); return LexicalUnits.PLUS; case '*': nextChar(); return LexicalUnits.STAR; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); return LexicalUnits.RIGHT_BRACE; case '|': nextChar(); return LexicalUnits.PIPE; case ',': nextChar(); return LexicalUnits.COMMA; case '#': return readIdentifier("PCDATA", LexicalUnits.PCDATA_IDENTIFIER, -1); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttList() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return type = LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'C': return readIdentifier("DATA", LexicalUnits.CDATA_IDENTIFIER, LexicalUnits.NAME); case 'I': nextChar(); if (current != 'D') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ID_IDENTIFIER; } if (current != 'R') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'F') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREF_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREFS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; case 'N': switch (nextChar()) { default: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'O': context = NOTATION_TYPE_CONTEXT; return readIdentifier("TATION", LexicalUnits.NOTATION_IDENTIFIER, LexicalUnits.NAME); case 'M': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'O') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'K') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKEN_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKENS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case 'E': nextChar(); if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'I') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } switch (current) { case 'Y': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ENTITY_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'I': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } return LexicalUnits.ENTITIES_IDENTIFIER; default: if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&') { do { nextChar(); } while (current != -1 && current != '"' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '"': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '#': switch (nextChar()) { case 'R': return readIdentifier("EQUIRED", LexicalUnits.REQUIRED_IDENTIFIER, -1); case 'I': return readIdentifier("MPLIED", LexicalUnits.IMPLIED_IDENTIFIER, -1); case 'F': return readIdentifier("IXED", LexicalUnits.FIXED_IDENTIFIER, -1); default: throw createXMLException("invalid.character"); } case '(': nextChar(); context = ENUMERATION_CONTEXT; return LexicalUnits.LEFT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotation() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntity() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); return LexicalUnits.PERCENT; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case 'N': return readIdentifier("DATA", LexicalUnits.NDATA_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '"' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '"': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '\'': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntityValue() throws IOException, XMLException { switch (current) { case '&': return readReference(); case '%': int t = nextChar(); readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return t; default: while (current != -1 && current != attrDelimiter && current != '&' && current != '%') { nextChar(); } switch (current) { case -1: throw createXMLException("unexpected.eof"); case '\'': case '"': nextChar(); context = ENTITY_CONTEXT; return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotationType() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEnumeration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readNmtoken(); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readReference() throws IOException, XMLException { nextChar(); if (current == '#') { nextChar(); int i = 0; switch (current) { case 'x': do { i++; nextChar(); } while ((current >= '0' && current <= '9') || (current >= 'a' && current <= 'f') || (current >= 'A' && current <= 'F')); break; default: do { i++; nextChar(); } while (current >= '0' && current <= '9'); break; case -1: throw createXMLException("unexpected.eof"); } if (i == 1 || current != ';') { throw createXMLException("character.reference"); } nextChar(); return LexicalUnits.CHARACTER_REFERENCE; } else { int t = readName(LexicalUnits.ENTITY_REFERENCE); if (current != ';') { throw createXMLException("character.reference"); } nextChar(); return t; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPEReference() throws IOException, XMLException { nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.parameter.entity"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return LexicalUnits.PARAMETER_ENTITY_REFERENCE; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readNmtoken() throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } while (XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return LexicalUnits.NMTOKEN; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { char[] t = new char[ 1+ position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/xml/XMLUtilities.java
public static Reader createXMLDocumentReader(InputStream is) throws IOException { PushbackInputStream pbis = new PushbackInputStream(is, 128); byte[] buf = new byte[4]; int len = pbis.read(buf); if (len > 0) { pbis.unread(buf, 0, len); } if (len == 4) { switch (buf[0] & 0x00FF) { case 0: if (buf[1] == 0x003c && buf[2] == 0x0000 && buf[3] == 0x003f) { return new InputStreamReader(pbis, "UnicodeBig"); } break; case '<': switch (buf[1] & 0x00FF) { case 0: if (buf[2] == 0x003f && buf[3] == 0x0000) { return new InputStreamReader(pbis, "UnicodeLittle"); } break; case '?': if (buf[2] == 'x' && buf[3] == 'm') { Reader r = createXMLDeclarationReader(pbis, "UTF8"); String enc = getXMLDeclarationEncoding(r, "UTF8"); return new InputStreamReader(pbis, enc); } } break; case 0x004C: if (buf[1] == 0x006f && (buf[2] & 0x00FF) == 0x00a7 && (buf[3] & 0x00FF) == 0x0094) { Reader r = createXMLDeclarationReader(pbis, "CP037"); String enc = getXMLDeclarationEncoding(r, "CP037"); return new InputStreamReader(pbis, enc); } break; case 0x00FE: if ((buf[1] & 0x00FF) == 0x00FF) { return new InputStreamReader(pbis, "Unicode"); } break; case 0x00FF: if ((buf[1] & 0x00FF) == 0x00FE) { return new InputStreamReader(pbis, "Unicode"); } } } return new InputStreamReader(pbis, "UTF8"); }
// in sources/org/apache/batik/xml/XMLUtilities.java
protected static Reader createXMLDeclarationReader(PushbackInputStream pbis, String enc) throws IOException { byte[] buf = new byte[128]; int len = pbis.read(buf); if (len > 0) { pbis.unread(buf, 0, len); } return new InputStreamReader(new ByteArrayInputStream(buf, 4, len), enc); }
// in sources/org/apache/batik/xml/XMLUtilities.java
protected static String getXMLDeclarationEncoding(Reader r, String e) throws IOException { int c; if ((c = r.read()) != 'l') { return e; } if (!isXMLSpace((char)(c = r.read()))) { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != 'v') { return e; } if ((c = r.read()) != 'e') { return e; } if ((c = r.read()) != 'r') { return e; } if ((c = r.read()) != 's') { return e; } if ((c = r.read()) != 'i') { return e; } if ((c = r.read()) != 'o') { return e; } if ((c = r.read()) != 'n') { return e; } c = r.read(); while (isXMLSpace((char)c)) { c = r.read(); } if (c != '=') { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != '"' && c != '\'') { return e; } char sc = (char)c; for (;;) { c = r.read(); if (c == sc) { break; } if (!isXMLVersionCharacter((char)c)) { return e; } } if (!isXMLSpace((char)(c = r.read()))) { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != 'e') { return e; } if ((c = r.read()) != 'n') { return e; } if ((c = r.read()) != 'c') { return e; } if ((c = r.read()) != 'o') { return e; } if ((c = r.read()) != 'd') { return e; } if ((c = r.read()) != 'i') { return e; } if ((c = r.read()) != 'n') { return e; } if ((c = r.read()) != 'g') { return e; } c = r.read(); while (isXMLSpace((char)c)) { c = r.read(); } if (c != '=') { return e; } while (isXMLSpace((char)(c = r.read()))); if (c != '"' && c != '\'') { return e; } sc = (char)c; StringBuffer enc = new StringBuffer(); for (;;) { c = r.read(); if (c == -1) { return e; } if (c == sc) { return encodingToJavaEncoding(enc.toString(), e); } enc.append((char)c); } }
// in sources/org/apache/batik/parser/PointsParser.java
protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); }
// in sources/org/apache/batik/parser/TimingSpecifierListParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); ((TimingSpecifierListHandler) timingSpecifierHandler) .startTimingSpecifierList(); skipSpaces(); if (current != -1) { for (;;) { Object[] spec = parseTimingSpecifier(); handleTimingSpecifier(spec); skipSpaces(); if (current == -1) { break; } if (current == ';') { current = reader.read(); continue; } reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportUnexpectedCharacterError( current ); } ((TimingSpecifierListHandler) timingSpecifierHandler) .endTimingSpecifierList(); }
// in sources/org/apache/batik/parser/NumberListParser.java
protected void doParse() throws ParseException, IOException { numberListHandler.startNumberList(); current = reader.read(); skipSpaces(); try { for (;;) { numberListHandler.startNumber(); float f = parseFloat(); numberListHandler.numberValue(f); numberListHandler.endNumber(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } numberListHandler.endNumberList(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PathParser p = new PathParser(); AWTPathProducer ph = new AWTPathProducer(); ph.setWindingRule(wr); p.setPathHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/LengthListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler)lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler)lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void skipSpaces() throws IOException { for (;;) { switch (current) { default: return; case 0x20: case 0x09: case 0x0D: case 0x0A: } current = reader.read(); } }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void skipCommaSpaces() throws IOException { wsp1: for (;;) { switch (current) { default: break wsp1; case 0x20: case 0x9: case 0xD: case 0xA: } current = reader.read(); } if (current == ',') { wsp2: for (;;) { switch (current = reader.read()) { default: break wsp2; case 0x20: case 0x9: case 0xD: case 0xA: } } } }
// in sources/org/apache/batik/parser/NumberParser.java
protected float parseFloat() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; switch (current) { case '-': mantPos = false; // fallthrough case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return 0.0f; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; case '.': case 'e': case 'E': break m1; default: return 0.0f; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return 0.0f; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: if (!mantRead) { return 0.0f; } break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } switch (current) { case 'e': case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } return buildFloat(mant, exp); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } lengthHandler.endLength(); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void parseLength() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; int unitState = 0; switch (current) { case '-': mantPos = false; case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m1; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } boolean le = false; es: switch (current) { case 'e': le = true; case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 1; break es; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 2; break es; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } lengthHandler.lengthValue(NumberParser.buildFloat(mant, exp)); switch (unitState) { case 1: lengthHandler.em(); current = reader.read(); return; case 2: lengthHandler.ex(); current = reader.read(); return; } switch (current) { case 'e': current = reader.read(); switch (current) { case 'm': lengthHandler.em(); current = reader.read(); break; case 'x': lengthHandler.ex(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'p': current = reader.read(); switch (current) { case 'c': lengthHandler.pc(); current = reader.read(); break; case 't': lengthHandler.pt(); current = reader.read(); break; case 'x': lengthHandler.px(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'i': current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break; } lengthHandler.in(); current = reader.read(); break; case 'c': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.cm(); current = reader.read(); break; case 'm': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.mm(); current = reader.read(); break; case '%': lengthHandler.percentage(); current = reader.read(); break; } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void doParse() throws ParseException, IOException { bufferSize = 0; current = reader.read(); fragmentIdentifierHandler.startFragmentIdentifier(); ident: { String id = null; switch (current) { case 'x': bufferize(); current = reader.read(); if (current != 'p') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'o') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'n') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 't') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'r') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break ident; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break ident; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break ident; } current = reader.read(); if (current != '"' && current != '\'') { reportCharacterExpectedError( '\'', current ); break ident; } char q = (char)current; current = reader.read(); parseIdentifier(); id = getBufferContent(); bufferSize = 0; fragmentIdentifierHandler.idReference(id); if (current != q) { reportCharacterExpectedError( q, current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; case 's': bufferize(); current = reader.read(); if (current != 'v') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'g') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'V') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'w') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); parseViewAttributes(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; default: if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { break ident; } bufferize(); current = reader.read(); parseIdentifier(); } id = getBufferContent(); fragmentIdentifierHandler.idReference(id); } fragmentIdentifierHandler.endFragmentIdentifier(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseViewAttributes() throws ParseException, IOException { boolean first = true; loop: for (;;) { switch (current) { case -1: case ')': if (first) { reportUnexpectedCharacterError( current ); break loop; } // fallthrough default: break loop; case ';': if (first) { reportUnexpectedCharacterError( current ); break loop; } current = reader.read(); break; case 'v': first = false; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); break loop; } current = reader.read(); switch (current) { case 'B': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); float x = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float y = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float w = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float h = parseFloat(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.viewBox(x, y, w, h); if (current != ')' && current != ';') { reportCharacterExpectedError( ')', current ); break loop; } break; case 'T': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.startViewTarget(); id: for (;;) { bufferSize = 0; if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { reportUnexpectedCharacterError( current ); break loop; } bufferize(); current = reader.read(); parseIdentifier(); String s = getBufferContent(); fragmentIdentifierHandler.viewTarget(s); bufferSize = 0; switch (current) { case ')': current = reader.read(); break id; case ',': case ';': current = reader.read(); break; default: reportUnexpectedCharacterError( current ); break loop; } } fragmentIdentifierHandler.endViewTarget(); break; default: reportUnexpectedCharacterError( current ); break loop; } break; case 'p': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'v') { reportCharacterExpectedError( 'v', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'p') { reportCharacterExpectedError( 'p', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'R') { reportCharacterExpectedError( 'R', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); parsePreserveAspectRatio(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); break; case 't': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } fragmentIdentifierHandler.startTransformList(); tloop: for (;;) { try { current = reader.read(); switch (current) { case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; default: break tloop; } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } fragmentIdentifierHandler.endTransformList(); break; case 'z': first = false; current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break loop; } current = reader.read(); if (current != 'P') { reportCharacterExpectedError( 'P', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); switch (current) { case 'm': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'y') { reportCharacterExpectedError( 'y', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(true); break; case 'd': current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'b') { reportCharacterExpectedError( 'b', current ); break loop; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(false); break; default: reportUnexpectedCharacterError( current ); break loop; } if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseIdentifier() throws ParseException, IOException { for (;;) { if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { break; } bufferize(); current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipSpaces() throws IOException { if (current == ',') { current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipCommaSpaces() throws IOException { if (current == ',') { current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall-through case 'Y': break; default: reportCharacterExpectedError( 'X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } if (skewX) { fragmentIdentifierHandler.skewX(sk); } else { fragmentIdentifierHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipTransform() throws IOException { loop: for (;;) { current = reader.read(); switch (current) { case ')': break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { fragmentIdentifierHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); fragmentIdentifierHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMaxYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMidYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMinYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipIdentifier(); break; } fragmentIdentifierHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } fragmentIdentifierHandler.slice(); current = reader.read(); } fragmentIdentifierHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void skipIdentifier() throws IOException { loop: for (;;) { current = reader.read(); switch(current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); case -1: break loop; } } }
// in sources/org/apache/batik/parser/LengthPairListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler) lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipSpaces(); if (current == -1) { break; } if (current != ';') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler) lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/ClockParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); float clockValue = parseOffset ? parseOffset() : parseClockValue(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } if (clockHandler != null) { clockHandler.clockValue(clockValue); } }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); skipSpaces(); parsePreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { preserveAspectRatioHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); preserveAspectRatioHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMaxYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMidYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMinYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't',current ); skipIdentifier(); break; } preserveAspectRatioHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } preserveAspectRatioHandler.slice(); current = reader.read(); break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } preserveAspectRatioHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void skipIdentifier() throws IOException { loop: for (;;) { current = reader.read(); switch(current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/AngleParser.java
protected void doParse() throws ParseException, IOException { angleHandler.startAngle(); current = reader.read(); skipSpaces(); try { float f = parseFloat(); angleHandler.angleValue(f); s: if (current != -1) { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: break s; } switch (current) { case 'd': current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); break; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError('g', current ); break; } angleHandler.deg(); current = reader.read(); break; case 'g': current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); break; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.grad(); current = reader.read(); break; case 'r': current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.rad(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } angleHandler.endAngle(); }
// in sources/org/apache/batik/parser/AbstractScanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { char[] t = new char[ 1 + position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseTimingSpecifier() throws ParseException, IOException { skipSpaces(); boolean escaped = false; if (current == '\\') { escaped = true; current = reader.read(); } Object[] ret = null; if (current == '+' || (current == '-' && !escaped) || (current >= '0' && current <= '9')) { float offset = parseOffset(); ret = new Object[] { new Integer(TIME_OFFSET), new Float(offset) }; } else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { ret = parseIDValue(escaped); } else { reportUnexpectedCharacterError( current ); } return ret; }
// in sources/org/apache/batik/parser/TimingParser.java
protected String parseName() throws ParseException, IOException { StringBuffer sb = new StringBuffer(); boolean midEscaped = false; do { sb.append((char) current); current = reader.read(); midEscaped = false; if (current == '\\') { midEscaped = true; current = reader.read(); } } while (XMLUtilities.isXMLNameCharacter((char) current) && (midEscaped || (current != '-' && current != '.'))); return sb.toString(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseIDValue(boolean escaped) throws ParseException, IOException { String id = parseName(); if ((id.equals("accessKey") && useSVG11AccessKeys || id.equals("accesskey")) && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); if (current == -1) { reportError("end.of.stream", new Object[0]); } char key = (char) current; current = reader.read(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY), new Float(offset), new Character(key) }; } else if (id.equals("accessKey") && useSVG12AccessKeys && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); StringBuffer keyName = new StringBuffer(); while (current >= 'A' && current <= 'Z' || current >= 'a' && current <= 'z' || current >= '0' && current <= '9' || current == '+') { keyName.append((char) current); current = reader.read(); } if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY_SVG12), new Float(offset), keyName.toString() }; } else if (id.equals("wallclock") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); Calendar wallclockValue = parseWallclockValue(); skipSpaces(); if (current != ')') { reportError("character.unexpected", new Object[] { new Integer(current) }); } current = reader.read(); return new Object[] { new Integer(TIME_WALLCLOCK), wallclockValue }; } else if (id.equals("indefinite") && !escaped) { return new Object[] { new Integer(TIME_INDEFINITE) }; } else { if (current == '.') { current = reader.read(); if (current == '\\') { escaped = true; current = reader.read(); } if (!XMLUtilities.isXMLNameFirstCharacter((char) current)) { reportUnexpectedCharacterError( current ); } String id2 = parseName(); if ((id2.equals("begin") || id2.equals("end")) && !escaped) { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_SYNCBASE), new Float(offset), id, id2 }; } else if (id2.equals("repeat") && !escaped) { Integer repeatIteration = null; if (current == '(') { current = reader.read(); repeatIteration = new Integer(parseDigits()); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); } skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_REPEAT), new Float(offset), id, repeatIteration }; } else if (id2.equals("marker") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } String markerName = parseName(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); return new Object[] { new Integer(TIME_MEDIA_MARKER), id, markerName }; } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), id, id2 }; } } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), null, id }; } } }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseClockValue() throws ParseException, IOException { int d1 = parseDigits(); float offset; if (current == ':') { current = reader.read(); int d2 = parseDigits(); if (current == ':') { current = reader.read(); int d3 = parseDigits(); offset = d1 * 3600 + d2 * 60 + d3; } else { offset = d1 * 60 + d2; } if (current == '.') { current = reader.read(); offset += parseFraction(); } } else if (current == '.') { current = reader.read(); offset = (parseFraction() + d1) * parseUnit(); } else { offset = d1 * parseUnit(); } return offset; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseOffset() throws ParseException, IOException { boolean offsetNegative = false; if (current == '-') { offsetNegative = true; current = reader.read(); skipSpaces(); } else if (current == '+') { current = reader.read(); skipSpaces(); } if (offsetNegative) { return -parseClockValue(); } return parseClockValue(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected int parseDigits() throws ParseException, IOException { int value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } do { value = value * 10 + (current - '0'); current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseFraction() throws ParseException, IOException { float value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } float weight = 0.1f; do { value += weight * (current - '0'); weight *= 0.1f; current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseUnit() throws ParseException, IOException { if (current == 'h') { current = reader.read(); return 3600; } else if (current == 'm') { current = reader.read(); if (current == 'i') { current = reader.read(); if (current != 'n') { reportUnexpectedCharacterError( current ); } current = reader.read(); return 60; } else if (current == 's') { current = reader.read(); return 0.001f; } else { reportUnexpectedCharacterError( current ); } } else if (current == 's') { current = reader.read(); } return 1; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Calendar parseWallclockValue() throws ParseException, IOException { int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0, tzh = 0, tzm = 0; float frac = 0; boolean dateSpecified = false; boolean timeSpecified = false; boolean tzSpecified = false; boolean tzNegative = false; String tzn = null; int digits1 = parseDigits(); do { if (current == '-') { dateSpecified = true; y = digits1; current = reader.read(); M = parseDigits(); if (current != '-') { reportUnexpectedCharacterError( current ); } current = reader.read(); d = parseDigits(); if (current != 'T') { break; } current = reader.read(); digits1 = parseDigits(); if (current != ':') { reportUnexpectedCharacterError( current ); } } if (current == ':') { timeSpecified = true; h = digits1; current = reader.read(); m = parseDigits(); if (current == ':') { current = reader.read(); s = parseDigits(); if (current == '.') { current = reader.read(); frac = parseFraction(); } } if (current == 'Z') { tzSpecified = true; tzn = "UTC"; current = reader.read(); } else if (current == '+' || current == '-') { StringBuffer tznb = new StringBuffer(); tzSpecified = true; if (current == '-') { tzNegative = true; tznb.append('-'); } else { tznb.append('+'); } current = reader.read(); tzh = parseDigits(); if (tzh < 10) { tznb.append('0'); } tznb.append(tzh); if (current != ':') { reportUnexpectedCharacterError( current ); } tznb.append(':'); current = reader.read(); tzm = parseDigits(); if (tzm < 10) { tznb.append('0'); } tznb.append(tzm); tzn = tznb.toString(); } } } while (false); if (!dateSpecified && !timeSpecified) { reportUnexpectedCharacterError( current ); } Calendar wallclockTime; if (tzSpecified) { int offset = (tzNegative ? -1 : 1) * (tzh * 3600000 + tzm * 60000); wallclockTime = Calendar.getInstance(new SimpleTimeZone(offset, tzn)); } else { wallclockTime = Calendar.getInstance(); } if (dateSpecified && timeSpecified) { wallclockTime.set(y, M, d, h, m, s); } else if (dateSpecified) { wallclockTime.set(y, M, d, 0, 0, 0); } else { wallclockTime.set(Calendar.HOUR, h); wallclockTime.set(Calendar.MINUTE, m); wallclockTime.set(Calendar.SECOND, s); } if (frac == 0.0f) { wallclockTime.set(Calendar.MILLISECOND, (int) (frac * 1000)); } else { wallclockTime.set(Calendar.MILLISECOND, 0); } return wallclockTime; }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void doParse() throws ParseException, IOException { pathHandler.startPath(); current = reader.read(); loop: for (;;) { try { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break; case 'z': case 'Z': current = reader.read(); pathHandler.closePath(); break; case 'm': parsem(); break; case 'M': parseM(); break; case 'l': parsel(); break; case 'L': parseL(); break; case 'h': parseh(); break; case 'H': parseH(); break; case 'v': parsev(); break; case 'V': parseV(); break; case 'c': parsec(); break; case 'C': parseC(); break; case 'q': parseq(); break; case 'Q': parseQ(); break; case 's': parses(); break; case 'S': parseS(); break; case 't': parset(); break; case 'T': parseT(); break; case 'a': parsea(); break; case 'A': parseA(); break; case -1: break loop; default: reportUnexpected(current); break; } } catch (ParseException e) { errorHandler.error(e); skipSubPath(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } pathHandler.endPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsem() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoRel(x, y); boolean expectNumber = skipCommaSpaces2(); _parsel(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseM() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoAbs(x, y); boolean expectNumber = skipCommaSpaces2(); _parseL(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsel() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parsel(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parsel(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseL() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parseL(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parseL(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseh() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseH() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsev() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseV() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsec() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicRel(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseC() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicAbs(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseq() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticRel(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseQ() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticAbs(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parses() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothRel(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseS() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothAbs(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parset() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseT() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsea() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcRel(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseA() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcAbs(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void skipSubPath() throws ParseException, IOException { for (;;) { switch (current) { case -1: case 'm': case 'M': return; default: break; } current = reader.read(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void reportUnexpected(int ch) throws ParseException, IOException { reportUnexpectedCharacterError( current ); skipSubPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected boolean skipCommaSpaces2() throws IOException { wsp1: for (;;) { switch (current) { default: break wsp1; case 0x20: case 0x9: case 0xD: case 0xA: break; } current = reader.read(); } if (current != ',') return false; // no comma. wsp2: for (;;) { switch (current = reader.read()) { default: break wsp2; case 0x20: case 0x9: case 0xD: case 0xA: break; } } return true; // had comma }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void doParse() throws ParseException, IOException { transformListHandler.startTransformList(); loop: for (;;) { try { current = reader.read(); switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; case -1: break loop; default: reportUnexpectedCharacterError( current ); skipTransform(); } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } transformListHandler.endTransformList(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError('i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError('x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError('o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError('n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError('s', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError('w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall through case 'Y': break; default: reportCharacterExpectedError('X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } if (skewX) { transformListHandler.skewX(sk); } else { transformListHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void skipTransform() throws IOException { loop: for (;;) { current = reader.read(); switch (current) { case ')': break loop; default: if (current == -1) { break loop; } } } }
// in sources/org/apache/batik/parser/TimingSpecifierParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); Object[] spec = parseTimingSpecifier(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } handleTimingSpecifier(spec); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
public void setFile(File wmffile) throws IOException { stream = new DataInputStream(new BufferedInputStream(new FileInputStream(wmffile))); read(stream); stream.close(); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
protected boolean readRecords(DataInputStream is) throws IOException { // effective reading of the rest of the file short functionId = 1; int recSize = 0; int gdiIndex; // the last Object index int brushObject = -1; // the last brush int penObject = -1; // the last pen int fontObject = -1; // the last font GdiObject gdiObj; while (functionId > 0) { recSize = readInt( is ); // Subtract size in 16-bit words of recSize and functionId; recSize -= 3; functionId = readShort( is ); if ( functionId <= 0 ) break; switch ( functionId ) { case WMFConstants.META_SETMAPMODE: { int mapmode = readShort( is ); // change isotropic if mode is anisotropic if (mapmode == WMFConstants.MM_ANISOTROPIC) isotropic = false; } break; case WMFConstants.META_SETWINDOWORG: { vpY = readShort( is ); vpX = readShort( is ); } break; case WMFConstants.META_SETWINDOWEXT: { vpH = readShort( is ); vpW = readShort( is ); if (! isotropic) scaleXY = (float)vpW / (float)vpH; vpW = (int)(vpW * scaleXY); } break; case WMFConstants.META_CREATEPENINDIRECT: { int objIndex = 0; int penStyle = readShort( is ); readInt( is ); // width // color definition int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; Color color = new Color( red, green, blue); if (recSize == 6) readShort(is); // if size greater than 5 if ( penStyle == WMFConstants.META_PS_NULL ) { objIndex = addObjectAt( NULL_PEN, color, objIndex ); } else { objIndex = addObjectAt( PEN, color, objIndex ); } } break; case WMFConstants.META_CREATEBRUSHINDIRECT: { int objIndex = 0; int brushStyle = readShort( is ); // color definition int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; Color color = new Color( red, green, blue); readShort( is ); // hatch if ( brushStyle == WMFConstants.META_PS_NULL ) { objIndex = addObjectAt( NULL_BRUSH, color, objIndex); } else objIndex = addObjectAt(BRUSH, color, objIndex ); } break; case WMFConstants.META_SETTEXTALIGN: int align = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); currentHorizAlign = WMFUtilities.getHorizontalAlignment(align); currentVertAlign = WMFUtilities.getVerticalAlignment(align); break; case WMFConstants.META_EXTTEXTOUT: { int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); int lenText = readShort( is ); int flag = readShort( is ); int read = 4; // used to track the actual size really read boolean clipped = false; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; int len; // determination of clipping property if ((flag & WMFConstants.ETO_CLIPPED) != 0) { x1 = (int)(readShort( is ) * scaleXY); y1 = readShort( is ); x2 = (int)(readShort( is ) * scaleXY); y2 = readShort( is ); read += 4; clipped = true; } byte[] bstr = new byte[ lenText ]; int i = 0; for ( ; i < lenText; i++ ) { bstr[ i ] = is.readByte(); } String sr = WMFUtilities.decodeString(wf, bstr); read += (lenText + 1)/2; /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (lenText % 2 != 0) is.readByte(); // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); TextLayout layout = new TextLayout( sr, wf.font, fontCtx ); int lfWidth = (int)layout.getBounds().getWidth(); x = (int)layout.getBounds().getX(); int lfHeight = (int)getVerticalAlignmentValue(layout, currentVertAlign); resizeBounds(x, y); resizeBounds(x+lfWidth, y+lfHeight); firstEffectivePaint = false; } break; case WMFConstants.META_DRAWTEXT: case WMFConstants.META_TEXTOUT: { int len = readShort( is ); int read = 1; // used to track the actual size really read byte[] bstr = new byte[ len ]; for ( int i = 0; i < len; i++ ) { bstr[ i ] = is.readByte(); } String sr = WMFUtilities.decodeString(wf, bstr); /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (len % 2 != 0) is.readByte(); read += (len + 1) / 2; int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); read += 2; // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); TextLayout layout = new TextLayout( sr, wf.font, fontCtx ); int lfWidth = (int)layout.getBounds().getWidth(); x = (int)layout.getBounds().getX(); int lfHeight = (int)getVerticalAlignmentValue(layout, currentVertAlign); resizeBounds(x, y); resizeBounds(x+lfWidth, y+lfHeight); } break; case WMFConstants.META_CREATEFONTINDIRECT: { int lfHeight = readShort( is ); float size = (int)(scaleY * lfHeight); int lfWidth = readShort( is ); int escape = (int)readShort( is ); int orient = (int)readShort( is ); int weight = (int)readShort( is ); int italic = (int)is.readByte(); int underline = (int)is.readByte(); int strikeOut = (int)is.readByte(); int charset = (int)(is.readByte() & 0x00ff); int lfOutPrecision = is.readByte(); int lfClipPrecision = is.readByte(); int lfQuality = is.readByte(); int lfPitchAndFamily = is.readByte(); int style = italic > 0 ? Font.ITALIC : Font.PLAIN; style |= (weight > 400) ? Font.BOLD : Font.PLAIN; // don't need to read the end of the record, // because it will always be completely used int len = (2*(recSize-9)); byte[] lfFaceName = new byte[ len ]; byte ch; for ( int i = 0; i < len; i++ ) lfFaceName[ i ] = is.readByte(); String face = new String( lfFaceName ); // FIXED : management of font names int d = 0; while ((d < face.length()) && ((Character.isLetterOrDigit(face.charAt(d))) || (Character.isWhitespace(face.charAt(d))))) d++; if (d > 0) face = face.substring(0,d); else face = "System"; if ( size < 0 ) size = -size /* * -1.3 */; int objIndex = 0; Font f = new Font(face, style, (int)size); f = f.deriveFont(size); WMFFont wf = new WMFFont(f, charset, underline, strikeOut, italic, weight, orient, escape); objIndex = addObjectAt( FONT, wf , objIndex ); } break; case WMFConstants.META_CREATEREGION: { int objIndex = 0; for ( int j = 0; j < recSize; j++ ) readShort(is); // read all fields objIndex = addObjectAt( PALETTE, INTEGER_0, 0 ); } break; case WMFConstants.META_CREATEPALETTE: { int objIndex = 0; for ( int j = 0; j < recSize; j++ ) readShort(is); // read all fields objIndex = addObjectAt( OBJ_REGION, INTEGER_0, 0 ); } break; case WMFConstants.META_SELECTOBJECT: gdiIndex = readShort(is); if (( gdiIndex & 0x80000000 ) != 0 ) // Stock Object break; gdiObj = getObject( gdiIndex ); if ( !gdiObj.used ) break; switch( gdiObj.type ) { case PEN: penObject = gdiIndex; break; case BRUSH: brushObject = gdiIndex; break; case FONT: { this.wf = ((WMFFont)gdiObj.obj); fontObject = gdiIndex; } break; case NULL_PEN: penObject = -1; break; case NULL_BRUSH: brushObject = -1; break; } break; case WMFConstants.META_DELETEOBJECT: gdiIndex = readShort(is); gdiObj = getObject( gdiIndex ); if ( gdiIndex == brushObject ) brushObject = -1; else if ( gdiIndex == penObject ) penObject = -1; else if ( gdiIndex == fontObject ) fontObject = -1; gdiObj.clear(); break; case WMFConstants.META_LINETO: { int y = readShort( is ); int x = (int)(readShort( is ) * scaleXY); if (penObject >= 0) { resizeBounds(startX, startY); resizeBounds(x, y); firstEffectivePaint = false; } startX = x; startY = y; } break; case WMFConstants.META_MOVETO: { startY = readShort( is ); startX = (int)(readShort( is ) * scaleXY); } break; case WMFConstants.META_POLYPOLYGON: { int count = readShort( is ); int[] pts = new int[ count ]; int ptCount = 0; for ( int i = 0; i < count; i++ ) { pts[ i ] = readShort( is ); ptCount += pts[ i ]; } int offset = count+1; for ( int i = 0; i < count; i++ ) { for ( int j = 0; j < pts[ i ]; j++ ) { // FIXED 115 : correction preliminary images dimensions int x = (int)(readShort( is ) * scaleXY); int y = readShort( is ); if ((brushObject >= 0) || (penObject >= 0)) resizeBounds(x, y); } } firstEffectivePaint = false; } break; case WMFConstants.META_POLYGON: { int count = readShort( is ); float[] _xpts = new float[ count+1 ]; float[] _ypts = new float[ count+1 ]; for ( int i = 0; i < count; i++ ) { _xpts[i] = readShort( is ) * scaleXY; _ypts[i] = readShort( is ); } _xpts[count] = _xpts[0]; _ypts[count] = _ypts[0]; Polygon2D pol = new Polygon2D(_xpts, _ypts, count); paint(brushObject, penObject, pol); } break; case WMFConstants.META_POLYLINE: { int count = readShort( is ); float[] _xpts = new float[ count ]; float[] _ypts = new float[ count ]; for ( int i = 0; i < count; i++ ) { _xpts[i] = readShort( is ) * scaleXY; _ypts[i] = readShort( is ); } Polyline2D pol = new Polyline2D(_xpts, _ypts, count); paintWithPen(penObject, pol); } break; case WMFConstants.META_ELLIPSE: case WMFConstants.META_INTERSECTCLIPRECT: case WMFConstants.META_RECTANGLE: { int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_ROUNDRECT: { readShort( is ); readShort( is ); int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_ARC: case WMFConstants.META_CHORD: case WMFConstants.META_PIE: { readShort( is ); readShort( is ); readShort( is ); readShort( is ); int bot = readShort( is ); int right = (int)(readShort( is ) * scaleXY); int top = readShort( is ); int left = (int)(readShort( is ) * scaleXY); Rectangle2D.Float rec = new Rectangle2D.Float(left, top, right-left, bot-top); paint(brushObject, penObject, rec); } break; case WMFConstants.META_PATBLT : { readInt( is ); // rop int height = readShort( is ); int width = (int)(readShort( is ) * scaleXY); int left = (int)(readShort( is ) * scaleXY); int top = readShort( is ); if (penObject >= 0) resizeBounds(left, top); if (penObject >= 0) resizeBounds(left+width, top+height); } break; // UPDATED : META_DIBSTRETCHBLT added case WMFConstants.META_DIBSTRETCHBLT: { is.readInt(); // mode readShort( is ); // heightSrc readShort( is ); // widthSrc readShort( is ); // sy readShort( is ); // sx float heightDst = (float)readShort( is ); float widthDst = (float)readShort( is ) * scaleXY; float dy = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH; float dx = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH * scaleXY; widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH; heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst)); int len = 2*recSize - 20; for (int i = 0; i < len; i++) is.readByte(); } break; case WMFConstants.META_STRETCHDIB: { is.readInt(); // mode readShort( is ); // usage readShort( is ); // heightSrc readShort( is ); // widthSrc readShort( is ); // sy readShort( is ); // sx float heightDst = (float)readShort( is ); float widthDst = (float)readShort( is ) * scaleXY; float dy = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH; float dx = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH * scaleXY; widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH; heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst)); int len = 2*recSize - 22; byte bitmap[] = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); } break; case WMFConstants.META_DIBBITBLT: { is.readInt(); // mode readShort( is ); //sy readShort( is ); //sx readShort( is ); // hdc float height = readShort( is ) * (float)inch / PIXEL_PER_INCH * getVpHFactor(); float width = readShort( is ) * (float)inch / PIXEL_PER_INCH * getVpWFactor() * scaleXY; float dy = (float)inch / PIXEL_PER_INCH * getVpHFactor() * readShort( is ); float dx = (float)inch / PIXEL_PER_INCH * getVpWFactor() * readShort( is ) * scaleXY; resizeImageBounds((int)dx, (int)dy); resizeImageBounds((int)(dx + width), (int)(dy + height)); } break; default: for ( int j = 0; j < recSize; j++ ) readShort(is); break; } } // sets the width, height, etc of the image if the file does not have an APM (in this case it is retrieved // from the viewport) if (! isAldus) { width = vpW; height = vpH; right = vpX; left = vpX + vpW; top = vpY; bottom = vpY + vpH; } resetBounds(); return true; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java
protected boolean readRecords( DataInputStream is ) throws IOException { short functionId = 1; int recSize = 0; short recData; numRecords = 0; while ( functionId > 0) { recSize = readInt( is ); // Subtract size in 16-bit words of recSize and functionId; recSize -= 3; functionId = readShort( is ); if ( functionId <= 0 ) break; MetaRecord mr = new MetaRecord(); switch ( functionId ) { case WMFConstants.META_SETMAPMODE: { mr.numPoints = recSize; mr.functionId = functionId; int mapmode = readShort( is ); if (mapmode == WMFConstants.MM_ANISOTROPIC) isotropic = false; mr.addElement(mapmode); records.add( mr ); } break; case WMFConstants.META_DRAWTEXT: { for ( int i = 0; i < recSize; i++ ) recData = readShort( is ); // todo shouldn't the read data be used for something?? numRecords--; } break; case WMFConstants.META_EXTTEXTOUT: { int yVal = readShort( is ) * ySign; int xVal = (int) (readShort( is ) * xSign * scaleXY); int lenText = readShort( is ); int flag = readShort( is ); int read = 4; // used to track the actual size really read boolean clipped = false; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; int len; // determination of clipping property if ((flag & WMFConstants.ETO_CLIPPED) != 0) { x1 = (int) (readShort( is ) * xSign * scaleXY); y1 = readShort( is ) * ySign; x2 = (int) (readShort( is ) * xSign * scaleXY); y2 = readShort( is ) * ySign; read += 4; clipped = true; } byte[] bstr = new byte[ lenText ]; int i = 0; for ( ; i < lenText; i++ ) { bstr[ i ] = is.readByte(); } read += (lenText + 1)/2; /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (lenText % 2 != 0) is.readByte(); // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); /* get the StringRecord, having decoded the String, using the current * charset (which was given by the last META_CREATEFONTINDIRECT) */ mr = new MetaRecord.ByteRecord(bstr); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( xVal ); mr.addElement( yVal ); mr.addElement( flag ); if (clipped) { mr.addElement( x1 ); mr.addElement( y1 ); mr.addElement( x2 ); mr.addElement( y2 ); } records.add( mr ); } break; case WMFConstants.META_TEXTOUT: { int len = readShort( is ); int read = 1; // used to track the actual size really read byte[] bstr = new byte[ len ]; for ( int i = 0; i < len; i++ ) { bstr[ i ] = is.readByte(); } /* must do this because WMF strings always have an even number of bytes, even * if there is an odd number of characters */ if (len % 2 != 0) is.readByte(); read += (len + 1) / 2; int yVal = readShort( is ) * ySign; int xVal = (int) (readShort( is ) * xSign * scaleXY); read += 2; // if the record was not completely read, finish reading if (read < recSize) for (int j = read; j < recSize; j++) readShort( is ); /* get the StringRecord, having decoded the String, using the current * charset (which was givben by the last META_CREATEFONTINDIRECT) */ mr = new MetaRecord.ByteRecord(bstr); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( xVal ); mr.addElement( yVal ); records.add( mr ); } break; case WMFConstants.META_CREATEFONTINDIRECT: { int lfHeight = readShort( is ); int lfWidth = readShort( is ); int lfEscapement = readShort( is ); int lfOrientation = readShort( is ); int lfWeight = readShort( is ); int lfItalic = is.readByte(); int lfUnderline = is.readByte(); int lfStrikeOut = is.readByte(); int lfCharSet = is.readByte() & 0x00ff; //System.out.println("lfCharSet: "+(lfCharSet & 0x00ff)); int lfOutPrecision = is.readByte(); int lfClipPrecision = is.readByte(); int lfQuality = is.readByte(); int lfPitchAndFamily = is.readByte(); // don't need to read the end of the record, // because it will always be completely used int len = (2*(recSize-9)); byte[] lfFaceName = new byte[ len ]; byte ch; for ( int i = 0; i < len; i++ ) lfFaceName[ i ] = is.readByte(); String str = new String( lfFaceName ); // what locale ?? ascii ?? platform ?? mr = new MetaRecord.StringRecord( str ); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( lfHeight ); mr.addElement( lfItalic ); mr.addElement( lfWeight ); mr.addElement( lfCharSet ); mr.addElement( lfUnderline ); mr.addElement( lfStrikeOut ); mr.addElement( lfOrientation ); // escapement is the orientation of the text in tenth of degrees mr.addElement( lfEscapement ); records.add( mr ); } break; case WMFConstants.META_SETVIEWPORTORG: case WMFConstants.META_SETVIEWPORTEXT: case WMFConstants.META_SETWINDOWORG: case WMFConstants.META_SETWINDOWEXT: { mr.numPoints = recSize; mr.functionId = functionId; int height = readShort( is ); int width = readShort( is ); // inverse the values signs if they are negative if (width < 0) { width = -width; xSign = -1; } if (height < 0) { height = -height; ySign = -1; } mr.addElement((int)(width * scaleXY)); mr.addElement( height ); records.add( mr ); if (_bext && functionId == WMFConstants.META_SETWINDOWEXT) { vpW = width; vpH = height; if (! isotropic) scaleXY = (float)vpW / (float)vpH; vpW = (int)(vpW * scaleXY); _bext = false; } // sets the width, height of the image if the file does not have an APM (in this case it is retrieved // from the viewport) if (! isAldus) { this.width = vpW; this.height = vpH; } } break; case WMFConstants.META_OFFSETVIEWPORTORG: case WMFConstants.META_OFFSETWINDOWORG: { mr.numPoints = recSize; mr.functionId = functionId; int y = readShort( is ) * ySign; int x = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( x ); mr.addElement( y ); records.add( mr ); } break; case WMFConstants.META_SCALEVIEWPORTEXT: case WMFConstants.META_SCALEWINDOWEXT: { mr.numPoints = recSize; mr.functionId = functionId; int ydenom = readShort( is ); int ynum = readShort( is ); int xdenom= readShort( is ); int xnum = readShort( is ); mr.addElement( xdenom ); mr.addElement( ydenom ); mr.addElement( xnum ); mr.addElement( ynum ); records.add( mr ); scaleX = scaleX * (float)xdenom / (float)xnum; scaleY = scaleY * (float)ydenom / (float)ynum; } break; case WMFConstants.META_CREATEBRUSHINDIRECT: { mr.numPoints = recSize; mr.functionId = functionId; // The style mr.addElement( readShort( is )); int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); // The hatch style mr.addElement( readShort( is ) ); records.add( mr ); } break; case WMFConstants.META_CREATEPENINDIRECT: { mr.numPoints = recSize; mr.functionId = functionId; // The style mr.addElement( readShort( is ) ); int width = readInt( is ); int colorref = readInt( is ); /** * sometimes records generated by PPT have a * recSize of 6 and not 5 => in this case only we have * to read a last short element **/ //int height = readShort( is ); if (recSize == 6) readShort(is); int red = colorref & 0xff; // format: fff.bbbbbbbb.gggggggg.rrrrrrrr int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); // The pen width mr.addElement( width ); records.add( mr ); } break; case WMFConstants.META_SETTEXTALIGN: { mr.numPoints = recSize; mr.functionId = functionId; int align = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); mr.addElement( align ); records.add( mr ); } break; case WMFConstants.META_SETTEXTCOLOR: case WMFConstants.META_SETBKCOLOR: { mr.numPoints = recSize; mr.functionId = functionId; int colorref = readInt( is ); int red = colorref & 0xff; int green = ( colorref & 0xff00 ) >> 8; int blue = ( colorref & 0xff0000 ) >> 16; int flags = ( colorref & 0x3000000 ) >> 24; mr.addElement( red ); mr.addElement( green ); mr.addElement( blue ); records.add( mr ); } break; case WMFConstants.META_LINETO: case WMFConstants.META_MOVETO: { mr.numPoints = recSize; mr.functionId = functionId; int y = readShort( is ) * ySign; int x = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( x ); mr.addElement( y ); records.add( mr ); } break; case WMFConstants.META_SETPOLYFILLMODE : { mr.numPoints = recSize; mr.functionId = functionId; int mode = readShort( is ); // need to do this, because sometimes there is more than one short if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); mr.addElement( mode ); records.add( mr ); } break; case WMFConstants.META_POLYPOLYGON: { mr.numPoints = recSize; mr.functionId = functionId; int count = readShort( is ); // number of polygons int[] pts = new int[ count ]; int ptCount = 0; for ( int i = 0; i < count; i++ ) { pts[ i ] = readShort( is ); // number of points for the polygon ptCount += pts[ i ]; } mr.addElement( count ); for ( int i = 0; i < count; i++ ) mr.addElement( pts[ i ] ); int offset = count+1; for ( int i = 0; i < count; i++ ) { int nPoints = pts[ i ]; for ( int j = 0; j < nPoints; j++ ) { mr.addElement((int)(readShort( is ) * xSign * scaleXY)); // x position of the polygon mr.addElement( readShort( is ) * ySign ); // y position of the polygon } } records.add( mr ); } break; case WMFConstants.META_POLYLINE: case WMFConstants.META_POLYGON: { mr.numPoints = recSize; mr.functionId = functionId; int count = readShort( is ); mr.addElement( count ); for ( int i = 0; i < count; i++ ) { mr.addElement((int)(readShort( is ) * xSign * scaleXY)); mr.addElement( readShort( is ) * ySign ); } records.add( mr ); } break; case WMFConstants.META_ELLIPSE: case WMFConstants.META_INTERSECTCLIPRECT: case WMFConstants.META_RECTANGLE: { mr.numPoints = recSize; mr.functionId = functionId; int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); records.add( mr ); } break; case WMFConstants.META_CREATEREGION: { mr.numPoints = recSize; mr.functionId = functionId; int left = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); records.add( mr ); } break; case WMFConstants.META_ROUNDRECT: { mr.numPoints = recSize; mr.functionId = functionId; int el_height = readShort( is ) * ySign; int el_width = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); mr.addElement( el_width ); mr.addElement( el_height ); records.add( mr ); } break; case WMFConstants.META_ARC: case WMFConstants.META_PIE: { mr.numPoints = recSize; mr.functionId = functionId; int yend = readShort( is ) * ySign; int xend = (int)(readShort( is ) * xSign * scaleXY); int ystart = readShort( is ) * ySign; int xstart = (int)(readShort( is ) * xSign * scaleXY); int bottom = readShort( is ) * ySign; int right = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; int left = (int)(readShort( is ) * xSign * scaleXY); mr.addElement( left ); mr.addElement( top ); mr.addElement( right ); mr.addElement( bottom ); mr.addElement( xstart ); mr.addElement( ystart ); mr.addElement( xend ); mr.addElement( yend ); records.add( mr ); } break; // META_PATBLT added case WMFConstants.META_PATBLT : { mr.numPoints = recSize; mr.functionId = functionId; int rop = readInt( is ); int height = readShort( is ) * ySign; int width = (int)(readShort( is ) * xSign * scaleXY); int left = (int)(readShort( is ) * xSign * scaleXY); int top = readShort( is ) * ySign; mr.addElement( rop ); mr.addElement( height ); mr.addElement( width ); mr.addElement( top ); mr.addElement( left ); records.add( mr ); } break; case WMFConstants.META_SETBKMODE: { mr.numPoints = recSize; mr.functionId = functionId; int mode = readShort( is ); mr.addElement( mode ); //if (recSize > 1) readShort( is ); if (recSize > 1) for (int i = 1; i < recSize; i++) readShort( is ); records.add( mr ); } break; // UPDATED : META_SETROP2 added case WMFConstants.META_SETROP2: { mr.numPoints = recSize; mr.functionId = functionId; // rop should always be a short, but it is sometimes an int... int rop; if (recSize == 1) rop = readShort( is ); else rop = readInt( is ); mr.addElement( rop ); records.add( mr ); } break; // UPDATED : META_DIBSTRETCHBLT added case WMFConstants.META_DIBSTRETCHBLT: { int mode = is.readInt() & 0xff; int heightSrc = readShort( is ) * ySign; int widthSrc = readShort( is ) * xSign; int sy = readShort( is ) * ySign; int sx = readShort( is ) * xSign; int heightDst = readShort( is ) * ySign; int widthDst = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ) * ySign; int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 20; byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( mode ); mr.addElement( heightSrc ); mr.addElement( widthSrc ); mr.addElement( sy ); mr.addElement( sx ); mr.addElement( heightDst ); mr.addElement( widthDst ); mr.addElement( dy ); mr.addElement( dx ); records.add( mr ); } break; case WMFConstants.META_STRETCHDIB: { int mode = is.readInt() & 0xff; int usage = readShort( is ); int heightSrc = readShort( is ) * ySign; int widthSrc = readShort( is ) * xSign; int sy = readShort( is ) * ySign; int sx = readShort( is ) * xSign; int heightDst = readShort( is ) * ySign; int widthDst = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ) * ySign; int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 22; byte bitmap[] = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement(mode); mr.addElement(heightSrc); mr.addElement(widthSrc); mr.addElement(sy); mr.addElement(sx); mr.addElement(heightDst); mr.addElement(widthDst); mr.addElement(dy); mr.addElement(dx); records.add( mr ); } break; // UPDATED : META_DIBBITBLT added case WMFConstants.META_DIBBITBLT: { int mode = is.readInt() & 0xff; int sy = readShort( is ); int sx = readShort( is ); int hdc = readShort( is ); int height = readShort( is ); int width = (int)(readShort( is ) * xSign * scaleXY); int dy = readShort( is ); int dx = (int)(readShort( is ) * xSign * scaleXY); int len = 2*recSize - 18; if (len > 0) { byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; } else { // what does this mean?? len <= 0 ?? mr.numPoints = recSize; mr.functionId = functionId; for (int i = 0; i < len; i++) is.readByte(); } mr.addElement( mode ); mr.addElement( height ); mr.addElement( width ); mr.addElement( sy ); mr.addElement( sx ); mr.addElement( dy ); mr.addElement( dx ); records.add( mr ); } break; // UPDATED : META_CREATEPATTERNBRUSH added case WMFConstants.META_DIBCREATEPATTERNBRUSH: { int type = is.readInt() & 0xff; int len = 2*recSize - 4; byte[] bitmap = new byte[len]; for (int i = 0; i < len; i++) bitmap[i] = is.readByte(); mr = new MetaRecord.ByteRecord(bitmap); mr.numPoints = recSize; mr.functionId = functionId; mr.addElement( type ); records.add( mr ); } break; default: mr.numPoints = recSize; mr.functionId = functionId; for ( int j = 0; j < recSize; j++ ) mr.addElement( readShort( is ) ); records.add( mr ); break; } numRecords++; } // sets the characteristics of the image if the file does not have an APM (in this case it is retrieved // from the viewport). This is only useful if one wants to retrieve informations about the file after // decoding it. if (! isAldus) { right = (int)vpX; left = (int)(vpX + vpW); top = (int)vpY; bottom = (int)(vpY + vpH); } setReading( false ); return true; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
protected short readShort(DataInputStream is) throws IOException { byte js[] = new byte[ 2 ]; is.readFully(js); int iTemp = ((0xff) & js[ 1 ] ) << 8; short i = (short)(0xffff & iTemp); i |= ((0xff) & js[ 0 ] ); return i; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
protected int readInt( DataInputStream is) throws IOException { byte js[] = new byte[ 4 ]; is.readFully(js); int i = ((0xff) & js[ 3 ] ) << 24; i |= ((0xff) & js[ 2 ] ) << 16; i |= ((0xff) & js[ 1 ] ) << 8; i |= ((0xff) & js[ 0 ] ); return i; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java
public void read(DataInputStream is) throws IOException { reset(); setReading( true ); int dwIsAldus = readInt( is ); if ( dwIsAldus == WMFConstants.META_ALDUS_APM ) { // Read the aldus placeable header. int key = dwIsAldus; isAldus = true; readShort( is ); // metafile handle, always zero left = readShort( is ); top = readShort( is ); right = readShort( is ); bottom = readShort( is ); inch = readShort( is ); int reserved = readInt( is ); short checksum = readShort( is ); // inverse values if left > right or top > bottom if (left > right) { int _i = right; right = left; left = _i; xSign = -1; } if (top > bottom) { int _i = bottom; bottom = top; top = _i; ySign = -1; } width = right - left; height = bottom - top; // read the beginning of the header mtType = readShort( is ); mtHeaderSize = readShort( is ); } else { // read the beginning of the header, the first int corresponds to the first two parameters mtType = ((dwIsAldus << 16) >> 16); mtHeaderSize = dwIsAldus >> 16; } mtVersion = readShort( is ); mtSize = readInt( is ); mtNoObjects = readShort( is ); mtMaxRecord = readInt( is ); mtNoParameters = readShort( is ); numObjects = mtNoObjects; List tempList = new ArrayList( numObjects ); for ( int i = 0; i < numObjects; i++ ) { tempList.add( new GdiObject( i, false )); } objectVector.addAll( tempList ); boolean ret = readRecords(is); is.close(); if (!ret) throw new IOException("Unhandled exception while reading records"); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/RecordStore.java
public boolean read( DataInputStream is ) throws IOException{ setReading( true ); reset(); int functionId = 0; numRecords = 0; numObjects = is.readShort(); objectVector.ensureCapacity( numObjects ); for ( int i = 0; i < numObjects; i++ ) { objectVector.add( new GdiObject( i, false )); } while ( functionId != -1 ) { functionId = is.readShort(); if ( functionId == -1 ){ break; } MetaRecord mr; switch ( functionId ) { case WMFConstants.META_TEXTOUT: case WMFConstants.META_DRAWTEXT: case WMFConstants.META_EXTTEXTOUT: case WMFConstants.META_CREATEFONTINDIRECT:{ short len = is.readShort(); byte[] b = new byte[ len ]; for ( int i = 0; i < len; i++ ) { b[ i ] = is.readByte(); } String str = new String( b ); mr = new MetaRecord.StringRecord( str ); } break; default: mr = new MetaRecord(); break; } int numPts = is.readShort(); mr.numPoints = numPts; mr.functionId = functionId; for ( int j = 0; j < numPts; j++ ){ mr.AddElement( new Integer( is.readShort())); } records.add( mr ); numRecords++; } setReading( false ); return true; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
public void print(Reader r, Writer w) throws TranscoderException, IOException { try { scanner = new XMLScanner(r); output = new OutputManager(this, w); writer = w; type = scanner.next(); printXMLDecl(); misc1: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc1; } } printDoctype(); misc2: for (;;) { scanner.clearBuffer(); switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc2; } } if (type != LexicalUnits.START_TAG) { throw fatalError("element", null); } printElement(); misc3: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc3; } } } catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacter(char c) throws IOException { if (c == 10) { printNewline(); } else { column++; writer.write(c); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printNewline() throws IOException { String nl = prettyPrinter.getNewline(); for (int i = 0; i < nl.length(); i++) { writer.write(nl.charAt(i)); } column = 0; line++; }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printString(String s) throws IOException { for (int i = 0; i < s.length(); i++) { printCharacter(s.charAt(i)); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacters(char[] ca) throws IOException { for (int i = 0; i < ca.length; i++) { printCharacter(ca[i]); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printSpaces(char[] text, boolean opt) throws IOException { if (prettyPrinter.getFormat()) { if (!opt) { printCharacter(' '); } } else { printCharacters(text); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printTopSpaces(char[] text) throws IOException { if (prettyPrinter.getFormat()) { int nl = newlines(text); for (int i = 0; i < nl; i++) { printNewline(); } } else { printCharacters(text); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printComment(char[] text) throws IOException { if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } printString("<!--"); if (column + text.length + 3 < prettyPrinter.getDocumentWidth()) { printCharacters(text); } else { formatText(text, margin.toString(), false); printCharacter(' '); } if (column + 3 > prettyPrinter.getDocumentWidth()) { printNewline(); printString(margin.toString()); } printString("-->"); } else { printString("<!--"); printCharacters(text); printString("-->"); } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printXMLDecl(char[] space1, char[] space2, char[] space3, char[] version, char versionDelim, char[] space4, char[] space5, char[] space6, char[] encoding, char encodingDelim, char[] space7, char[] space8, char[] space9, char[] standalone, char standaloneDelim, char[] space10) throws IOException { printString("<?xml"); printSpaces(space1, false); printString("version"); if (space2 != null) { printSpaces(space2, true); } printCharacter('='); if (space3 != null) { printSpaces(space3, true); } printCharacter(versionDelim); printCharacters(version); printCharacter(versionDelim); if (space4 != null) { printSpaces(space4, false); if (encoding != null) { printString("encoding"); if (space5 != null) { printSpaces(space5, true); } printCharacter('='); if (space6 != null) { printSpaces(space6, true); } printCharacter(encodingDelim); printCharacters(encoding); printCharacter(encodingDelim); if (space7 != null) { printSpaces(space7, standalone == null); } } if (standalone != null) { printString("standalone"); if (space8 != null) { printSpaces(space8, true); } printCharacter('='); if (space9 != null) { printSpaces(space9, true); } printCharacter(standaloneDelim); printCharacters(standalone); printCharacter(standaloneDelim); if (space10 != null) { printSpaces(space10, true); } } } printString("?>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printPI(char[] target, char[] space, char[] data) throws IOException { if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } } printString("<?"); printCharacters(target); printSpaces(space, false); printCharacters(data); printString("?>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printDoctypeStart(char[] space1, char[] root, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException { if (prettyPrinter.getFormat()) { printString("<!DOCTYPE"); printCharacter(' '); printCharacters(root); if (space2 != null) { printCharacter(' '); printString(externalId); printCharacter(' '); printCharacter(string1Delim); printCharacters(string1); printCharacter(string1Delim); if (space4 != null) { if (string2 != null) { if (column + string2.length + 3 > prettyPrinter.getDocumentWidth()) { printNewline(); for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { printCharacter(' '); } } else { printCharacter(' '); } printCharacter(string2Delim); printCharacters(string2); printCharacter(string2Delim); printCharacter(' '); } } } } else { printString("<!DOCTYPE"); printSpaces(space1, false); printCharacters(root); if (space2 != null) { printSpaces(space2, false); printString(externalId); printSpaces(space3, false); printCharacter(string1Delim); printCharacters(string1); printCharacter(string1Delim); if (space4 != null) { printSpaces(space4, string2 == null); if (string2 != null) { printCharacter(string2Delim); printCharacters(string2); printCharacter(string2Delim); if (space5 != null) { printSpaces(space5, true); } } } } } }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printDoctypeEnd(char[] space) throws IOException { if (space != null) { printSpaces(space, true); } printCharacter('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printParameterEntityReference(char[] name) throws IOException { printCharacter('%'); printCharacters(name); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printEntityReference(char[] name, boolean first) throws IOException { if ((prettyPrinter.getFormat()) && (xmlSpace.get(0) != Boolean.TRUE) && first) { printNewline(); printString(margin.toString()); } printCharacter('&'); printCharacters(name); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCharacterEntityReference (char[] code, boolean first, boolean preceedingSpace) throws IOException { if ((prettyPrinter.getFormat()) && (xmlSpace.get(0) != Boolean.TRUE)) { if (first) { printNewline(); printString(margin.toString()); } else if (preceedingSpace) { int endCol = column + code.length + 3; if (endCol > prettyPrinter.getDocumentWidth()){ printNewline(); printString(margin.toString()); } else { printCharacter(' '); } } } printString("&#"); printCharacters(code); printCharacter(';'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printElementStart(char[] name, List attributes, char[] space) throws IOException { xmlSpace.add(0, xmlSpace.get(0)); startingLines.add(0, new Integer(line)); if (prettyPrinter.getFormat()) { if (canIndent) { printNewline(); printString(margin.toString()); } } printCharacter('<'); printCharacters(name); if (prettyPrinter.getFormat()) { Iterator it = attributes.iterator(); if (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } printCharacter(' '); printCharacters(ai.name); printCharacter('='); printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } while (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } int len = ai.name.length + ai.value.length() + 4; if (lineAttributes || len + column > prettyPrinter.getDocumentWidth()) { printNewline(); printString(margin.toString()); for (int i = 0; i < name.length + 2; i++) { printCharacter(' '); } } else { printCharacter(' '); } printCharacters(ai.name); printCharacter('='); printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } } else { Iterator it = attributes.iterator(); while (it.hasNext()) { AttributeInfo ai = (AttributeInfo)it.next(); if (ai.isAttribute("xml:space")) { xmlSpace.set(0, (ai.value.equals("preserve") ? Boolean.TRUE : Boolean.FALSE)); } printSpaces(ai.space, false); printCharacters(ai.name); if (ai.space1 != null) { printSpaces(ai.space1, true); } printCharacter('='); if (ai.space2 != null) { printSpaces(ai.space2, true); } printCharacter(ai.delimiter); printString(ai.value); printCharacter(ai.delimiter); } } if (space != null) { printSpaces(space, true); } level++; for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { margin.append(' '); } canIndent = true; }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printElementEnd(char[] name, char[] space) throws IOException { for (int i = 0; i < prettyPrinter.getTabulationWidth(); i++) { margin.deleteCharAt(0); } level--; if (name != null) { if (prettyPrinter.getFormat()) { if (xmlSpace.get(0) != Boolean.TRUE && (line != ((Integer)startingLines.get(0)).intValue() || column + name.length + 3 >= prettyPrinter.getDocumentWidth())) { printNewline(); printString(margin.toString()); } } printString("</"); printCharacters(name); if (space != null) { printSpaces(space, true); } printCharacter('>'); } else { printString("/>"); } startingLines.remove(0); xmlSpace.remove(0); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace) throws IOException { if (!prettyPrinter.getFormat()) { printCharacters(data); return false; } canIndent = true; if (isWhiteSpace(data)) { int nl = newlines(data); for (int i = 0; i < nl - 1; i++) { printNewline(); } return true; } if (xmlSpace.get(0) == Boolean.TRUE) { printCharacters(data); canIndent = false; return false; } if (first) { printNewline(); printString(margin.toString()); } return formatText(data, margin.toString(), preceedingSpace); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printCDATASection(char[] data) throws IOException { printString("<![CDATA["); printCharacters(data); printString("]]>"); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printNotation(char[] space1, char[] name, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5) throws IOException { writer.write("<!NOTATION"); printSpaces(space1, false); writer.write(name); printSpaces(space2, false); writer.write(externalId); printSpaces(space3, false); writer.write(string1Delim); writer.write(string1); writer.write(string1Delim); if (space4 != null) { printSpaces(space4, false); if (string2 != null) { writer.write(string2Delim); writer.write(string2); writer.write(string2Delim); } } if (space5 != null) { printSpaces(space5, true); } writer.write('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttlistStart(char[] space, char[] name) throws IOException { writer.write("<!ATTLIST"); printSpaces(space, false); writer.write(name); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttlistEnd(char[] space) throws IOException { if (space != null) { printSpaces(space, false); } writer.write('>'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printAttName(char[] space1, char[] name, char[] space2) throws IOException { printSpaces(space1, false); writer.write(name); printSpaces(space2, false); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
public void printEnumeration(List names) throws IOException { writer.write('('); Iterator it = names.iterator(); NameInfo ni = (NameInfo)it.next(); if (ni.space1 != null) { printSpaces(ni.space1, true); } writer.write(ni.name); if (ni.space2 != null) { printSpaces(ni.space2, true); } while (it.hasNext()) { writer.write('|'); ni = (NameInfo)it.next(); if (ni.space1 != null) { printSpaces(ni.space1, true); } writer.write(ni.name); if (ni.space2 != null) { printSpaces(ni.space2, true); } } writer.write(')'); }
// in sources/org/apache/batik/transcoder/svg2svg/OutputManager.java
protected boolean formatText(char[] text, String margin, boolean preceedingSpace) throws IOException { int i = 0; boolean startsWithSpace = preceedingSpace; loop: while (i < text.length) { for (;;) { if (i >= text.length) { break loop; } if (!XMLUtilities.isXMLSpace(text[i])) { break; } startsWithSpace = true; i++; } StringBuffer sb = new StringBuffer(); for (;;) { if (i >= text.length || XMLUtilities.isXMLSpace(text[i])) { break; } sb.append(text[i++]); } if (sb.length() == 0) { return startsWithSpace; } if (startsWithSpace) { // Consider reformatting ws so things look nicer. int endCol = column + sb.length(); if ((endCol >= prettyPrinter.getDocumentWidth() - 1) && ((margin.length() + sb.length() < prettyPrinter.getDocumentWidth() - 1) || (margin.length() < column))) { printNewline(); printString(margin); } else if (column > margin.length()) { // Don't print space at start of new line. printCharacter(' '); } } printString(sb.toString()); startsWithSpace = false; } return startsWithSpace; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void close() throws IOException { if (os == null) return; try { os.close(); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void flush() throws IOException { if (os == null) return; try { os.flush(); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(byte[] b) throws IOException { if (os == null) return; try { os.write(b); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(byte[] b, int off, int len) throws IOException { if (os == null) return; try { os.write(b, off, len); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void write(int b) throws IOException { if (os == null) return; try { os.write(b); } catch (IOException ioe) { os = null; } }
// in sources/org/apache/batik/dom/AbstractDocument.java
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); s.writeObject(implementation.getClass().getName()); }
// in sources/org/apache/batik/dom/AbstractDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); Class c = Class.forName((String)s.readObject()); try { Method m = c.getMethod("getDOMImplementation", (Class[])null); implementation = (DOMImplementation)m.invoke(null, (Object[])null); } catch (Exception e) { try { implementation = (DOMImplementation)c.newInstance(); } catch (Exception ex) { } } }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); localizableSupport = new LocalizableSupport (RESOURCES, getClass().getClassLoader()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri) throws IOException { return (SVGDocument)createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri, InputStream inp) throws IOException { return (SVGDocument)createDocument(uri, inp); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public SVGDocument createSVGDocument(String uri, Reader r) throws IOException { return (SVGDocument)createDocument(uri, r); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri) throws IOException { ParsedURL purl = new ParsedURL(uri); InputStream is = purl.openStream (MimeTypeConstants.MIME_TYPES_SVG_LIST.iterator()); uri = purl.getPostConnectionURL(); InputSource isrc = new InputSource(is); // now looking for a charset encoding in the content type such // as "image/svg+xml; charset=iso8859-1" this is not official // for image/svg+xml yet! only for text/xml and maybe // for application/xml String contentType = purl.getContentType(); int cindex = -1; if (contentType != null) { contentType = contentType.toLowerCase(); cindex = contentType.indexOf(HTTP_CHARSET); } String charset = null; if (cindex != -1) { int i = cindex + HTTP_CHARSET.length(); int eqIdx = contentType.indexOf('=', i); if (eqIdx != -1) { eqIdx++; // no one is interested in the equals sign... // The patch had ',' as the terminator but I suspect // that is the delimiter between possible charsets, // but if another 'attribute' were in the accept header // charset would be terminated by a ';'. So I look // for both and take to closer of the two. int idx = contentType.indexOf(',', eqIdx); int semiIdx = contentType.indexOf(';', eqIdx); if ((semiIdx != -1) && ((semiIdx < idx) || (idx == -1))) idx = semiIdx; if (idx != -1) charset = contentType.substring(eqIdx, idx); else charset = contentType.substring(eqIdx); charset = charset.trim(); isrc.setEncoding(charset); } } isrc.setSystemId(uri); SVGOMDocument doc = (SVGOMDocument) super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, isrc); doc.setParsedURL(new ParsedURL(uri)); doc.setDocumentInputEncoding(charset); doc.setXmlStandalone(isStandalone); doc.setXmlVersion(xmlVersion); return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, InputStream inp) throws IOException { Document doc; InputSource is = new InputSource(inp); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { Document doc; InputSource is = new InputSource(r); is.setSystemId(uri); try { doc = super.createDocument (SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", uri, is); if (uri != null) { ((SVGOMDocument)doc).setParsedURL(new ParsedURL(uri)); } AbstractDocument d = (AbstractDocument) doc; d.setDocumentURI(uri); d.setXmlStandalone(isStandalone); d.setXmlVersion(xmlVersion); } catch (MalformedURLException e) { throw new IOException(e.getMessage()); } return doc; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, is); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, r); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeDocument(Document doc, Writer w) throws IOException { AbstractDocument d = (AbstractDocument) doc; if (doc.getDocumentElement() == null) { throw new IOException("No document element"); } NSMap m = NSMap.create(); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { writeNode(n, w, m, "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static void writeNode(Node n, Writer w, NSMap m, boolean isXML11) throws IOException { switch (n.getNodeType()) { case Node.ELEMENT_NODE: { if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); if (name.startsWith("xmlns")) { if (name.length() == 5) { m = m.declare("", a.getNodeValue()); } else { String prefix = name.substring(6); m = m.declare(prefix, a.getNodeValue()); } } } } w.write('<'); String ns = n.getNamespaceURI(); String tagName; if (ns == null) { tagName = n.getNodeName(); w.write(tagName); if (!"".equals(m.getNamespace(""))) { w.write(" xmlns=\"\""); m = m.declare("", ""); } } else { String prefix = n.getPrefix(); if (prefix == null) { prefix = ""; } if (ns.equals(m.getNamespace(prefix))) { tagName = n.getNodeName(); w.write(tagName); } else { prefix = m.getPrefixForElement(ns); if (prefix == null) { prefix = m.getNewPrefix(); tagName = prefix + ':' + n.getLocalName(); w.write(tagName + " xmlns:" + prefix + "=\"" + contentToString(ns, isXML11) + '"'); m = m.declare(prefix, ns); } else { if (prefix.equals("")) { tagName = n.getLocalName(); } else { tagName = prefix + ':' + n.getLocalName(); } w.write(tagName); } } } if (n.hasAttributes()) { NamedNodeMap attr = n.getAttributes(); int len = attr.getLength(); for (int i = 0; i < len; i++) { Attr a = (Attr)attr.item(i); String name = a.getNodeName(); String prefix = a.getPrefix(); String ans = a.getNamespaceURI(); if (ans != null && !("xmlns".equals(prefix) || name.equals("xmlns"))) { if (prefix != null && !ans.equals(m.getNamespace(prefix)) || prefix == null) { prefix = m.getPrefixForAttr(ans); if (prefix == null) { prefix = m.getNewPrefix(); m = m.declare(prefix, ans); w.write(" xmlns:" + prefix + "=\"" + contentToString(ans, isXML11) + '"'); } name = prefix + ':' + a.getLocalName(); } } w.write(' ' + name + "=\"" + contentToString(a.getNodeValue(), isXML11) + '"'); } } Node c = n.getFirstChild(); if (c != null) { w.write('>'); do { writeNode(c, w, m, isXML11); c = c.getNextSibling(); } while (c != null); w.write("</" + tagName + '>'); } else { w.write("/>"); } break; } case Node.TEXT_NODE: w.write(contentToString(n.getNodeValue(), isXML11)); break; case Node.CDATA_SECTION_NODE: { String data = n.getNodeValue(); if (data.indexOf("]]>") != -1) { throw new IOException("Unserializable CDATA section node"); } w.write("<![CDATA[" + assertValidCharacters(data, isXML11) + "]]>"); break; } case Node.ENTITY_REFERENCE_NODE: w.write('&' + n.getNodeName() + ';'); break; case Node.PROCESSING_INSTRUCTION_NODE: { String target = n.getNodeName(); String data = n.getNodeValue(); if (target.equalsIgnoreCase("xml") || target.indexOf(':') != -1 || data.indexOf("?>") != -1) { throw new IOException("Unserializable processing instruction node"); } w.write("<?" + target + ' ' + data + "?>"); break; } case Node.COMMENT_NODE: { w.write("<!--"); String data = n.getNodeValue(); int len = data.length(); if (len != 0 && data.charAt(len - 1) == '-' || data.indexOf("--") != -1) { throw new IOException("Unserializable comment node"); } w.write(data); w.write("-->"); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType dt = (DocumentType)n; w.write("<!DOCTYPE " + n.getOwnerDocument().getDocumentElement().getNodeName()); String pubID = dt.getPublicId(); if (pubID != null) { char q = getUsableQuote(pubID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } w.write(" PUBLIC " + q + pubID + q); } String sysID = dt.getSystemId(); if (sysID != null) { char q = getUsableQuote(sysID); if (q == 0) { throw new IOException("Unserializable DOCTYPE node"); } if (pubID == null) { w.write(" SYSTEM"); } w.write(" " + q + sysID + q); } String subset = dt.getInternalSubset(); if (subset != null) { w.write('[' + subset + ']'); } w.write('>'); break; } default: throw new IOException("Unknown DOM node type " + n.getNodeType()); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static void writeNode(Node n, Writer w) throws IOException { if (n.getNodeType() == Node.DOCUMENT_NODE) { writeDocument((Document) n, w); } else { AbstractDocument d = (AbstractDocument) n.getOwnerDocument(); writeNode(n, w, NSMap.create(), d == null ? false : "1.1".equals(d.getXmlVersion())); } }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
protected static String assertValidCharacters(String s, boolean isXML11) throws IOException { int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } } return s; }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
public static String contentToString(String s, boolean isXML11) throws IOException { StringBuffer result = new StringBuffer(s.length()); int len = s.length(); for (int i = 0; i < len; i++) { char c = s.charAt(i); if (!isXML11 && !isXMLCharacter(c) || isXML11 && !isXML11Character(c)) { throw new IOException("Invalid character"); } switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; default: result.append(c); } } return result.toString(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { return createDocument(ns, root, uri, new InputSource(uri)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri) throws IOException { return createDocument(new InputSource(uri)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { InputSource inp = new InputSource(is); inp.setSystemId(uri); return createDocument(ns, root, uri, inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri, InputStream is) throws IOException { InputSource inp = new InputSource(is); inp.setSystemId(uri); return createDocument(inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { InputSource inp = new InputSource(r); inp.setSystemId(uri); return createDocument(ns, root, uri, inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, XMLReader r) throws IOException { r.setContentHandler(this); r.setDTDHandler(this); r.setEntityResolver(this); try { r.parse(uri); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String uri, Reader r) throws IOException { InputSource inp = new InputSource(r); inp.setSystemId(uri); return createDocument(inp); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(String ns, String root, String uri, InputSource is) throws IOException { Document ret = createDocument(is); Element docElem = ret.getDocumentElement(); String lname = root; String nsURI = ns; if (ns == null) { int idx = lname.indexOf(':'); String nsp = (idx == -1 || idx == lname.length()-1) ? "" : lname.substring(0, idx); nsURI = namespaces.get(nsp); if (idx != -1 && idx != lname.length()-1) { lname = lname.substring(idx+1); } } String docElemNS = docElem.getNamespaceURI(); if ((docElemNS != nsURI) && ((docElemNS == null) || (!docElemNS.equals(nsURI)))) throw new IOException ("Root element namespace does not match that requested:\n" + "Requested: " + nsURI + "\n" + "Found: " + docElemNS); if (docElemNS != null) { if (!docElem.getLocalName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getLocalName()); } else { if (!docElem.getNodeName().equals(lname)) throw new IOException ("Root element does not match that requested:\n" + "Requested: " + lname + "\n" + "Found: " + docElem.getNodeName()); } return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string1() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string2() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '"': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int dotNumber() throws IOException { loop: for (;;) { switch (nextChar()) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/bridge/URIResolver.java
public Element getElement(String uri, Element ref) throws MalformedURLException, IOException { Node n = getNode(uri, ref); if (n == null) { return null; } else if (n.getNodeType() == Node.DOCUMENT_NODE) { throw new IllegalArgumentException(); } else { return (Element)n; } }
// in sources/org/apache/batik/bridge/URIResolver.java
public Node getNode(String uri, Element ref) throws MalformedURLException, IOException, SecurityException { String baseURI = getRefererBaseURI(ref); // System.err.println("baseURI: " + baseURI); // System.err.println("URI: " + uri); if (baseURI == null && uri.charAt(0) == '#') { return getNodeByFragment(uri.substring(1), ref); } ParsedURL purl = new ParsedURL(baseURI, uri); // System.err.println("PURL: " + purl); if (documentURI == null) documentURI = document.getURL(); String frag = purl.getRef(); if ((frag != null) && (documentURI != null)) { ParsedURL pDocURL = new ParsedURL(documentURI); // System.out.println("doc: " + pDocURL); // System.out.println("Purl: " + purl); if (pDocURL.sameFile(purl)) { // System.out.println("match"); return document.getElementById(frag); } } // uri is not a reference into this document, so load the // document it does reference after doing a security // check with the UserAgent ParsedURL pDocURL = null; if (documentURI != null) { pDocURL = new ParsedURL(documentURI); } UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); String purlStr = purl.toString(); if (frag != null) { purlStr = purlStr.substring(0, purlStr.length()-(frag.length()+1)); } Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag); return doc; }
// in sources/org/apache/batik/bridge/DocumentLoader.java
public Document loadDocument(String uri) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
// in sources/org/apache/batik/bridge/DocumentLoader.java
public Document loadDocument(String uri, InputStream is) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri, is); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public void reset() throws IOException { throw new IOException("Reset unsupported"); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void retry() throws IOException { super.reset(); wasClosed = false; isTied = false; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void close() throws IOException { wasClosed = true; if (isTied) { super.close(); // System.err.println("Closing stream - from close"); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
public synchronized void tie() throws IOException { isTied = true; if (wasClosed) { super.close(); // System.err.println("Closing stream - from tie"); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected ProtectedStream openStream(Element e, ParsedURL purl) throws IOException { List mimeTypes = new ArrayList (ImageTagRegistry.getRegistry().getRegisteredMimeTypes()); mimeTypes.addAll(MimeTypeConstants.MIME_TYPES_SVG_LIST); InputStream reference = purl.openStream(mimeTypes.iterator()); return new ProtectedStream(reference); }
// in sources/org/apache/batik/util/ParsedURLData.java
public static InputStream checkGZIP(InputStream is) throws IOException { if (!is.markSupported()) is = new BufferedInputStream(is); byte[] data = new byte[2]; try { is.mark(2); is.read(data); is.reset(); } catch (Exception ex) { is.reset(); return is; } if ((data[0] == GZIP_MAGIC[0]) && (data[1] == GZIP_MAGIC[1])) return new GZIPInputStream(is); if (((data[0]&0x0F) == 8) && ((data[0]>>>4) <= 7)) { // Check for a zlib (deflate) stream int chk = ((((int)data[0])&0xFF)*256+ (((int)data[1])&0xFF)); if ((chk %31) == 0) { try { // I'm not really as certain of this check // as I would like so I want to force it // to decode part of the stream. is.mark(100); InputStream ret = new InflaterInputStream(is); if (!ret.markSupported()) ret = new BufferedInputStream(ret); ret.mark(2); ret.read(data); is.reset(); ret = new InflaterInputStream(is); return ret; } catch (ZipException ze) { is.reset(); return is; } } } return is; }
// in sources/org/apache/batik/util/ParsedURLData.java
public InputStream openStream(String userAgent, Iterator mimeTypes) throws IOException { InputStream raw = openStreamInternal(userAgent, mimeTypes, acceptedEncodings.iterator()); if (raw == null) return null; stream = null; return checkGZIP(raw); }
// in sources/org/apache/batik/util/ParsedURLData.java
public InputStream openStreamRaw(String userAgent, Iterator mimeTypes) throws IOException { InputStream ret = openStreamInternal(userAgent, mimeTypes, null); stream = null; return ret; }
// in sources/org/apache/batik/util/ParsedURLData.java
protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { if (stream != null) return stream; hasBeenOpened = true; URL url = null; try { url = buildURL(); } catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); } if (url == null) return null; URLConnection urlC = url.openConnection(); if (urlC instanceof HttpURLConnection) { if (userAgent != null) urlC.setRequestProperty(HTTP_USER_AGENT_HEADER, userAgent); if (mimeTypes != null) { String acceptHeader = ""; while (mimeTypes.hasNext()) { acceptHeader += mimeTypes.next(); if (mimeTypes.hasNext()) acceptHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_HEADER, acceptHeader); } if (encodingTypes != null) { String encodingHeader = ""; while (encodingTypes.hasNext()) { encodingHeader += encodingTypes.next(); if (encodingTypes.hasNext()) encodingHeader += ","; } urlC.setRequestProperty(HTTP_ACCEPT_ENCODING_HEADER, encodingHeader); } contentType = urlC.getContentType(); contentEncoding = urlC.getContentEncoding(); postConnectionURL = urlC.getURL(); } try { return (stream = urlC.getInputStream()); } catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public InputStream getInputStream() throws IOException { return jar.jarFile.getInputStream(jar.jarFile.getEntry(name)); }
// in sources/org/apache/batik/util/ClassFileUtilities.java
private static void collectJars(File dir, Map jars, Map classFiles) throws IOException { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { String n = files[i].getName(); if (n.endsWith(".jar") && files[i].isFile()) { Jar j = new Jar(); j.name = files[i].getPath(); j.file = files[i]; j.jarFile = new JarFile(files[i]); jars.put(j.name, j); Enumeration entries = j.jarFile.entries(); while (entries.hasMoreElements()) { ZipEntry ze = (ZipEntry) entries.nextElement(); String name = ze.getName(); if (name.endsWith(".class")) { ClassFile cf = new ClassFile(); cf.name = name; cf.jar = j; classFiles.put(j.name + '!' + cf.name, cf); j.files.add(cf); } } } else if (files[i].isDirectory()) { collectJars(files[i], jars, classFiles); } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(String path, Set classpath, boolean rec) throws IOException { return getClassDependencies(new FileInputStream(path), classpath, rec); }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is, Set classpath, boolean rec) throws IOException { Set result = new HashSet(); Set done = new HashSet(); computeClassDependencies(is, classpath, done, result, rec); return result; }
// in sources/org/apache/batik/util/ClassFileUtilities.java
private static void computeClassDependencies(InputStream is, Set classpath, Set done, Set result, boolean rec) throws IOException { Iterator it = getClassDependencies(is).iterator(); while (it.hasNext()) { String s = (String)it.next(); if (!done.contains(s)) { done.add(s); Iterator cpit = classpath.iterator(); while (cpit.hasNext()) { InputStream depis = null; String path = null; Object cpEntry = cpit.next(); if (cpEntry instanceof JarFile) { JarFile jarFile = (JarFile) cpEntry; String classFileName = s + ".class"; ZipEntry ze = jarFile.getEntry(classFileName); if (ze != null) { path = jarFile.getName() + '!' + classFileName; depis = jarFile.getInputStream(ze); } } else { path = ((String) cpEntry) + '/' + s + ".class"; File f = new File(path); if (f.isFile()) { depis = new FileInputStream(f); } } if (depis != null) { result.add(path); if (rec) { computeClassDependencies (depis, classpath, done, result, rec); } } } } } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
// in sources/org/apache/batik/util/io/ISO_8859_1Decoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return -1; } return buffer[position++] & 0xff; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public int read() throws IOException { int result = nextChar; if (result != -1) { nextChar = -1; if (result == 13) { column = 0; line++; } else { column++; } return result; } result = charDecoder.readChar(); switch (result) { case 13: column = 0; line++; int c = charDecoder.readChar(); if (c == 10) { return 10; } nextChar = c; return 10; case 10: column = 0; line++; } return result; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public void close() throws IOException { charDecoder.dispose(); charDecoder = null; }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
protected CharDecoder createCharDecoder(InputStream is, String enc) throws IOException { CharDecoderFactory cdf = (CharDecoderFactory)charDecoderFactories.get(enc.toUpperCase()); if (cdf != null) { return cdf.createCharDecoder(is); } String e = EncodingUtilities.javaEncoding(enc); if (e == null) { e = enc; } return new GenericDecoder(is, e); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new ASCIIDecoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new ISO_8859_1Decoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new UTF8Decoder(is); }
// in sources/org/apache/batik/util/io/StreamNormalizingReader.java
public CharDecoder createCharDecoder(InputStream is) throws IOException { return new UTF16Decoder(is); }
// in sources/org/apache/batik/util/io/StringDecoder.java
public int readChar() throws IOException { if (next == length) { return END_OF_STREAM; } return string.charAt(next++); }
// in sources/org/apache/batik/util/io/StringDecoder.java
public void dispose() throws IOException { string = null; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
public void dispose() throws IOException { inputStream.close(); inputStream = null; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void fillBuffer() throws IOException { count = inputStream.read(buffer, 0, BUFFER_SIZE); position = 0; }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void charError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("invalid.char", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/AbstractCharDecoder.java
protected void endOfStreamError(String encoding) throws IOException { throw new IOException (Messages.formatMessage("end.of.stream", new Object[] { encoding })); }
// in sources/org/apache/batik/util/io/ASCIIDecoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } int result = buffer[position++]; if (result < 0) { charError("ASCII"); } return result; }
// in sources/org/apache/batik/util/io/UTF16Decoder.java
public int readChar() throws IOException { if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } byte b1 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-16"); } byte b2 = buffer[position++]; int c = (bigEndian) ? (((b1 & 0xff) << 8) | (b2 & 0xff)) : (((b2 & 0xff) << 8) | (b1 & 0xff)); if (c == 0xfffe) { charError("UTF-16"); } return c; }
// in sources/org/apache/batik/util/io/GenericDecoder.java
public int readChar() throws IOException { return reader.read(); }
// in sources/org/apache/batik/util/io/GenericDecoder.java
public void dispose() throws IOException { reader.close(); reader = null; }
// in sources/org/apache/batik/util/io/NormalizingReader.java
public int read(char[] cbuf, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } int result = 0; do { cbuf[result + off] = (char)c; result++; c = read(); } while (c != -1 && result < len); return result; }
// in sources/org/apache/batik/util/io/StringNormalizingReader.java
public int read() throws IOException { int result = (length == next) ? -1 : string.charAt(next++); if (result <= 13) { switch (result) { case 13: column = 0; line++; int c = (length == next) ? -1 : string.charAt(next); if (c == 10) { next++; } return 10; case 10: column = 0; line++; } } return result; }
// in sources/org/apache/batik/util/io/StringNormalizingReader.java
public void close() throws IOException { string = null; }
// in sources/org/apache/batik/util/io/UTF8Decoder.java
public int readChar() throws IOException { if (nextChar != -1) { int result = nextChar; nextChar = -1; return result; } if (position == count) { fillBuffer(); } if (count == -1) { return END_OF_STREAM; } int b1 = buffer[position++] & 0xff; switch (UTF8_BYTES[b1]) { default: charError("UTF-8"); case 1: return b1; case 2: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } return ((b1 & 0x1f) << 6) | (buffer[position++] & 0x3f); case 3: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b2 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b3 = buffer[position++]; if ((b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80) { charError("UTF-8"); } return ((b1 & 0x1f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x1f); case 4: if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } b2 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } b3 = buffer[position++]; if (position == count) { fillBuffer(); } if (count == -1) { endOfStreamError("UTF-8"); } int b4 = buffer[position++]; if ((b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80 || (b4 & 0xc0) != 0x80) { charError("UTF-8"); } int c = ((b1 & 0x1f) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x1f) << 6) | (b4 & 0x1f); nextChar = (c - 0x10000) % 0x400 + 0xdc00; return (c - 0x10000) / 0x400 + 0xd800; } }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void close () throws IOException { if (out != null) { encodeAtom(); out.flush(); if (closeOutOnClose) out.close(); out=null; } }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void flush() throws IOException { out.flush(); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(int b) throws IOException { atom[atomLen++] = (byte)b; if (atomLen == 3) encodeAtom(); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(byte []data) throws IOException { encodeFromArray(data, 0, data.length); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
public void write(byte [] data, int off, int len) throws IOException { encodeFromArray(data, off, len); }
// in sources/org/apache/batik/util/Base64EncoderStream.java
void encodeAtom() throws IOException { byte a, b, c; switch (atomLen) { case 0: return; case 1: a = atom[0]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[((a << 4) & 0x30)]; encodeBuf[2] = encodeBuf[3] = '='; break; case 2: a = atom[0]; b = atom[1]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[((b << 2) & 0x3C)]; encodeBuf[3] = '='; break; default: a = atom[0]; b = atom[1]; c = atom[2]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))]; encodeBuf[3] = pem_array[c & 0x3F]; } if (lineLen == 64) { out.println(); lineLen = 0; } out.write(encodeBuf); lineLen += 4; atomLen = 0; }
// in sources/org/apache/batik/util/Base64EncoderStream.java
void encodeFromArray(byte[] data, int offset, int len) throws IOException{ byte a, b, c; if (len == 0) return; // System.out.println("atomLen: " + atomLen + // " len: " + len + // " offset: " + offset); if (atomLen != 0) { switch(atomLen) { case 1: atom[1] = data[offset++]; len--; atomLen++; if (len == 0) return; atom[2] = data[offset++]; len--; atomLen++; break; case 2: atom[2] = data[offset++]; len--; atomLen++; break; default: } encodeAtom(); } while (len >=3) { a = data[offset++]; b = data[offset++]; c = data[offset++]; encodeBuf[0] = pem_array[((a >>> 2) & 0x3F)]; encodeBuf[1] = pem_array[(((a << 4) & 0x30) | ((b >>> 4) & 0x0F))]; encodeBuf[2] = pem_array[(((b << 2) & 0x3C) | ((c >>> 6) & 0x03))]; encodeBuf[3] = pem_array[c & 0x3F]; out.write(encodeBuf); lineLen += 4; if (lineLen == 64) { out.println(); lineLen = 0; } len -=3; } switch (len) { case 1: atom[0] = data[offset]; break; case 2: atom[0] = data[offset]; atom[1] = data[offset+1]; break; default: } atomLen = len; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public void close() throws IOException { EOF = true; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int available() throws IOException { return 3-out_offset; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int read() throws IOException { if (out_offset == 3) { if (EOF || getNextAtom()) { EOF = true; return -1; } } return ((int)out_buffer[out_offset++])&0xFF; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
public int read(byte []out, int offset, int len) throws IOException { int idx = 0; while (idx < len) { if (out_offset == 3) { if (EOF || getNextAtom()) { EOF = true; if (idx == 0) return -1; else return idx; } } out[offset+idx] = out_buffer[out_offset++]; idx++; } return idx; }
// in sources/org/apache/batik/util/Base64DecodeStream.java
final boolean getNextAtom() throws IOException { int count, a, b, c, d; int off = 0; while(off != 4) { count = src.read(decode_buffer, off, 4-off); if (count == -1) return true; int in=off, out=off; while(in < off+count) { if ((decode_buffer[in] != '\n') && (decode_buffer[in] != '\r') && (decode_buffer[in] != ' ')) decode_buffer[out++] = decode_buffer[in]; in++; } off = out; } a = pem_array[((int)decode_buffer[0])&0xFF]; b = pem_array[((int)decode_buffer[1])&0xFF]; c = pem_array[((int)decode_buffer[2])&0xFF]; d = pem_array[((int)decode_buffer[3])&0xFF]; out_buffer[0] = (byte)((a<<2) | (b>>>4)); out_buffer[1] = (byte)((b<<4) | (c>>>2)); out_buffer[2] = (byte)((c<<6) | d ); if (decode_buffer[3] != '=') { // All three bytes are good. out_offset=0; } else if (decode_buffer[2] == '=') { // Only one byte of output. out_buffer[2] = out_buffer[0]; out_offset = 2; EOF=true; } else { // Only two bytes of output. out_buffer[2] = out_buffer[1]; out_buffer[1] = out_buffer[0]; out_offset = 1; EOF=true; } return false; }
// in sources/org/apache/batik/util/ParsedURLDataProtocolHandler.java
protected InputStream openStreamInternal (String userAgent, Iterator mimeTypes, Iterator encodingTypes) throws IOException { stream = decode(path); if (BASE64.equals(contentEncoding)) { stream = new Base64DecodeStream(stream); } return stream; }
// in sources/org/apache/batik/util/ParsedURL.java
public static InputStream checkGZIP(InputStream is) throws IOException { return ParsedURLData.checkGZIP(is); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream() throws IOException { return data.openStream(userAgent, null); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(String mimeType) throws IOException { List mt = new ArrayList(1); mt.add(mimeType); return data.openStream(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); for (int i=0; i<mimeTypes.length; i++) mt.add(mimeTypes[i]); return data.openStream(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStream(Iterator mimeTypes) throws IOException { return data.openStream(userAgent, mimeTypes); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw() throws IOException { return data.openStreamRaw(userAgent, null); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(String mimeType) throws IOException { List mt = new ArrayList(1); mt.add(mimeType); return data.openStreamRaw(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); mt.addAll(Arrays.asList(mimeTypes)); return data.openStreamRaw(userAgent, mt.iterator()); }
// in sources/org/apache/batik/util/ParsedURL.java
public InputStream openStreamRaw(Iterator mimeTypes) throws IOException { return data.openStreamRaw(userAgent, mimeTypes); }
// in sources/org/apache/batik/util/PreferenceManager.java
public void load() throws IOException { FileInputStream fis = null; if (fullName != null) try { fis = new FileInputStream(fullName); } catch (IOException e1) { fullName = null; } if (fullName == null) { if (PREF_DIR != null) { try { fis = new FileInputStream(fullName = PREF_DIR+FILE_SEP+prefFileName); } catch (IOException e2) { fullName = null; } } if (fullName == null) { try { fis = new FileInputStream(fullName = USER_HOME+FILE_SEP+prefFileName); } catch (IOException e3) { try { fis = new FileInputStream(fullName = USER_DIR+FILE_SEP+prefFileName); } catch (IOException e4) { fullName = null; } } } } if (fullName != null) { try { internal.load(fis); } finally { fis.close(); } } }
// in sources/org/apache/batik/util/PreferenceManager.java
public void save() throws IOException { FileOutputStream fos = null; if (fullName != null) try { fos = new FileOutputStream(fullName); } catch(IOException e1) { fullName = null; } if (fullName == null) { if (PREF_DIR != null) { try { fos = new FileOutputStream(fullName = PREF_DIR+FILE_SEP+prefFileName); } catch (IOException e2) { fullName = null; } } if (fullName == null) { try { fos = new FileOutputStream(fullName = USER_HOME+FILE_SEP+prefFileName); } catch (IOException e3) { fullName = null; throw e3; } } } try { internal.store(fos, prefFileName); } finally { fos.close(); } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { scanner = createScanner(source); try { documentHandler.startDocument(source); current = scanner.next(); switch (current) { case LexicalUnits.CHARSET_SYMBOL: if (nextIgnoreSpaces() != LexicalUnits.STRING) { reportError("charset.string"); } else { if (nextIgnoreSpaces() != LexicalUnits.SEMI_COLON) { reportError("semicolon"); } next(); } break; case LexicalUnits.COMMENT: documentHandler.comment(scanner.getStringValue()); } skipSpacesAndCDOCDC(); for (;;) { if (current == LexicalUnits.IMPORT_SYMBOL) { nextIgnoreSpaces(); parseImportRule(); nextIgnoreSpaces(); } else { break; } } loop: for (;;) { switch (current) { case LexicalUnits.PAGE_SYMBOL: nextIgnoreSpaces(); parsePageRule(); break; case LexicalUnits.MEDIA_SYMBOL: nextIgnoreSpaces(); parseMediaRule(); break; case LexicalUnits.FONT_FACE_SYMBOL: nextIgnoreSpaces(); parseFontFaceRule(); break; case LexicalUnits.AT_KEYWORD: nextIgnoreSpaces(); parseAtRule(); break; case LexicalUnits.EOF: break loop; default: parseRuleSet(); } skipSpacesAndCDOCDC(); } } finally { documentHandler.endDocument(source); scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parseStyleSheet(new InputSource(uri)); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseStyleDeclarationInternal() throws CSSException, IOException { nextIgnoreSpaces(); try { parseStyleDeclaration(false); } catch (CSSParseException e) { reportError(e); } finally { scanner = null; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(InputSource source) throws CSSException, IOException { scanner = createScanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected void parseRuleInternal() throws CSSException, IOException { nextIgnoreSpaces(); parseRule(); scanner = null; }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected SelectorList parseSelectorsInternal() throws CSSException, IOException { nextIgnoreSpaces(); SelectorList ret = parseSelectorList(); scanner = null; return ret; }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected LexicalUnit parsePropertyValueInternal() throws CSSException, IOException { nextIgnoreSpaces(); LexicalUnit exp = null; try { exp = parseExpression(false); } catch (CSSParseException e) { reportError(e); throw e; } CSSParseException exception = null; if (current != LexicalUnits.EOF) exception = createCSSParseException("eof.expected"); scanner = null; if (exception != null) { errorHandler.fatalError(exception); } return exp; }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { scanner = createScanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
protected boolean parsePriorityInternal() throws CSSException, IOException { nextIgnoreSpaces(); scanner = null; switch (current) { case LexicalUnits.EOF: return false; case LexicalUnits.IMPORT_SYMBOL: return true; default: reportError("token", new Object[] { new Integer(current) }); return false; } }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { scanner = new Scanner(source); parseStyleDeclarationInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public void parseRule(String source) throws CSSException, IOException { scanner = new Scanner(source); parseRuleInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { scanner = new Scanner(source); return parseSelectorsInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePropertyValueInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public boolean parsePriority(String source) throws CSSException, IOException { scanner = new Scanner(source); return parsePriorityInternal(); }
// in sources/org/apache/batik/css/parser/Parser.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(InputSource source) throws CSSException, IOException { parser.parseStyleSheet(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleSheet(String uri) throws CSSException, IOException { parser.parseStyleSheet(uri); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(InputSource source) throws CSSException, IOException { parser.parseStyleDeclaration(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseStyleDeclaration(String source) throws CSSException, IOException { parser.parseStyleDeclaration (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(InputSource source) throws CSSException, IOException { parser.parseRule(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public void parseRule(String source) throws CSSException, IOException { parser.parseRule(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(InputSource source) throws CSSException, IOException { return parser.parseSelectors(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SelectorList parseSelectors(String source) throws CSSException, IOException { return parser.parseSelectors (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, IOException { return parser.parsePropertyValue(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public LexicalUnit parsePropertyValue(String source) throws CSSException, IOException { return parser.parsePropertyValue (new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(InputSource source) throws CSSException, IOException { return parser.parsePriority(source); }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public SACMediaList parseMedia(String mediaText) throws CSSException, IOException { CSSSACMediaList result = new CSSSACMediaList(); if (!"all".equalsIgnoreCase(mediaText)) { StringTokenizer st = new StringTokenizer(mediaText, " ,"); while (st.hasMoreTokens()) { result.append(st.nextToken()); } } return result; }
// in sources/org/apache/batik/css/parser/ExtendedParserWrapper.java
public boolean parsePriority(String source) throws CSSException, IOException { return parser.parsePriority(new InputSource(new StringReader(source))); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string1() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; case '"': break; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string2() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break; case '"': break loop; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(true); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int dotNumber() throws IOException { loop: for (;;) { switch (nextChar()) { default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(false); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int numberUnit(boolean integer) throws IOException { switch (current) { case '%': nextChar(); return LexicalUnits.PERCENTAGE; case 'c': case 'C': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.CM; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'd': case 'D': switch(nextChar()) { case 'e': case 'E': switch(nextChar()) { case 'g': case 'G': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.DEG; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'e': case 'E': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.EM; case 'x': case 'X': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.EX; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'g': case 'G': switch(nextChar()) { case 'r': case 'R': switch(nextChar()) { case 'a': case 'A': switch(nextChar()) { case 'd': case 'D': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.GRAD; } } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'h': case 'H': nextChar(); switch(current) { case 'z': case 'Z': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.HZ; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'i': case 'I': switch(nextChar()) { case 'n': case 'N': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.IN; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'k': case 'K': switch(nextChar()) { case 'h': case 'H': switch(nextChar()) { case 'z': case 'Z': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.KHZ; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'm': case 'M': switch(nextChar()) { case 'm': case 'M': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.MM; case 's': case 'S': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.MS; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'p': case 'P': switch(nextChar()) { case 'c': case 'C': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PC; case 't': case 'T': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PT; case 'x': case 'X': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.PX; default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 'r': case 'R': switch(nextChar()) { case 'a': case 'A': switch(nextChar()) { case 'd': case 'D': nextChar(); if (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); return LexicalUnits.DIMENSION; } return LexicalUnits.RAD; } default: while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } return LexicalUnits.DIMENSION; } case 's': case 'S': nextChar(); return LexicalUnits.S; default: if (current != -1 && ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); return LexicalUnits.DIMENSION; } return (integer) ? LexicalUnits.INTEGER : LexicalUnits.REAL; } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void escape() throws IOException { if (ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } } if ((current >= ' ' && current <= '~') || current >= 128) { nextChar(); return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int nextChar() throws IOException { current = reader.read(); if (current == -1) { return current; } if (position == buffer.length) { // list is full, grow to 1.5 * size char[] t = new char[ 1 + position + position / 2]; System.arraycopy( buffer, 0, t, 0, position ); buffer = t; } return buffer[position++] = (char)current; }
// in sources/org/apache/batik/css/engine/CSSEngine.java
protected void parseStyleSheet(StyleSheet ss, InputSource is, ParsedURL uri) throws IOException { parser.setSelectorFactory(CSSSelectorFactory.INSTANCE); parser.setConditionFactory(cssConditionFactory); try { cssBaseURI = uri; styleSheetDocumentHandler.styleSheet = ss; parser.setDocumentHandler(styleSheetDocumentHandler); parser.parseStyleSheet(is); // Load the imported sheets. int len = ss.getSize(); for (int i = 0; i < len; i++) { Rule r = ss.getRule(i); if (r.getType() != ImportRule.TYPE) { // @import rules must be the first rules. break; } ImportRule ir = (ImportRule)r; parseStyleSheet(ir, ir.getURI()); } } finally { cssBaseURI = null; } }
122
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (IOException ioe) { System.err.println("Error while reading file-list: " + file); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (IOException ioe) { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (IOException e1) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (IOException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch (IOException ioe) { // Nothing... }
// in sources/org/apache/batik/apps/svgbrowser/XMLPreferenceManager.java
catch (IOException ex) { // unlikely to happen }
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) {}
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { return; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { return false; }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException e) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(e)); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (IOException io) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(io)); }
// in sources/org/apache/batik/svggen/font/Font.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/script/ImportInfo.java
catch (IOException ioe) { return ret; }
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/ImportInfo.java
catch ( IOException ignored ){}
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/script/rhino/RhinoClassLoader.java
catch (IOException e){ p = null; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { return false; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch(IOException ioe) { // Couldn't open the stream, go to next entry. openFailed = true; continue; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (IOException ioe) { // Something bad happened here... filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (IOException ioe) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
catch (IOException e) { markPos = -1L; }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch (IOException ex) { handler.fatalError(new TranscoderException(ex)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
catch (IOException e) { }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); return; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (IOException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ioe) { os = null; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/dom/util/DOMUtilities.java
catch (IOException ex) { return ""; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (IOException e) { if (userAgent != null) { userAgent.displayError(e); } return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (IOException io) { }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ioe) { // Do nothing, can't really happen with StringReader }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { // This would be from a close, Let it slide... }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (IOException ioe) { // Like Duh! what would you do close it again? }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (java.io.IOException e) { s = null; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/gui/UserStyleDialog.java
catch (IOException ex) { }
// in sources/org/apache/batik/util/gui/URIChooser.java
catch (IOException ex) { }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException ioe) { /* nothing */ }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException ioe) { /* nothing */ }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
// in sources/org/apache/batik/util/ClassFileUtilities.java
catch (IOException e) { e.printStackTrace(); }
// in sources/org/apache/batik/util/Service.java
catch (IOException ioe) { return l.iterator(); }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/Service.java
catch (IOException ignored) { }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e1) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e2) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { try { fis = new FileInputStream(fullName = USER_DIR+FILE_SEP+prefFileName); } catch (IOException e4) { fullName = null; } }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e4) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch(IOException e1) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e2) { fullName = null; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { fullName = null; throw e3; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
55
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (IOException ioEx) { throw new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); // ??? IS THAT AN ERROR FOR THE SVG SPEC ??? }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(IOException ioEx ) { throw new BridgeException(ctx, e, ioEx, ERR_URI_IO, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (IOException e) { if (urlC instanceof HttpURLConnection) { // bug 49889: if available, return the error stream // (allow interpretation of content in the HTTP error response) return (stream = ((HttpURLConnection) urlC).getErrorStream()); } else { throw e; } }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (IOException e3) { fullName = null; throw e3; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (IOException e) { throw new CSSException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
32
unknown (Lib) IllegalAccessException 0 0 0 13
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalAccessException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (IllegalAccessException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (IllegalAccessException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
10
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (IllegalAccessException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.access", new Object[] { pn })); }
9
runtime (Lib) IllegalArgumentException 187
            
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
public void handle(ParsedURL purl, JSVGViewerFrame svgViewerFrame) throws Exception { String uri = purl.toString(); TransformerFactory tFactory = TransformerFactory.newInstance(); // First, load the input XML document into a generic DOM tree DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document inDoc = db.parse(uri); // Now, look for <?xml-stylesheet ...?> processing instructions String xslStyleSheetURI = extractXSLProcessingInstruction(inDoc); if (xslStyleSheetURI == null) { // Assume that the input file is a literal result template xslStyleSheetURI = uri; } ParsedURL parsedXSLStyleSheetURI = new ParsedURL(uri, xslStyleSheetURI); Transformer transformer = tFactory.newTransformer (new StreamSource(parsedXSLStyleSheetURI.toString())); // Set the URIResolver to properly handle document() and xsl:include transformer.setURIResolver (new DocumentURIResolver(parsedXSLStyleSheetURI.toString())); // Now, apply the transformation to the input document. // // <!> Due to issues with namespaces, the transform creates the // result in a stream which is parsed. This is sub-optimal // but this was the only solution found to be able to // generate content in the proper namespaces. // // SVGOMDocument outDoc = // (SVGOMDocument)impl.createDocument(svgNS, "svg", null); // outDoc.setURLObject(new URL(uri)); // transformer.transform // (new DOMSource(inDoc), // new DOMResult(outDoc.getDocumentElement())); // StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); transformer.transform(new DOMSource(inDoc), result); sw.flush(); sw.close(); String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); SVGDocument outDoc = null; try { outDoc = f.createSVGDocument (uri, new StringReader(sw.toString())); } catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); } // Patch the result tree to go under the root node // checkAndPatch(outDoc); svgViewerFrame.getJSVGCanvas().setSVGDocument(outDoc); svgViewerFrame.setSVGDocument(outDoc, uri, outDoc.getTitle()); }
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
protected void checkAndPatch(Document doc) { Element root = doc.getDocumentElement(); Node realRoot = root.getFirstChild(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; if (realRoot == null) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_PRODUCED_NO_CONTENT)); } if (realRoot.getNodeType() != Node.ELEMENT_NODE || !SVGConstants.SVG_SVG_TAG.equals(realRoot.getLocalName())) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_OUTPUT_NOT_SVG)); } if (!svgNS.equals(realRoot.getNamespaceURI())) { throw new IllegalArgumentException (Resources.getString(ERROR_TRANSFORM_OUTPUT_WRONG_NS)); } Node child = realRoot.getFirstChild(); while ( child != null ) { root.appendChild(child); child = realRoot.getFirstChild(); } NamedNodeMap attrs = realRoot.getAttributes(); int n = attrs.getLength(); for (int i=0; i<n; i++) { root.setAttributeNode((Attr)attrs.item(i)); } root.removeChild(realRoot); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public float getLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public float getBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/apps/svgbrowser/LocalHistory.java
public int getItemIndex( JMenuItem item ) { int ic = menu.getItemCount(); for ( int i = index; i < ic; i++ ) { if ( menu.getItem( i ) == item ) { return i - index; } } throw new IllegalArgumentException("MenuItem is not from my menu!" ); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String[] optionValues, SVGConverter c){ int nOptions = optionValues != null? optionValues.length: 0; if (nOptions != getOptionValuesLength()){ throw new IllegalArgumentException(); } safeHandleOption(optionValues, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ try{ handleOption(Float.parseFloat(optionValue), c); } catch(NumberFormatException e){ throw new IllegalArgumentException(); } }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, final SVGConverter c) { try { ClockParser p = new ClockParser(false); p.setClockHandler(new ClockHandler() { public void clockValue(float v) { handleOption(v, c); } }); p.parse(optionValue); } catch (ParseException e) { throw new IllegalArgumentException(); } }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ Rectangle2D r = parseRect(optionValue); if (r==null){ throw new IllegalArgumentException(); } handleOption(r, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ Color color = parseARGB(optionValue); if (color==null){ throw new IllegalArgumentException(); } handleOption(color, c); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(String optionValue, SVGConverter c){ DestinationType dstType = (DestinationType)mimeTypeMap.get(optionValue); if (dstType == null){ throw new IllegalArgumentException(); } c.setDestinationType(dstType); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setWidth(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setHeight(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setMaxWidth(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setMaxHeight(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0){ throw new IllegalArgumentException(); } c.setPixelUnitToMillimeter ((2.54f/optionValue)*10); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if (optionValue <= 0 || optionValue >= 1){ throw new IllegalArgumentException(); } c.setQuality(optionValue); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
public void handleOption(float optionValue, SVGConverter c){ if ((optionValue != 1) && (optionValue != 2) && (optionValue != 4) && (optionValue != 8)) throw new IllegalArgumentException(); c.setIndexed((int)optionValue); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setDestinationType(DestinationType destinationType) { if(destinationType == null){ throw new IllegalArgumentException(); } this.destinationType = destinationType; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setQuality(float quality) throws IllegalArgumentException { if(quality >= 1){ throw new IllegalArgumentException(); } this.quality = quality; }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } Object val = values.get(arguments[index++]); if (val == null) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE, val); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } Object val = values.get(arguments[index++]); if (val == null) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_NEWLINE, val); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_PUBLIC_ID, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_SYSTEM_ID, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } String s = arguments[index++]; transcoder.addTranscodingHint(SVGTranscoder.KEY_XML_DECLARATION, s); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_TABULATION_WIDTH, new Integer(arguments[index++])); }
// in sources/org/apache/batik/apps/svgpp/Main.java
public void handleOption() { index++; if (index >= arguments.length) { throw new IllegalArgumentException(); } transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCUMENT_WIDTH, new Integer(arguments[index++])); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
void setImageCacher(ImageCacher imageCacher) { if (imageCacher == null){ throw new IllegalArgumentException(); } // Save current DOMTreeManager if any DOMTreeManager dtm = null; if (this.imageCacher != null){ dtm = this.imageCacher.getDOMTreeManager(); } this.imageCacher = imageCacher; if (dtm != null){ this.imageCacher.setDOMTreeManager(dtm); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
public void setDOMTreeManager(DOMTreeManager domTreeManager) { if (domTreeManager == null){ throw new IllegalArgumentException(); } this.domTreeManager = domTreeManager; }
// in sources/org/apache/batik/anim/timing/TimeContainer.java
public void addChild(TimedElement e) { if (e == this) { throw new IllegalArgumentException("recursive datastructure not allowed here!"); } children.add(e); e.parent = this; setRoot(e, root); root.fireElementAdded(e); root.currentIntervalWillUpdate(); }
// in sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java
public void transform(AffineTransform at) { if (at.getType() != AffineTransform.TYPE_IDENTITY) throw new IllegalArgumentException ("ExtendedGeneralPaths can not be transformed"); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // Can't modify the transform passed in... transform = new AffineTransform(transform); // incorporate the gradient transform transform.concatenate(gradientTransform); try{ return new RadialGradientPaintContext (cm, deviceBounds, userBounds, transform, hints, (float)center.getX(), (float)center.getY(), radius, (float)focus.getX(), (float)focus.getY(), fractions, colors, cycleMethod, colorSpace); } catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); } }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // Can't modify the transform passed in... transform = new AffineTransform(transform); //incorporate the gradient transform transform.concatenate(gradientTransform); try { return new LinearGradientPaintContext(cm, deviceBounds, userBounds, transform, hints, start, end, fractions, this.getColors(), cycleMethod, colorSpace); } catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); } }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
public static WritableRaster copyRaster(Raster ras, int minX, int minY) { WritableRaster ret = Raster.createWritableRaster (ras.getSampleModel(), new Point(0,0)); ret = ret.createWritableChild (ras.getMinX()-ras.getSampleModelTranslateX(), ras.getMinY()-ras.getSampleModelTranslateY(), ras.getWidth(), ras.getHeight(), minX, minY, null); // Use System.arraycopy to copy the data between the two... DataBuffer srcDB = ras.getDataBuffer(); DataBuffer retDB = ret.getDataBuffer(); if (srcDB.getDataType() != retDB.getDataType()) { throw new IllegalArgumentException ("New DataBuffer doesn't match original"); } int len = srcDB.getSize(); int banks = srcDB.getNumBanks(); int [] offsets = srcDB.getOffsets(); for (int b=0; b< banks; b++) { switch (srcDB.getDataType()) { case DataBuffer.TYPE_BYTE: { DataBufferByte srcDBT = (DataBufferByte)srcDB; DataBufferByte retDBT = (DataBufferByte)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_INT: { DataBufferInt srcDBT = (DataBufferInt)srcDB; DataBufferInt retDBT = (DataBufferInt)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_SHORT: { DataBufferShort srcDBT = (DataBufferShort)srcDB; DataBufferShort retDBT = (DataBufferShort)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } case DataBuffer.TYPE_USHORT: { DataBufferUShort srcDBT = (DataBufferUShort)srcDB; DataBufferUShort retDBT = (DataBufferUShort)retDB; System.arraycopy(srcDBT.getData(b), offsets[b], retDBT.getData(b), offsets[b], len); break; } } } return ret; }
// in sources/org/apache/batik/ext/awt/image/rendered/ColorMatrixRed.java
public void setMatrix(float[][] matrix){ float[][] tmp = copyMatrix(matrix); if(tmp == null){ throw new IllegalArgumentException(); } if(tmp.length != 4){ throw new IllegalArgumentException(); } for(int i=0; i<4; i++){ if(tmp[i].length != 5){ throw new IllegalArgumentException( String.valueOf( i ) + " : " + tmp[i].length); } } this.matrix = matrix; }
// in sources/org/apache/batik/ext/awt/image/rendered/TurbulencePatternRed.java
public WritableRaster copyData(WritableRaster dest) { // // First, check input arguments // if(dest==null) throw new IllegalArgumentException ("Cannot generate a noise pattern into a null raster"); int w = dest.getWidth(); int h = dest.getHeight(); // Access the integer buffer for the destination Raster DataBufferInt dstDB = (DataBufferInt)dest.getDataBuffer(); SinglePixelPackedSampleModel sppsm; int minX = dest.getMinX(); int minY = dest.getMinY(); sppsm = (SinglePixelPackedSampleModel)dest.getSampleModel(); int dstOff = dstDB.getOffset() + sppsm.getOffset(minX - dest.getSampleModelTranslateX(), minY - dest.getSampleModelTranslateY()); final int[] destPixels = dstDB.getBankData()[0]; int dstAdjust = sppsm.getScanlineStride() - w; // Generate pixel pattern now int i, end, dp=dstOff; final int[] rgb = new int[4]; final double[] fSum = {0, 0, 0, 0}; final double[] noise = {0, 0, 0, 0}; final double tx0, tx1, ty0, ty1; tx0 = tx[0]; tx1 = tx[1]; // Update for y step, (note we substract all the stuff we // added while going across the scan line). ty0 = ty[0]-(w*tx0); ty1 = ty[1]-(w*tx1); double[] p = {minX, minY}; txf.transform(p, 0, p, 0, 1); double point_0 = p[0]; double point_1 = p[1]; if(isFractalNoise){ if(stitchInfo == null){ if (channels.length == 4) { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++) { destPixels[dp] = turbulenceFractal_4 (point_0, point_1, fSum); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } else { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ turbulenceFractal(rgb, point_0, point_1, fSum, noise); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ StitchInfo si = new StitchInfo(); for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ si.assign(this.stitchInfo); turbulenceFractalStitch(rgb, point_0, point_1, fSum, noise, si); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ // Loop for turbulence noise if(stitchInfo == null){ if (channels.length == 4) { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ destPixels[dp] = turbulence_4 (point_0, point_1, fSum); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } else { for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ turbulence(rgb, point_0, point_1, fSum, noise); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } else{ StitchInfo si = new StitchInfo(); for(i=0; i<h; i++){ for(end=dp+w; dp<end; dp++){ si.assign(this.stitchInfo); turbulenceStitch(rgb, point_0, point_1, fSum, noise, si); // Write RGB value. destPixels[dp] = ((rgb[3]<<24) | (rgb[0]<<16) | (rgb[1]<<8) | (rgb[2] )); point_0 += tx0; point_1 += tx1; } point_0 += ty0; point_1 += ty1; dp += dstAdjust; } } } return dest; }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
private void checkCompatible(ColorModel colorModel, SampleModel sampleModel){ ColorSpace cs = colorModel.getColorSpace(); // Check that model is sRGB or linear RGB if((!cs .equals (sRGB)) && (!cs .equals( lRGB))) throw new IllegalArgumentException("Expected CS_sRGB or CS_LINEAR_RGB color model"); // Check ColorModel is of type DirectColorModel if(!(colorModel instanceof DirectColorModel)) throw new IllegalArgumentException("colorModel should be an instance of DirectColorModel"); // Check transfer type if(sampleModel.getDataType() != DataBuffer.TYPE_INT) throw new IllegalArgumentException("colorModel's transferType should be DataBuffer.TYPE_INT"); // Check red, green, blue and alpha mask DirectColorModel dcm = (DirectColorModel)colorModel; if(dcm.getRedMask() != 0x00ff0000) throw new IllegalArgumentException("red mask in source should be 0x00ff0000"); if(dcm.getGreenMask() != 0x0000ff00) throw new IllegalArgumentException("green mask in source should be 0x0000ff00"); if(dcm.getBlueMask() != 0x000000ff) throw new IllegalArgumentException("blue mask in source should be 0x000000ff"); if(dcm.getAlphaMask() != 0xff000000) throw new IllegalArgumentException("alpha mask in source should be 0xff000000"); }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
private void checkCompatible(SampleModel model){ // Check model is ok: should be SinglePixelPackedSampleModel if(!(model instanceof SinglePixelPackedSampleModel)) throw new IllegalArgumentException ("MorphologyOp only works with Rasters " + "using SinglePixelPackedSampleModels"); // Check number of bands int nBands = model.getNumBands(); if(nBands!=4) throw new IllegalArgumentException ("MorphologyOp only words with Rasters having 4 bands"); // Check that integer packed. if(model.getDataType()!=DataBuffer.TYPE_INT) throw new IllegalArgumentException ("MorphologyOp only works with Rasters using DataBufferInt"); // Check bit masks int[] bitOffsets=((SinglePixelPackedSampleModel)model).getBitOffsets(); for(int i=0; i<bitOffsets.length; i++){ if(bitOffsets[i]%8 != 0) throw new IllegalArgumentException ("MorphologyOp only works with Rasters using 8 bits " + "per band : " + i + " : " + bitOffsets[i]); } }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
public WritableRaster filter(Raster src, WritableRaster dest){ // //This method sorts the pixel values in the kernel window in two steps: // 1. sort by row and store the result into an intermediate matrix // 2. sort the intermediate matrix by column and output the max/min value // into the destination matrix element //check destation if(dest!=null) checkCompatible(dest.getSampleModel()); else { if(src==null) throw new IllegalArgumentException("src should not be null when dest is null"); else dest = createCompatibleDestRaster(src); } final int w = src.getWidth(); final int h = src.getHeight(); // Access the integer buffer for each image. DataBufferInt srcDB = (DataBufferInt)src.getDataBuffer(); DataBufferInt dstDB = (DataBufferInt)dest.getDataBuffer(); // Offset defines where in the stack the real data begin final int srcOff = srcDB.getOffset(); final int dstOff = dstDB.getOffset(); // Stride is the distance between two consecutive column elements, // in the one-dimention dataBuffer final int srcScanStride = ((SinglePixelPackedSampleModel)src.getSampleModel()).getScanlineStride(); final int dstScanStride = ((SinglePixelPackedSampleModel)dest.getSampleModel()).getScanlineStride(); // Access the pixel value array final int[] srcPixels = srcDB.getBankData()[0]; final int[] destPixels = dstDB.getBankData()[0]; // The pointer of src and dest indicating where the pixel values are int sp, dp, cp; // Declaration for the circular buffer's implementation // These are the circular buffers' head pointer and // the index pointers // bufferHead points to the leftmost element in the circular buffer int bufferHead; int maxIndexA; int maxIndexR; int maxIndexG; int maxIndexB; // Temp variables int pel, currentPixel, lastPixel; int a,r,g,b; int a1,r1,g1,b1; // In both round, we are using an optimization approach // to reduce excessive computation to sort values around // the current pixel. The idea is as follows: // ---------------- // |*|V|V|$|N|V|V|&| // ---------------- // For example, suppose we've finished pixel"$" and come // to "N", the radius is 3. Then we must have got the max/min // value and index array for "$". If the max/min is at // "*"(using the index array to judge this), // we need to recompute a max/min and the index array // for "N"; if the max/min is not at "*", we can // reuse the current max/min: we simply compare it with // "&", and update the max/min and the index array. // // The first round: sort by row // if (w<=2*radiusX){ specialProcessRow(src, dest); } // when the size is large enough, we can // use standard optimization method else { final int [] bufferA = new int [rangeX]; final int [] bufferR = new int [rangeX]; final int [] bufferG = new int [rangeX]; final int [] bufferB = new int [rangeX]; for (int i=0; i<h; i++){ // initialization of pointers, indice // at the head of each row sp = srcOff + i*srcScanStride; dp = dstOff + i*dstScanStride; bufferHead = 0; maxIndexA = 0; maxIndexR = 0; maxIndexG = 0; maxIndexB = 0; // // j=0 : Initialization, compute the max/min and // index array for the use of other pixels. // pel = srcPixels[sp++]; a = pel>>>24; r = pel&0xff0000; g = pel&0xff00; b = pel&0xff; bufferA[0] = a; bufferR[0] = r; bufferG[0] = g; bufferB[0] = b; for (int k=1; k<=radiusX; k++){ currentPixel = srcPixels[sp++]; a1 = currentPixel>>>24; r1 = currentPixel&0xff0000; g1 = currentPixel&0xff00; b1 = currentPixel&0xff; bufferA[k] = a1; bufferR[k] = r1; bufferG[k] = g1; bufferB[k] = b1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = k; } if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = k; } if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = k; } if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = k; } } destPixels[dp++] = (a << 24) | r | g | b; // // 1 <= j <= radiusX : The left margin of each row. // for (int j=1; j<=radiusX; j++){ lastPixel = srcPixels[sp++]; // here is the Alpha channel // we retrieve the previous max/min value a = bufferA[maxIndexA]; a1 = lastPixel>>>24; bufferA[j+radiusX] = a1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = j+radiusX; } // now we deal with the Red channel r = bufferR[maxIndexR]; r1 = lastPixel&0xff0000; bufferR[j+radiusX] = r1; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = j+radiusX; } // now we deal with the Green channel g = bufferG[maxIndexG]; g1 = lastPixel&0xff00; bufferG[j+radiusX] = g1; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = j+radiusX; } // now we deal with the Blue channel b = bufferB[maxIndexB]; b1 = lastPixel&0xff; bufferB[j+radiusX] = b1; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = j+radiusX; } // now we have gone through the four channels and // updated the index array. then we'll pack the // new max/min value according to each channel's // max/min vlue destPixels[dp++] = (a << 24) | r | g | b; } // // radiusX <= j <= w-1-radiusX : Inner body of the row, between // left and right margins // for (int j=radiusX+1; j<=w-1-radiusX; j++){ lastPixel = srcPixels[sp++]; a1 = lastPixel>>>24; r1 = lastPixel&0xff0000; g1 = lastPixel&0xff00; b1 = lastPixel&0xff; bufferA[bufferHead] = a1; bufferR[bufferHead] = r1; bufferG[bufferHead] = g1; bufferB[bufferHead] = b1; // Alpha channel: // we need to recompute a local max/min // and update the max/min index if (maxIndexA == bufferHead){ a = bufferA[0]; maxIndexA = 0; for (int m= 1; m< rangeX; m++){ a1 = bufferA[m]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = m; } } } // we can reuse the previous max/min value else { a = bufferA[maxIndexA]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = bufferHead; } } // Red channel // we need to recompute a local max/min // and update the index array if (maxIndexR == bufferHead){ r = bufferR[0]; maxIndexR = 0; for (int m= 1; m< rangeX; m++){ r1 = bufferR[m]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = m; } } } // we can reuse the previous max/min value else { r = bufferR[maxIndexR]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = bufferHead; } } // Green channel // we need to recompute a local max/min // and update the index array if (maxIndexG == bufferHead){ g = bufferG[0]; maxIndexG = 0; for (int m= 1; m< rangeX; m++){ g1 = bufferG[m]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = m; } } } // we can reuse the previous max/min value else { g = bufferG[maxIndexG]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = bufferHead; } } // Blue channel // we need to recompute a local max/min // and update the index array if (maxIndexB == bufferHead){ b = bufferB[0]; maxIndexB = 0; for (int m= 1; m< rangeX; m++){ b1 = bufferB[m]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = m; } } } // we can reuse the previous max/min value else { b = bufferB[maxIndexB]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = bufferHead; } } destPixels[dp++] = (a << 24) | r | g | b; bufferHead = (bufferHead+1)%rangeX; } // // w-radiusX <= j < w : The right margin of the row // // Head will be updated to indicate the current head // of the remaining buffer int head; // Tail is where the last element is final int tail = (bufferHead == 0)?rangeX-1:bufferHead -1; int count = rangeX-1; for (int j=w-radiusX; j<w; j++){ head = (bufferHead+1)%rangeX; // Dealing with Alpha Channel: if (maxIndexA == bufferHead){ a = bufferA[tail]; int hd = head; for(int m=1; m<count; m++) { a1 = bufferA[hd]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = hd; } hd = (hd+1)%rangeX; } } // Dealing with Red Channel: if (maxIndexR == bufferHead){ r = bufferR[tail]; int hd = head; for(int m=1; m<count; m++) { r1 = bufferR[hd]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = hd; } hd = (hd+1)%rangeX; } } // Dealing with Green Channel: if (maxIndexG == bufferHead){ g = bufferG[tail]; int hd = head; for(int m=1; m<count; m++) { g1 = bufferG[hd]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = hd; } hd = (hd+1)%rangeX; } } // Dealing with Blue Channel: if (maxIndexB == bufferHead){ b = bufferB[tail]; int hd = head; for(int m=1; m<count; m++) { b1 = bufferB[hd]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = hd; } hd = (hd+1)%rangeX; } } destPixels[dp++] = (a << 24) | r | g | b; bufferHead = (bufferHead+1)%rangeX; // we throw another element count--; }// end of the right margin of this row // return to the beginning of the next row } }// end of the first round! // // Second round: sort by column // the difference from the first round is that // now we are accessing the intermediate matrix // // When the image size is smaller than the // Kernel size if (h<=2*radiusY){ specialProcessColumn(src, dest); } // when the size is large enough, we can // use standard optimization method else { final int [] bufferA = new int [rangeY]; final int [] bufferR = new int [rangeY]; final int [] bufferG = new int [rangeY]; final int [] bufferB = new int [rangeY]; for (int j=0; j<w; j++){ // initialization of pointers, indice // at the head of each column dp = dstOff + j; cp = dstOff + j; bufferHead = 0; maxIndexA = 0; maxIndexR = 0; maxIndexG = 0; maxIndexB = 0; // i=0 : The first pixel pel = destPixels[cp]; cp += dstScanStride; a = pel>>>24; r = pel&0xff0000; g = pel&0xff00; b = pel&0xff; bufferA[0] = a; bufferR[0] = r; bufferG[0] = g; bufferB[0] = b; for (int k=1; k<=radiusY; k++){ currentPixel = destPixels[cp]; cp += dstScanStride; a1 = currentPixel>>>24; r1 = currentPixel&0xff0000; g1 = currentPixel&0xff00; b1 = currentPixel&0xff; bufferA[k] = a1; bufferR[k] = r1; bufferG[k] = g1; bufferB[k] = b1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = k; } if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = k; } if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = k; } if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = k; } } destPixels[dp] = (a << 24) | r | g | b; // go to the next element in the column. dp += dstScanStride; // 1 <= i <= radiusY : The upper margin of each row for (int i=1; i<=radiusY; i++){ int maxI = i+radiusY; // we can reuse the previous max/min value lastPixel = destPixels[cp]; cp += dstScanStride; // here is the Alpha channel a = bufferA[maxIndexA]; a1 = lastPixel>>>24; bufferA[maxI] = a1; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = maxI; } // now we deal with the Red channel r = bufferR[maxIndexR]; r1 = lastPixel&0xff0000; bufferR[maxI] = r1; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = maxI; } // now we deal with the Green channel g = bufferG[maxIndexG]; g1 = lastPixel&0xff00; bufferG[maxI] = g1; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = maxI; } // now we deal with the Blue channel b = bufferB[maxIndexB]; b1 = lastPixel&0xff; bufferB[maxI] = b1; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = maxI; } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; } // // radiusY +1 <= i <= h-1-radiusY: // inner body of the column between upper and lower margins // for (int i=radiusY+1; i<=h-1-radiusY; i++){ lastPixel = destPixels[cp]; cp += dstScanStride; a1 = lastPixel>>>24; r1 = lastPixel&0xff0000; g1 = lastPixel&0xff00; b1 = lastPixel&0xff; bufferA[bufferHead] = a1; bufferR[bufferHead] = r1; bufferG[bufferHead] = g1; bufferB[bufferHead] = b1; // here we check if the previous max/min value can be // reused safely and, if possible, reuse the previous // maximum value // Alpha channel: // Recompute the local max/min if (maxIndexA == bufferHead){ a = bufferA[0]; maxIndexA = 0; for (int m= 1; m<= 2*radiusY; m++){ a1 = bufferA[m]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = m; } } } // we can reuse the previous max/min value else { a = bufferA[maxIndexA]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = bufferHead; } } // Red channel: if (maxIndexR == bufferHead){ r = bufferR[0]; maxIndexR = 0; for (int m= 1; m<= 2*radiusY; m++){ r1 = bufferR[m]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = m; } } } // we can reuse the previous max/min value else { r = bufferR[maxIndexR]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = bufferHead; } } // Green channel if (maxIndexG == bufferHead){ g = bufferG[0]; maxIndexG = 0; for (int m= 1; m<= 2*radiusY; m++){ g1 = bufferG[m]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = m; } } } // we can reuse the previous max/min value else { g = bufferG[maxIndexG]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = bufferHead; } } // Blue channel: if (maxIndexB == bufferHead){ b = bufferB[0]; maxIndexB = 0; for (int m= 1; m<= 2*radiusY; m++){ b1 = bufferB[m]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = m; } } } // we can reuse the previous max/min value else { b = bufferB[maxIndexB]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = bufferHead; } } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; bufferHead = (bufferHead+1)%rangeY; } // // h-radiusY <= i <= h-1 : The lower margin of the column // // head will be updated to indicate the current head // of the remaining buffer: int head; // tail is where the last element in the buffer is final int tail = (bufferHead == 0)?2*radiusY:bufferHead -1; int count = rangeY-1; for (int i= h-radiusY; i<h-1; i++){ head = (bufferHead +1)%rangeY; if (maxIndexA == bufferHead){ a = bufferA[tail]; int hd = head; for (int m=1; m<count; m++){ a1 = bufferA[hd]; if (isBetter(a1, a, doDilation)){ a = a1; maxIndexA = hd; } hd = (hd+1)%rangeY; } } if (maxIndexR == bufferHead){ r = bufferR[tail]; int hd = head; for (int m=1; m<count; m++){ r1 = bufferR[hd]; if (isBetter(r1, r, doDilation)){ r = r1; maxIndexR = hd; } hd = (hd+1)%rangeY; } } if (maxIndexG == bufferHead){ g = bufferG[tail]; int hd = head; for (int m=1; m<count; m++){ g1 = bufferG[hd]; if (isBetter(g1, g, doDilation)){ g = g1; maxIndexG = hd; } hd = (hd+1)%rangeY; } } if (maxIndexB == bufferHead){ b = bufferB[tail]; int hd = head; for (int m=1; m<count; m++){ b1 = bufferB[hd]; if (isBetter(b1, b, doDilation)){ b = b1; maxIndexB = hd; } hd = (hd+1)%rangeY; } } destPixels[dp] = (a << 24) | r | g | b; dp += dstScanStride; bufferHead = (bufferHead+1)%rangeY; // we throw out this useless element count--; } // return to the beginning of the next column } }// end of the second round! return dest; }
// in sources/org/apache/batik/ext/awt/image/rendered/CompositeRed.java
protected static ColorModel fixColorModel(CachableRed src) { ColorModel cm = src.getColorModel(); if (cm.hasAlpha()) { if (!cm.isAlphaPremultiplied()) cm = GraphicsUtil.coerceColorModel(cm, true); return cm; } int b = src.getSampleModel().getNumBands()+1; if (b > 4) throw new IllegalArgumentException ("CompositeRed can only handle up to three band images"); int [] masks = new int[4]; for (int i=0; i < b-1; i++) masks[i] = 0xFF0000 >> (8*i); masks[3] = 0xFF << (8*(b-1)); ColorSpace cs = cm.getColorSpace(); return new DirectColorModel(cs, 8*b, masks[0], masks[1], masks[2], masks[3], true, DataBuffer.TYPE_INT); }
// in sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
public static CachableRed construct(CachableRed src, ColorModel cm) { ColorModel srcCM = src.getColorModel(); if ((cm.hasAlpha() != srcCM.hasAlpha()) || (cm.isAlphaPremultiplied() != srcCM.isAlphaPremultiplied())) return new FormatRed(src, cm); if (cm.getNumComponents() != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible ColorModel given"); if ((srcCM instanceof ComponentColorModel) && (cm instanceof ComponentColorModel)) return src; if ((srcCM instanceof DirectColorModel) && (cm instanceof DirectColorModel)) return src; return new FormatRed(src, cm); }
// in sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
public static ColorModel makeColorModel(CachableRed cr, SampleModel sm) { ColorModel srcCM = cr.getColorModel(); ColorSpace cs = srcCM.getColorSpace(); int bands = sm.getNumBands(); int bits; int dt = sm.getDataType(); switch (dt) { case DataBuffer.TYPE_BYTE: bits=8; break; case DataBuffer.TYPE_SHORT: bits=16; break; case DataBuffer.TYPE_USHORT: bits=16; break; case DataBuffer.TYPE_INT: bits=32; break; default: throw new IllegalArgumentException ("Unsupported DataBuffer type: " + dt); } boolean hasAlpha = srcCM.hasAlpha(); if (hasAlpha){ // if Src has Alpha then our out bands must // either be one less than the source (no out alpha) // or equal (still has alpha) if (bands == srcCM.getNumComponents()-1) hasAlpha = false; else if (bands != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible number of bands in and out"); } else { if (bands == srcCM.getNumComponents()+1) hasAlpha = true; else if (bands != srcCM.getNumComponents()) throw new IllegalArgumentException ("Incompatible number of bands in and out"); } boolean preMult = srcCM.isAlphaPremultiplied(); if (!hasAlpha) preMult = false; if (sm instanceof ComponentSampleModel) { int [] bitsPer = new int[bands]; for (int i=0; i<bands; i++) bitsPer[i] = bits; return new ComponentColorModel (cs, bitsPer, hasAlpha, preMult, hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE, dt); } else if (sm instanceof SinglePixelPackedSampleModel) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)sm; int[] masks = sppsm.getBitMasks(); if (bands == 4) return new DirectColorModel (cs, bits, masks[0], masks[1], masks[2], masks[3], preMult, dt); else if (bands == 3) return new DirectColorModel (cs, bits, masks[0], masks[1], masks[2], 0x0, preMult, dt); else throw new IllegalArgumentException ("Incompatible number of bands out for ColorModel"); } throw new IllegalArgumentException ("Unsupported SampleModel Type"); }
// in sources/org/apache/batik/ext/awt/image/rendered/GaussianBlurRed8Bit.java
protected static ColorModel fixColorModel(CachableRed src) { ColorModel cm = src.getColorModel(); int b = src.getSampleModel().getNumBands(); int [] masks = new int[4]; switch (b) { case 1: masks[0] = 0xFF; break; case 2: masks[0] = 0x00FF; masks[3] = 0xFF00; break; case 3: masks[0] = 0xFF0000; masks[1] = 0x00FF00; masks[2] = 0x0000FF; break; case 4: masks[0] = 0x00FF0000; masks[1] = 0x0000FF00; masks[2] = 0x000000FF; masks[3] = 0xFF000000; break; default: throw new IllegalArgumentException ("GaussianBlurRed8Bit only supports one to four band images"); } ColorSpace cs = cm.getColorSpace(); return new DirectColorModel(cs, 8*b, masks[0], masks[1], masks[2], masks[3], true, DataBuffer.TYPE_INT); }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterResRable8Bit.java
public void setFilterResolutionX(int filterResolutionX){ if(filterResolutionX < 0){ throw new IllegalArgumentException(); } touch(); this.filterResolutionX = filterResolutionX; }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setSources(List sources){ if(sources.size() != 2){ throw new IllegalArgumentException(); } init(sources, null); }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setXChannelSelector(ARGBChannel xChannelSelector){ if(xChannelSelector == null){ throw new IllegalArgumentException(); } touch(); this.xChannelSelector = xChannelSelector; }
// in sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
public void setYChannelSelector(ARGBChannel yChannelSelector){ if(yChannelSelector == null){ throw new IllegalArgumentException(); } touch(); this.yChannelSelector = yChannelSelector; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
public void setStdDeviationX(double stdDeviationX){ if(stdDeviationX < 0){ throw new IllegalArgumentException(); } touch(); this.stdDeviationX = stdDeviationX; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
public void setStdDeviationY(double stdDeviationY){ if(stdDeviationY < 0){ throw new IllegalArgumentException(); } touch(); this.stdDeviationY = stdDeviationY; }
// in sources/org/apache/batik/ext/awt/image/renderable/FloodRable8Bit.java
public void setFloodRegion(Rectangle2D floodRegion){ if(floodRegion == null){ throw new IllegalArgumentException(); } touch(); this.floodRegion = floodRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/MorphologyRable8Bit.java
public void setRadiusX(double radiusX){ if(radiusX <= 0){ throw new IllegalArgumentException(); } touch(); this.radiusX = radiusX; }
// in sources/org/apache/batik/ext/awt/image/renderable/MorphologyRable8Bit.java
public void setRadiusY(double radiusY){ if(radiusY <= 0){ throw new IllegalArgumentException(); } touch(); this.radiusY = radiusY; }
// in sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable8Bit.java
public static ColorMatrixRable buildMatrix(float[][] matrix){ if(matrix == null){ throw new IllegalArgumentException(); } if(matrix.length != 4){ throw new IllegalArgumentException(); } float[][] newMatrix = new float[4][]; for(int i=0; i<4; i++){ float[] m = matrix[i]; if(m == null){ throw new IllegalArgumentException(); } if(m.length != 5){ throw new IllegalArgumentException(); } newMatrix[i] = new float[5]; for(int j=0; j<5; j++){ newMatrix[i][j] = m[j]; } } /*for(int i=0; i<4; i++){ for(int j=0; j<5; j++) System.out.print(newMatrix[i][j] + " "); System.out.println(); }*/ ColorMatrixRable8Bit filter = new ColorMatrixRable8Bit(); filter.type = TYPE_MATRIX; filter.matrix = newMatrix; return filter; }
// in sources/org/apache/batik/ext/awt/image/renderable/TileRable8Bit.java
public void setTileRegion(Rectangle2D tileRegion){ if(tileRegion == null){ throw new IllegalArgumentException(); } touch(); this.tileRegion = tileRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/TileRable8Bit.java
public void setTiledRegion(Rectangle2D tiledRegion){ if(tiledRegion == null){ throw new IllegalArgumentException(); } touch(); this.tiledRegion = tiledRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java
public RenderedImage createRendering(RenderContext rc) { // Just copy over the rendering hints. RenderingHints rh = rc.getRenderingHints(); if (rh == null) rh = new RenderingHints(null); // update the current affine transform AffineTransform at = rc.getTransform(); // This splits out the scale and applies it // prior to the Gaussian. Then after appying the gaussian // it applies the shear (rotation) and translation components. double sx = at.getScaleX(); double sy = at.getScaleY(); double shx = at.getShearX(); double shy = at.getShearY(); double tx = at.getTranslateX(); double ty = at.getTranslateY(); // The Scale is the "hypotonose" of the matrix vectors. This // represents the complete scaling value from user to an // intermediate space that is scaled similarly to device // space. double scaleX = Math.sqrt(sx*sx + shy*shy); double scaleY = Math.sqrt(sy*sy + shx*shx); // These values represent the scale factor to the intermediate // coordinate system where we will apply our convolution. if (kernelUnitLength != null) { if (kernelUnitLength[0] > 0.0) scaleX = 1/kernelUnitLength[0]; if (kernelUnitLength[1] > 0.0) scaleY = 1/kernelUnitLength[1]; } Shape aoi = rc.getAreaOfInterest(); if(aoi == null) aoi = getBounds2D(); Rectangle2D r = aoi.getBounds2D(); int kw = kernel.getWidth(); int kh = kernel.getHeight(); int kx = target.x; int ky = target.y; // Grow the region in usr space. { double rx0 = r.getX() -(kx/scaleX); double ry0 = r.getY() -(ky/scaleY); double rx1 = rx0 + r.getWidth() + (kw-1)/scaleX; double ry1 = ry0 + r.getHeight() + (kh-1)/scaleY; r = new Rectangle2D.Double(Math.floor(rx0), Math.floor(ry0), Math.ceil (rx1-Math.floor(rx0)), Math.ceil (ry1-Math.floor(ry0))); } // This will be the affine transform between our usr space and // an intermediate space which is scaled according to // kernelUnitLength and is axially aligned with our user // space. AffineTransform srcAt = AffineTransform.getScaleInstance(scaleX, scaleY); // This is the affine transform between our intermediate // coordinate space (where the convolution takes place) and // the real device space, or null (if we don't need an // intermediate space). // The shear/rotation simply divides out the // common scale factor in the matrix. AffineTransform resAt = new AffineTransform(sx/scaleX, shy/scaleX, shx/scaleY, sy/scaleY, tx, ty); RenderedImage ri; ri = getSource().createRendering(new RenderContext(srcAt, r, rh)); if (ri == null) return null; // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Padded Image", ri, // new Rectangle(ri.getMinX()+22,ri.getMinY()+38,5,5)); CachableRed cr = convertSourceCS(ri); Shape devShape = srcAt.createTransformedShape(aoi); Rectangle2D devRect = devShape.getBounds2D(); r = devRect; r = new Rectangle2D.Double(Math.floor(r.getX()-kx), Math.floor(r.getY()-ky), Math.ceil (r.getX()+r.getWidth())- Math.floor(r.getX())+(kw-1), Math.ceil (r.getY()+r.getHeight())- Math.floor(r.getY())+(kh-1)); if (!r.getBounds().equals(cr.getBounds())) { if (edgeMode == PadMode.WRAP) throw new IllegalArgumentException ("edgeMode=\"wrap\" is not supported by ConvolveMatrix."); cr = new PadRed(cr, r.getBounds(), edgeMode, rh); } // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Padded Image", cr, // new Rectangle(cr.getMinX()+23,cr.getMinY()+39,5,5)); if (bias != 0.0) throw new IllegalArgumentException ("Only bias equal to zero is supported in ConvolveMatrix."); BufferedImageOp op = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, rh); ColorModel cm = cr.getColorModel(); // OK this is a bit of a cheat. We Pull the DataBuffer out of // The read-only raster that getData gives us. And use it to // build a WritableRaster. This avoids a copy of the data. Raster rr = cr.getData(); WritableRaster wr = GraphicsUtil.makeRasterWritable(rr, 0, 0); // Here we update the translate to account for the phase shift // (if any) introduced by setting targetX, targetY in SVG. int phaseShiftX = target.x - kernel.getXOrigin(); int phaseShiftY = target.y - kernel.getYOrigin(); int destX = (int)(r.getX() + phaseShiftX); int destY = (int)(r.getY() + phaseShiftY); BufferedImage destBI; if (!preserveAlpha) { // Force the data to be premultiplied since often the JDK // code doesn't properly premultiply the values... cm = GraphicsUtil.coerceData(wr, cm, true); BufferedImage srcBI; srcBI = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null); // Easy case just apply the op... destBI = op.filter(srcBI, null); if (kernelHasNegValues) { // When the kernel has negative values it's possible // for the resultant image to have alpha values less // than the associated color values this will lead to // problems later when we try to display the image so // we fix this here. fixAlpha(destBI); } } else { BufferedImage srcBI; srcBI = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null); // Construct a linear sRGB cm without alpha... cm = new DirectColorModel(ColorSpace.getInstance (ColorSpace.CS_LINEAR_RGB), 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x0, false, DataBuffer.TYPE_INT); // Create an image with that color model BufferedImage tmpSrcBI = new BufferedImage (cm, cm.createCompatibleWritableRaster(wr.getWidth(), wr.getHeight()), cm.isAlphaPremultiplied(), null); // Copy the color data (no alpha) to that image // (dividing out alpha if needed). GraphicsUtil.copyData(srcBI, tmpSrcBI); // org.apache.batik.test.gvt.ImageDisplay.showImage // ("tmpSrcBI: ", tmpSrcBI); // Get a linear sRGB Premult ColorModel ColorModel dstCM = GraphicsUtil.Linear_sRGB_Unpre; // Construct out output image around that ColorModel destBI = new BufferedImage (dstCM, dstCM.createCompatibleWritableRaster(wr.getWidth(), wr.getHeight()), dstCM.isAlphaPremultiplied(), null); // Construct another image on the same data buffer but without // an alpha channel. // Create the Raster (note we are using 'cm' again). WritableRaster dstWR = Raster.createWritableRaster (cm.createCompatibleSampleModel(wr.getWidth(), wr.getHeight()), destBI.getRaster().getDataBuffer(), new Point(0,0)); // Create the BufferedImage. BufferedImage tmpDstBI = new BufferedImage (cm, dstWR, cm.isAlphaPremultiplied(), null); // Filter between the two image without alpha. tmpDstBI = op.filter(tmpSrcBI, tmpDstBI); // org.apache.batik.test.gvt.ImageDisplay.showImage // ("tmpDstBI: ", tmpDstBI); // Copy the alpha channel into the result (note the color // channels are still unpremult. Rectangle srcRect = wr.getBounds(); Rectangle dstRect = new Rectangle(srcRect.x-phaseShiftX, srcRect.y-phaseShiftY, srcRect.width, srcRect.height); GraphicsUtil.copyBand(wr, srcRect, wr.getNumBands()-1, destBI.getRaster(), dstRect, destBI.getRaster().getNumBands()-1); } // Wrap it as a CachableRed cr = new BufferedImageCachableRed(destBI, destX, destY); // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Cropped Image", cr, // new Rectangle(cr.getMinX()+22,cr.getMinY()+38,5,5)); // org.apache.batik.test.gvt.ImageDisplay.printImage // ("Cropped sRGB", GraphicsUtil.convertTosRGB(cr), // new Rectangle(cr.getMinX()+22,cr.getMinY()+38,5,5)); // Make sure to crop junk from edges. cr = new PadRed(cr, devRect.getBounds(), PadMode.ZERO_PAD, rh); // If we need to scale/rotate/translate the result do so now... if (!resAt.isIdentity()) cr = new AffineRed(cr, resAt, null); // return the result. return cr; }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterChainRable8Bit.java
public void setFilterRegion(Rectangle2D filterRegion){ if(filterRegion == null){ throw new IllegalArgumentException(); } touch(); this.filterRegion = filterRegion; }
// in sources/org/apache/batik/ext/awt/image/renderable/FilterChainRable8Bit.java
public void setSource(Filter chainSource) { if(chainSource == null){ throw new IllegalArgumentException("Null Source for Filter Chain"); } touch(); this.chainSource = chainSource; if(filterRes == null){ crop.setSource(chainSource); } else{ filterRes.setSource(chainSource); } }
// in sources/org/apache/batik/ext/awt/image/ConcreteComponentTransferFunction.java
public static ComponentTransferFunction getTableTransfer(float[] tableValues){ ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction(); f.type = TABLE; if(tableValues == null){ throw new IllegalArgumentException(); } if(tableValues.length < 2){ throw new IllegalArgumentException(); } f.tableValues = new float[tableValues.length]; System.arraycopy(tableValues, 0, f.tableValues, 0, tableValues.length); return f; }
// in sources/org/apache/batik/ext/awt/image/ConcreteComponentTransferFunction.java
public static ComponentTransferFunction getDiscreteTransfer(float[] tableValues){ ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction(); f.type = DISCRETE; if(tableValues == null){ throw new IllegalArgumentException(); } if(tableValues.length < 2){ throw new IllegalArgumentException(); } f.tableValues = new float[tableValues.length]; System.arraycopy(tableValues, 0, f.tableValues, 0, tableValues.length); return f; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public synchronized Raster getTile(int tileX, int tileY) { if ((tileX < 0) || (tileX >= tilesX) || (tileY < 0) || (tileY >= tilesY)) { throw new IllegalArgumentException("TIFFImage12"); } // System.out.println("Called TIFF getTile:" + tileX + "," + tileY); // Get the data array out of the DataBuffer byte[] bdata = null; short[] sdata = null; int[] idata = null; SampleModel sampleModel = getSampleModel(); WritableRaster tile = makeTile(tileX,tileY); DataBuffer buffer = tile.getDataBuffer(); int dataType = sampleModel.getDataType(); if (dataType == DataBuffer.TYPE_BYTE) { bdata = ((DataBufferByte)buffer).getData(); } else if (dataType == DataBuffer.TYPE_USHORT) { sdata = ((DataBufferUShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_SHORT) { sdata = ((DataBufferShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_INT) { idata = ((DataBufferInt)buffer).getData(); } // Variables used for swapping when converting from RGB to BGR byte bswap; short sswap; int iswap; // Save original file pointer position and seek to tile data location. long save_offset = 0; try { save_offset = stream.getFilePointer(); stream.seek(tileOffsets[tileY*tilesX + tileX]); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Number of bytes in this tile (strip) after compression. int byteCount = (int)tileByteCounts[tileY*tilesX + tileX]; // Find out the number of bytes in the current tile Rectangle newRect; if (!tiled) newRect = tile.getBounds(); else newRect = new Rectangle(tile.getMinX(), tile.getMinY(), tileWidth, tileHeight); int unitsInThisTile = newRect.width * newRect.height * numBands; // Allocate read buffer if needed. byte[] data = compression != COMP_NONE || imageType == TYPE_PALETTE ? new byte[byteCount] : null; // Read the data, uncompressing as needed. There are four cases: // bilevel, palette-RGB, 4-bit grayscale, and everything else. if(imageType == TYPE_BILEVEL) { // bilevel try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 8 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/8) * newRect.height; } else { bytesInThisTile = (newRect.width/8 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_FAX_G3_1D) { stream.readFully(data, 0, byteCount); decoder.decode1D(bdata, data, 0, newRect.height); } else if (compression == COMP_FAX_G3_2D) { stream.readFully(data, 0, byteCount); decoder.decode2D(bdata, data, 0, newRect.height, tiffT4Options); } else if (compression == COMP_FAX_G4_2D) { stream.readFully(data, 0, byteCount); decoder.decodeT6(bdata, data, 0, newRect.height, tiffT6Options); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else if(imageType == TYPE_PALETTE) { // palette-RGB if (sampleSize == 16) { if (decodePaletteAsShorts) { short[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Since unitsBeforeLookup is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply it by 2 in order to figure out // how many bytes we'll get after decompression. int entries = unitsBeforeLookup * 2; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; decodePackbits(data, entries, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_LZW) { // Read in all the compressed data for this tile stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; lzwDecoder.decode(data, byteArray, newRect.height); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; inflate(data, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_NONE) { // byteCount tells us how many bytes are there // in this tile, but we need to read in shorts, // which will take half the space, so while // allocating we divide byteCount by 2. tempData = new short[byteCount/2]; readShorts(byteCount/2, tempData); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } if (dataType == DataBuffer.TYPE_USHORT) { // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else if (dataType == DataBuffer.TYPE_SHORT) { // Expand the palette image into an rgb image with // short data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)cmapValue; // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)cmapValue; // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)cmapValue; } } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 8) { if (decodePaletteAsShorts) { byte[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; decodePackbits(data, unitsBeforeLookup, tempData); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); Raster tempTile = decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY()); int[] tempPixels = new int[unitsBeforeLookup]; tempTile.getPixels(tile.getMinX(), tile.getMinY(), tile.getWidth(), tile.getHeight(), tempPixels); tempData = new byte[unitsBeforeLookup]; for(int i = 0; i < unitsBeforeLookup; i++) { tempData[i] = (byte)tempPixels[i]; } } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = new byte[byteCount]; stream.readFully(tempData, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 4) { int padding = (newRect.width % 2 == 0) ? 0 : 1; int bytesPostDecoding = ((newRect.width/2 + padding) * newRect.height); // Output short images if (decodePaletteAsShorts) { byte[] tempData = null; try { stream.readFully(data, 0, byteCount); stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // If compressed, decode the data. if (compression == COMP_PACKBITS) { tempData = new byte[bytesPostDecoding]; decodePackbits(data, bytesPostDecoding, tempData); } else if (compression == COMP_LZW) { tempData = new byte[bytesPostDecoding]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_DEFLATE) { tempData = new byte[bytesPostDecoding]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = data; } int bytes = unitsInThisTile / 3; // Unpack the 2 pixels packed into each byte. data = new byte[bytes]; int srcCount = 0, dstCount = 0; for (int j=0; j<newRect.height; j++) { for (int i=0; i<newRect.width/2; i++) { data[dstCount++] = (byte)((tempData[srcCount] & 0xf0) >> 4); data[dstCount++] = (byte)(tempData[srcCount++] & 0x0f); } if (padding == 1) { data[dstCount++] = (byte)((tempData[srcCount++] & 0xf0) >> 4); } } int len = colormap.length/3; int len2 = len*2; int cmapValue, lookup; int count = 0; for (int i=0; i<bytes; i++) { lookup = data[i] & 0xff; cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // Output byte values, use IndexColorModel for unpacking try { // If compressed, decode the data. if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, bytesPostDecoding, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } } else if(imageType == TYPE_GRAY_4BIT) { // 4-bit gray try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 2 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/2) * newRect.height; } else { bytesInThisTile = (newRect.width/2 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else { // everything else try { if (sampleSize == 8) { if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } } else if (sampleSize == 16) { if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } } else if (sampleSize == 32 && dataType == DataBuffer.TYPE_INT) { // redundant if (compression == COMP_NONE) { readInts(byteCount/4, idata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 4]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 4; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 4]; inflate(data, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Modify the data for certain special cases. switch(imageType) { case TYPE_GRAY: case TYPE_GRAY_ALPHA: if(isWhiteZero) { // Since we are using a ComponentColorModel with this // image, we need to change the WhiteIsZero data to // BlackIsZero data so it will display properly. if (dataType == DataBuffer.TYPE_BYTE && !(getColorModel() instanceof IndexColorModel)) { for (int l = 0; l < bdata.length; l += numBands) { bdata[l] = (byte)(255 - bdata[l]); } } else if (dataType == DataBuffer.TYPE_USHORT) { int ushortMax = Short.MAX_VALUE - Short.MIN_VALUE; for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(ushortMax - sdata[l]); } } else if (dataType == DataBuffer.TYPE_SHORT) { for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(~sdata[l]); } } else if (dataType == DataBuffer.TYPE_INT) { long uintMax = ((long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE); for (int l = 0; l < idata.length; l += numBands) { idata[l] = (int)(uintMax - idata[l]); } } } break; case TYPE_RGB: // Change RGB to BGR order, as Java2D displays that faster. // Unnecessary for JPEG-in-TIFF as the decoder handles it. if (sampleSize == 8 && compression != COMP_JPEG_TTN2) { for (int i=0; i<unitsInThisTile; i+=3) { bswap = bdata[i]; bdata[i] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=3) { sswap = sdata[i]; sdata[i] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=3) { iswap = idata[i]; idata[i] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_RGB_ALPHA: // Convert from RGBA to ABGR for Java2D if (sampleSize == 8) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A bswap = bdata[i]; bdata[i] = bdata[i+3]; bdata[i+3] = bswap; // Swap G and B bswap = bdata[i+1]; bdata[i+1] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A sswap = sdata[i]; sdata[i] = sdata[i+3]; sdata[i+3] = sswap; // Swap G and B sswap = sdata[i+1]; sdata[i+1] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A iswap = idata[i]; idata[i] = idata[i+3]; idata[i+3] = iswap; // Swap G and B iswap = idata[i+1]; idata[i+1] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_YCBCR_SUB: // Post-processing for YCbCr with subsampled chrominance: // simply replicate the chroma channels for displayability. int pixelsPerDataUnit = chromaSubH*chromaSubV; int numH = newRect.width/chromaSubH; int numV = newRect.height/chromaSubV; byte[] tempData = new byte[numH*numV*(pixelsPerDataUnit + 2)]; System.arraycopy(bdata, 0, tempData, 0, tempData.length); int samplesPerDataUnit = pixelsPerDataUnit*3; int[] pixels = new int[samplesPerDataUnit]; int bOffset = 0; int offsetCb = pixelsPerDataUnit; int offsetCr = offsetCb + 1; int y = newRect.y; for(int j = 0; j < numV; j++) { int x = newRect.x; for(int i = 0; i < numH; i++) { int Cb = tempData[bOffset + offsetCb]; int Cr = tempData[bOffset + offsetCr]; int k = 0; while(k < samplesPerDataUnit) { pixels[k++] = tempData[bOffset++]; pixels[k++] = Cb; pixels[k++] = Cr; } bOffset += 2; tile.setPixels(x, y, chromaSubH, chromaSubV, pixels); x += chromaSubH; } y += chromaSubV; } break; } } return tile; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private ComponentColorModel createAlphaComponentColorModel (int dataType, int numBands, boolean isAlphaPremultiplied, int transparency) { ComponentColorModel ccm = null; int[] RGBBits = null; ColorSpace cs = null; switch(numBands) { case 2: // gray+alpha cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); break; case 4: // RGB+alpha cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); break; default: throw new IllegalArgumentException(); } int componentSize = 0; switch(dataType) { case DataBuffer.TYPE_BYTE: componentSize = 8; break; case DataBuffer.TYPE_USHORT: case DataBuffer.TYPE_SHORT: componentSize = 16; break; case DataBuffer.TYPE_INT: componentSize = 32; break; default: throw new IllegalArgumentException(); } RGBBits = new int[numBands]; for(int i = 0; i < numBands; i++) { RGBBits[i] = componentSize; } ccm = new ComponentColorModel(cs, RGBBits, true, isAlphaPremultiplied, transparency, dataType); return ccm; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFField.java
public int compareTo(Object o) { if(o == null) { throw new IllegalArgumentException(); } int oTag = ((TIFFField)o).getTag(); if(tag < oTag) { return -1; } else if(tag > oTag) { return 1; } else { return 0; } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
Override protected ImageWriteParam getDefaultWriteParam( ImageWriter iiowriter, RenderedImage image, ImageWriterParams params) { JPEGImageWriteParam param = new JPEGImageWriteParam(iiowriter.getLocale()); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(params.getJPEGQuality()); if (params.getCompressionMethod() != null && !"JPEG".equals(params.getCompressionMethod())) { throw new IllegalArgumentException( "No compression method other than JPEG is supported for JPEG output!"); } if (params.getJPEGForceBaseline()) { param.setProgressiveMode(JPEGImageWriteParam.MODE_DISABLED); } return param; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8) { throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam2")); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8 && bitDepth != 16) { throw new IllegalArgumentException(); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setChromaticity(float[] chromaticity) { if (chromaticity.length != 8) { throw new IllegalArgumentException(); } this.chromaticity = (float[])(chromaticity.clone()); chromaticitySet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { // Error -- bad tile requested String msg = PropertyUtil.getString("PNGImageDecoder17"); throw new IllegalArgumentException(msg); } return theTile; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { // Error -- bad tile requested String msg = PropertyUtil.getString("PNGImageDecoder17"); throw new IllegalArgumentException(msg); } return theTile; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGDecodeParam.java
public void setUserExponent(float userExponent) { if (userExponent <= 0.0F) { throw new IllegalArgumentException(PropertyUtil.getString("PNGDecodeParam0")); } this.userExponent = userExponent; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGDecodeParam.java
public void setDisplayExponent(float displayExponent) { if (displayExponent <= 0.0F) { throw new IllegalArgumentException(PropertyUtil.getString("PNGDecodeParam1")); } this.displayExponent = displayExponent; }
// in sources/org/apache/batik/ext/awt/image/codec/util/SingleTileRenderedImage.java
public Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { throw new IllegalArgumentException(PropertyUtil.getString("SingleTileRenderedImage0")); } return ras; }
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToObjectBoundingBox(float value, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: // as is return value; case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: // If a percentage value is used, it is converted to a // 'bounding box' space coordinate by division by 100 return value / 100f; case SVGLength.SVG_LENGTHTYPE_PX: case SVGLength.SVG_LENGTHTYPE_MM: case SVGLength.SVG_LENGTHTYPE_CM: case SVGLength.SVG_LENGTHTYPE_IN: case SVGLength.SVG_LENGTHTYPE_PT: case SVGLength.SVG_LENGTHTYPE_PC: case SVGLength.SVG_LENGTHTYPE_EMS: case SVGLength.SVG_LENGTHTYPE_EXS: // <!> FIXME: resolve units in userSpace but consider them // in the objectBoundingBox coordinate system return svgToUserSpace(value, type, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToUserSpace(float v, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: case SVGLength.SVG_LENGTHTYPE_PX: return v; case SVGLength.SVG_LENGTHTYPE_MM: return (v / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_CM: return (v * 10f / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_IN: return (v * 25.4f / ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_PT: return (v * 25.4f / (72f * ctx.getPixelUnitToMillimeter())); case SVGLength.SVG_LENGTHTYPE_PC: return (v * 25.4f / (6f * ctx.getPixelUnitToMillimeter())); case SVGLength.SVG_LENGTHTYPE_EMS: return emsToPixels(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_EXS: return exsToPixels(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: return percentagesToPixels(v, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float userSpaceToSVG(float v, short type, short d, Context ctx) { switch (type) { case SVGLength.SVG_LENGTHTYPE_NUMBER: case SVGLength.SVG_LENGTHTYPE_PX: return v; case SVGLength.SVG_LENGTHTYPE_MM: return (v * ctx.getPixelUnitToMillimeter()); case SVGLength.SVG_LENGTHTYPE_CM: return (v * ctx.getPixelUnitToMillimeter() / 10f); case SVGLength.SVG_LENGTHTYPE_IN: return (v * ctx.getPixelUnitToMillimeter() / 25.4f); case SVGLength.SVG_LENGTHTYPE_PT: return (v * (72f * ctx.getPixelUnitToMillimeter()) / 25.4f); case SVGLength.SVG_LENGTHTYPE_PC: return (v * (6f * ctx.getPixelUnitToMillimeter()) / 25.4f); case SVGLength.SVG_LENGTHTYPE_EMS: return pixelsToEms(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_EXS: return pixelsToExs(v, d, ctx); case SVGLength.SVG_LENGTHTYPE_PERCENTAGE: return pixelsToPercentages(v, d, ctx); default: throw new IllegalArgumentException("Length has unknown type"); } }
// in sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFPainter.java
public void setRecordStore(WMFRecordStore currentStore){ if (currentStore == null){ throw new IllegalArgumentException(); } this.currentStore = currentStore; }
// in sources/org/apache/batik/transcoder/TranscodingHints.java
public Object put(Object key, Object value) { if (!((Key) key).isCompatibleValue(value)) { throw new IllegalArgumentException(value+ " incompatible with "+ key); } return super.put(key, value); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public float getLighterFontWeight(float f) { if (svgUserAgent != null) { return svgUserAgent.getLighterFontWeight(f); } // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public float getBolderFontWeight(float f) { if (svgUserAgent != null) { return svgUserAgent.getBolderFontWeight(f); } // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public float getLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public float getBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/gvt/MarkerShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } if (shape instanceof ExtendedShape) { this.extShape = (ExtendedShape)shape; } else { this.extShape = new ShapeExtender(shape); } this.startMarkerProxy = null; this.middleMarkerProxies = null; this.endMarkerProxy = null; this.markerGroup = null; }
// in sources/org/apache/batik/gvt/filter/MaskRable8Bit.java
public void setFilterRegion(Rectangle2D filterRegion){ if(filterRegion == null){ throw new IllegalArgumentException(); } this.filterRegion = filterRegion; }
// in sources/org/apache/batik/gvt/filter/GraphicsNodeRable8Bit.java
public void setGraphicsNode(GraphicsNode node){ if(node == null){ throw new IllegalArgumentException(); } this.node = node; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
public void setGraphicsNode(GraphicsNode node){ if(node == null){ throw new IllegalArgumentException(); } this.node = node; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
public Filter getBackground(GraphicsNode gn, GraphicsNode child, Rectangle2D aoi) { if (gn == null) { throw new IllegalArgumentException ("BackgroundImage requested yet no parent has " + "'enable-background:new'"); } Rectangle2D r2d = null; if (gn instanceof CompositeGraphicsNode) { CompositeGraphicsNode cgn = (CompositeGraphicsNode)gn; r2d = cgn.getBackgroundEnable(); } List srcs = new ArrayList(); // this hides a member in a super-class!! if (r2d == null) { Rectangle2D paoi = aoi; AffineTransform at = gn.getTransform(); if (at != null) paoi = at.createTransformedShape(aoi).getBounds2D(); Filter f = getBackground(gn.getParent(), gn, paoi); // Don't add the nodes unless they will contribute. if ((f != null) && f.getBounds2D().intersects(aoi)) { srcs.add(f); } } if (child != null) { CompositeGraphicsNode cgn = (CompositeGraphicsNode)gn; List children = cgn.getChildren(); Iterator i = children.iterator(); while (i.hasNext()) { GraphicsNode childGN = (GraphicsNode)i.next(); // System.out.println("Parent: " + cgn + // "\n Child: " + child + // "\n ChildGN: " + childGN); if (childGN == child) break; Rectangle2D cbounds = childGN.getBounds(); if (cbounds == null) continue; // System.out.println("Child : " + childGN); // System.out.println("Bounds: " + cbounds); // System.out.println(" : " + aoi); AffineTransform at = childGN.getTransform(); if (at != null) cbounds = at.createTransformedShape(cbounds).getBounds2D(); if (aoi.intersects(cbounds)) { srcs.add(childGN.getEnableBackgroundGraphicsNodeRable (true)); } } } if (srcs.size() == 0) return null; Filter ret = null; if (srcs.size() == 1) ret = (Filter)srcs.get(0); else ret = new CompositeRable8Bit(srcs, CompositeRule.OVER, false); if (child != null) { // We are returning the filter to child so make // sure to map the filter from the parents user space // to the childs user space... AffineTransform at = child.getTransform(); if (at != null) { try { at = at.createInverse(); ret = new AffineRable8Bit(ret, at); } catch (NoninvertibleTransformException nte) { ret = null; } } } return ret; }
// in sources/org/apache/batik/gvt/FillShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object set(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } checkRange(index); GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Replace the node to the children list GraphicsNode oldNode = children[index]; children[index] = node; // Set the parents of the graphics nodes ((AbstractGraphicsNode) node).setParent(this); ((AbstractGraphicsNode) oldNode).setParent(null); // Set the root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); ((AbstractGraphicsNode) oldNode).setRoot(null); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch events // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_REMOVED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, oldNode)); // id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); return oldNode; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean add(Object o) { // Check for correct argument if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Add the graphics node to the children list ensureCapacity(count + 1); // Increments modCount!! children[count++] = node; // Set the parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set the root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); return true; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } if (index > count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Insert the node to the children list ensureCapacity(count+1); // Increments modCount!! System.arraycopy(children, index, children, index+1, count-index); children[index] = node; count++; // Set parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean remove(Object o) { // Check for correct argument if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } GraphicsNode node = (GraphicsNode) o; if (node.getParent() != this) { return false; } // Remove the node int index = 0; for (; node != children[index]; index++); // fires exception when node not found! remove(index); return true; }
// in sources/org/apache/batik/gvt/GVTTreeWalker.java
public void setCurrentGraphicsNode(GraphicsNode node) { if (node.getRoot() != gvtRoot) { throw new IllegalArgumentException ("The node "+node+" is not part of the document "+gvtRoot); } currentNode = node; }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
protected void processMouseEvent(GraphicsNodeMouseEvent evt) { if (glisteners != null) { GraphicsNodeMouseListener[] listeners = (GraphicsNodeMouseListener[]) getListeners(GraphicsNodeMouseListener.class); switch (evt.getID()) { case GraphicsNodeMouseEvent.MOUSE_MOVED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseMoved(evt); } break; case GraphicsNodeMouseEvent.MOUSE_DRAGGED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseDragged(evt); } break; case GraphicsNodeMouseEvent.MOUSE_ENTERED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseEntered(evt); } break; case GraphicsNodeMouseEvent.MOUSE_EXITED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseExited(evt); } break; case GraphicsNodeMouseEvent.MOUSE_CLICKED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseClicked(evt); } break; case GraphicsNodeMouseEvent.MOUSE_PRESSED: for (int i = 0; i < listeners.length; i++) { listeners[i].mousePressed(evt); } break; case GraphicsNodeMouseEvent.MOUSE_RELEASED: for (int i = 0; i < listeners.length; i++) { listeners[i].mouseReleased(evt); } break; default: throw new IllegalArgumentException("Unknown Mouse Event type: "+evt.getID()); } } }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
public void processKeyEvent(GraphicsNodeKeyEvent evt) { if ((glisteners != null)) { GraphicsNodeKeyListener[] listeners = (GraphicsNodeKeyListener[]) getListeners(GraphicsNodeKeyListener.class); switch (evt.getID()) { case GraphicsNodeKeyEvent.KEY_PRESSED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyPressed(evt); } break; case GraphicsNodeKeyEvent.KEY_RELEASED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyReleased(evt); } break; case GraphicsNodeKeyEvent.KEY_TYPED: for (int i=0; i<listeners.length; ++i) { listeners[i].keyTyped(evt); } break; default: throw new IllegalArgumentException("Unknown Key Event type: "+evt.getID()); } } evt.consume(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn) { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length+1) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + '+' + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (positionReturn == null) { positionReturn = new float[numEntries*2]; } if ((beginGlyphIndex+numEntries) == glyphs.length+1) { numEntries--; positionReturn[numEntries*2] = (float)endPos.getX(); positionReturn[numEntries*2+1] = (float)endPos.getY(); } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { Point2D glyphPos; glyphPos = glyphs[i].getPosition(); positionReturn[(i-beginGlyphIndex)*2] = (float)glyphPos.getX(); positionReturn[(i-beginGlyphIndex)*2 + 1] = (float)glyphPos.getY(); } return positionReturn; }
// in sources/org/apache/batik/gvt/font/MultiGlyphVector.java
public GVTFont getFont() { throw new IllegalArgumentException("Can't be correctly Implemented"); }
// in sources/org/apache/batik/gvt/flow/FlowRegions.java
public boolean gotoY(double y) { if (y < currentY) throw new IllegalArgumentException ("New Y can not be lower than old Y\n" + "Old Y: " + currentY + " New Y: " + y); if (y == currentY) return false; sr = sl.split(y); sl = sr.getBelow(); sr = null; currentY = y; if (sl == null) return true; newLineHeight(lineHeight); return false; }
// in sources/org/apache/batik/gvt/StrokeShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; this.strokedShape = null; }
// in sources/org/apache/batik/gvt/CompositeShapePainter.java
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } if (painters != null) { for (int i=0; i < count; ++i) { painters[i].setShape(shape); } } this.shape = shape; }
// in sources/org/apache/batik/bridge/URIResolver.java
public Element getElement(String uri, Element ref) throws MalformedURLException, IOException { Node n = getNode(uri, ref); if (n == null) { return null; } else if (n.getNodeType() == Node.DOCUMENT_NODE) { throw new IllegalArgumentException(); } else { return (Element)n; } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public static float getStandardLighterFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 100; case 200: return 100; case 300: return 200; case 400: return 300; case 500: return 400; case 600: return 400; case 700: return 400; case 800: return 400; case 900: return 400; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public static float getStandardBolderFontWeight(float f) { // Round f to nearest 100... int weight = ((int)((f+50)/100))*100; switch (weight) { case 100: return 600; case 200: return 600; case 300: return 600; case 400: return 600; case 500: return 600; case 600: return 700; case 700: return 800; case 800: return 900; case 900: return 900; default: throw new IllegalArgumentException("Bad Font Weight: " + f); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static Paint convertPaint(Element paintedElement, GraphicsNode paintedNode, Value paintDef, float opacity, BridgeContext ctx) { if (paintDef.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { switch (paintDef.getPrimitiveType()) { case CSSPrimitiveValue.CSS_IDENT: return null; // none case CSSPrimitiveValue.CSS_RGBCOLOR: return convertColor(paintDef, opacity); case CSSPrimitiveValue.CSS_URI: return convertURIPaint(paintedElement, paintedNode, paintDef, opacity, ctx); default: throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } else { // List Value v = paintDef.item(0); switch (v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_RGBCOLOR: return convertRGBICCColor(paintedElement, v, (ICCColor)paintDef.item(1), opacity, ctx); case CSSPrimitiveValue.CSS_URI: { Paint result = silentConvertURIPaint(paintedElement, paintedNode, v, opacity, ctx); if (result != null) return result; v = paintDef.item(1); switch (v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_IDENT: return null; // none case CSSPrimitiveValue.CSS_RGBCOLOR: if (paintDef.getLength() == 2) { return convertColor(v, opacity); } else { return convertRGBICCColor(paintedElement, v, (ICCColor)paintDef.item(2), opacity, ctx); } default: throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } default: // can't be reached throw new IllegalArgumentException ("Paint argument is not an appropriate CSS value"); } } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int convertStrokeLinecap(Value v) { String s = v.getStringValue(); switch (s.charAt(0)) { case 'b': return BasicStroke.CAP_BUTT; case 'r': return BasicStroke.CAP_ROUND; case 's': return BasicStroke.CAP_SQUARE; default: throw new IllegalArgumentException ("Linecap argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int convertStrokeLinejoin(Value v) { String s = v.getStringValue(); switch (s.charAt(0)) { case 'm': return BasicStroke.JOIN_MITER; case 'r': return BasicStroke.JOIN_ROUND; case 'b': return BasicStroke.JOIN_BEVEL; default: throw new IllegalArgumentException ("Linejoin argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/PaintServer.java
public static int resolveColorComponent(Value v) { float f; switch(v.getPrimitiveType()) { case CSSPrimitiveValue.CSS_PERCENTAGE: f = v.getFloatValue(); f = (f > 100f) ? 100f : (f < 0f) ? 0f : f; return Math.round(255f * f / 100f); case CSSPrimitiveValue.CSS_NUMBER: f = v.getFloatValue(); f = (f > 255f) ? 255f : (f < 0f) ? 0f : f; return Math.round(f); default: throw new IllegalArgumentException ("Color component argument is not an appropriate CSS value"); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static Point2D convertPoint(String xStr, String xAttr, String yStr, String yAttr, short unitsType, UnitProcessor.Context uctx) { float x, y; switch (unitsType) { case OBJECT_BOUNDING_BOX: x = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (xStr, xAttr, uctx); y = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (yStr, yAttr, uctx); break; case USER_SPACE_ON_USE: x = UnitProcessor.svgHorizontalCoordinateToUserSpace (xStr, xAttr, uctx); y = UnitProcessor.svgVerticalCoordinateToUserSpace (yStr, yAttr, uctx); break; default: throw new IllegalArgumentException("Invalid unit type"); } return new Point2D.Float(x, y); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
public static float convertLength(String length, String attr, short unitsType, UnitProcessor.Context uctx) { switch (unitsType) { case OBJECT_BOUNDING_BOX: return UnitProcessor.svgOtherLengthToObjectBoundingBox (length, attr, uctx); case USER_SPACE_ON_USE: return UnitProcessor.svgOtherLengthToUserSpace(length, attr, uctx); default: throw new IllegalArgumentException("Invalid unit type"); } }
// in sources/org/apache/batik/bridge/SVGUtilities.java
protected static Rectangle2D extendRegion(String dxStr, String dyStr, String dwStr, String dhStr, short unitsType, GraphicsNode filteredNode, Rectangle2D region, UnitProcessor.Context uctx) { float dx,dy,dw,dh; switch (unitsType) { case USER_SPACE_ON_USE: dx = UnitProcessor.svgHorizontalCoordinateToUserSpace (dxStr, SVG12Constants.SVG_MX_ATRIBUTE, uctx); dy = UnitProcessor.svgVerticalCoordinateToUserSpace (dyStr, SVG12Constants.SVG_MY_ATRIBUTE, uctx); dw = UnitProcessor.svgHorizontalCoordinateToUserSpace (dwStr, SVG12Constants.SVG_MW_ATRIBUTE, uctx); dh = UnitProcessor.svgVerticalCoordinateToUserSpace (dhStr, SVG12Constants.SVG_MH_ATRIBUTE, uctx); break; case OBJECT_BOUNDING_BOX: Rectangle2D bounds = filteredNode.getGeometryBounds(); if (bounds == null) { dx = dy = dw = dh = 0; } else { dx = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (dxStr, SVG12Constants.SVG_MX_ATRIBUTE, uctx); dx *= bounds.getWidth(); dy = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (dyStr, SVG12Constants.SVG_MY_ATRIBUTE, uctx); dy *= bounds.getHeight(); dw = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox (dwStr, SVG12Constants.SVG_MW_ATRIBUTE, uctx); dw *= bounds.getWidth(); dh = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox (dhStr, SVG12Constants.SVG_MH_ATRIBUTE, uctx); dh *= bounds.getHeight(); } break; default: throw new IllegalArgumentException("Invalid unit type"); } region.setRect(region.getX() + dx, region.getY() + dy, region.getWidth() + dw, region.getHeight() + dh); return region; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLContext.java
public void setSyntaxForeground(Map syntaxForegroundMap) { if (syntaxForegroundMap == null) { throw new IllegalArgumentException("syntaxForegroundMap can not be null"); } this.syntaxForegroundMap = syntaxForegroundMap; }
// in sources/org/apache/batik/util/gui/xmleditor/XMLContext.java
public void setSyntaxFont(Map syntaxFontMap) { if (syntaxFontMap == null) { throw new IllegalArgumentException("syntaxFontMap can not be null"); } this.syntaxFontMap = syntaxFontMap; }
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public void setModificationHandler(ModificationHandler h) { if (!(h instanceof PaintModificationHandler)) { throw new IllegalArgumentException(); } super.setModificationHandler(h); }
5
            
// in sources/org/apache/batik/apps/svgbrowser/XMLInputHandler.java
catch (Exception e) { System.err.println("======================================"); System.err.println(sw.toString()); System.err.println("======================================"); throw new IllegalArgumentException (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION)); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
3
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setQuality(float quality) throws IllegalArgumentException { if(quality >= 1){ throw new IllegalArgumentException(); } this.quality = quality; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void setIndexed(int bits) throws IllegalArgumentException { this.indexed = bits; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
3
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (IllegalArgumentException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(IllegalArgumentException e){ e.printStackTrace(); error(ERROR_ILLEGAL_ARGUMENT, new Object[] { v, optionHandler.getOptionDescription() , toString(optionValues)}); return; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
catch (IllegalArgumentException ex) { // XXX Should we throw an exception here when the length // type is unknown? return 0f; }
0 0
runtime (Lib) IllegalStateException 58
            
// in sources/org/apache/batik/apps/svgbrowser/LocalHistory.java
public void update(String uri) { if (currentURI < -1) { throw new IllegalStateException("Unexpected currentURI:" + currentURI ); } state = STABLE_STATE; if (++currentURI < visitedURIs.size()) { if (!visitedURIs.get(currentURI).equals(uri)) { int len = menu.getItemCount(); for (int i = len - 1; i >= index + currentURI + 1; i--) { JMenuItem mi = menu.getItem(i); group.remove(mi); menu.remove(i); } visitedURIs = visitedURIs.subList(0, currentURI + 1); } JMenuItem mi = menu.getItem(index + currentURI); group.remove(mi); menu.remove(index + currentURI); visitedURIs.set(currentURI, uri); } else { if (visitedURIs.size() >= 15) { visitedURIs.remove(0); JMenuItem mi = menu.getItem(index); group.remove(mi); menu.remove(index); currentURI--; } visitedURIs.add(uri); } // Computes the button text. String text = uri; int i = uri.lastIndexOf('/'); if (i == -1) { i = uri.lastIndexOf('\\' ); } if (i != -1) { text = uri.substring(i + 1); } JMenuItem mi = new JRadioButtonMenuItem(text); mi.setToolTipText(uri); mi.setActionCommand(uri); mi.addActionListener(actionListener); group.add(mi); mi.setSelected(true); menu.insert(mi, index + currentURI); }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void remove() { if (!removeOk) throw new IllegalStateException ("remove can only be called directly after next/previous"); if (forward) idx--; if (idx != size-1) System.arraycopy(rects, idx+1, rects, idx, size-(idx+1)); size--; rects[size] = null; removeOk = false; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void set(Object o) { Rectangle r = (Rectangle)o; if (!removeOk) throw new IllegalStateException ("set can only be called directly after next/previous"); if (forward) idx--; if (idx+1<size) { if (rects[idx+1].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx>=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } rects[idx] = r; removeOk = false; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private int encode(RenderedImage im, TIFFEncodeParam encodeParam, int ifdOffset, boolean isLast) throws IOException { // Currently all images are stored uncompressed. int compression = encodeParam.getCompression(); // Get tiled output preference. boolean isTiled = encodeParam.getWriteTiled(); // Set bounds. int minX = im.getMinX(); int minY = im.getMinY(); int width = im.getWidth(); int height = im.getHeight(); // Get SampleModel. SampleModel sampleModel = im.getSampleModel(); // Retrieve and verify sample size. int[] sampleSize = sampleModel.getSampleSize(); for(int i = 1; i < sampleSize.length; i++) { if(sampleSize[i] != sampleSize[0]) { throw new Error("TIFFImageEncoder0"); } } // Check low bit limits. int numBands = sampleModel.getNumBands(); if((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) { throw new Error("TIFFImageEncoder1"); } // Retrieve and verify data type. int dataType = sampleModel.getDataType(); switch(dataType) { case DataBuffer.TYPE_BYTE: if(sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense?? sampleSize[0] != 8) { // we get error only for 4 throw new Error("TIFFImageEncoder2"); } break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: if(sampleSize[0] != 16) { throw new Error("TIFFImageEncoder3"); } break; case DataBuffer.TYPE_INT: case DataBuffer.TYPE_FLOAT: if(sampleSize[0] != 32) { throw new Error("TIFFImageEncoder4"); } break; default: throw new Error("TIFFImageEncoder5"); } boolean dataTypeIsShort = dataType == DataBuffer.TYPE_SHORT || dataType == DataBuffer.TYPE_USHORT; ColorModel colorModel = im.getColorModel(); if (colorModel != null && colorModel instanceof IndexColorModel && dataType != DataBuffer.TYPE_BYTE) { // Don't support (unsigned) short palette-color images. throw new Error("TIFFImageEncoder6"); } IndexColorModel icm = null; int sizeOfColormap = 0; char[] colormap = null; // Set image type. int imageType = TIFF_UNSUPPORTED; int numExtraSamples = 0; int extraSampleType = EXTRA_SAMPLE_UNSPECIFIED; if(colorModel instanceof IndexColorModel) { // Bilevel or palette icm = (IndexColorModel)colorModel; int mapSize = icm.getMapSize(); if(sampleSize[0] == 1 && numBands == 1) { // Bilevel image if (mapSize != 2) { throw new IllegalArgumentException( "TIFFImageEncoder7"); } byte[] r = new byte[mapSize]; icm.getReds(r); byte[] g = new byte[mapSize]; icm.getGreens(g); byte[] b = new byte[mapSize]; icm.getBlues(b); if ((r[0] & 0xff) == 0 && (r[1] & 0xff) == 255 && (g[0] & 0xff) == 0 && (g[1] & 0xff) == 255 && (b[0] & 0xff) == 0 && (b[1] & 0xff) == 255) { imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else if ((r[0] & 0xff) == 255 && (r[1] & 0xff) == 0 && (g[0] & 0xff) == 255 && (g[1] & 0xff) == 0 && (b[0] & 0xff) == 255 && (b[1] & 0xff) == 0) { imageType = TIFF_BILEVEL_WHITE_IS_ZERO; } else { imageType = TIFF_PALETTE; } } else if(numBands == 1) { // Non-bilevel image. // Palette color image. imageType = TIFF_PALETTE; } } else if(colorModel == null) { if(sampleSize[0] == 1 && numBands == 1) { // bilevel imageType = TIFF_BILEVEL_BLACK_IS_ZERO; } else { // generic image imageType = TIFF_GENERIC; if(numBands > 1) { numExtraSamples = numBands - 1; } } } else { // colorModel is non-null but not an IndexColorModel ColorSpace colorSpace = colorModel.getColorSpace(); switch(colorSpace.getType()) { case ColorSpace.TYPE_CMYK: imageType = TIFF_CMYK; break; case ColorSpace.TYPE_GRAY: imageType = TIFF_GRAY; break; case ColorSpace.TYPE_Lab: imageType = TIFF_CIELAB; break; case ColorSpace.TYPE_RGB: if(compression == COMP_JPEG_TTN2 && encodeParam.getJPEGCompressRGBToYCbCr()) { imageType = TIFF_YCBCR; } else { imageType = TIFF_RGB; } break; case ColorSpace.TYPE_YCbCr: imageType = TIFF_YCBCR; break; default: imageType = TIFF_GENERIC; // generic break; } if(imageType == TIFF_GENERIC) { numExtraSamples = numBands - 1; } else if(numBands > 1) { numExtraSamples = numBands - colorSpace.getNumComponents(); } if(numExtraSamples == 1 && colorModel.hasAlpha()) { extraSampleType = colorModel.isAlphaPremultiplied() ? EXTRA_SAMPLE_ASSOCIATED_ALPHA : EXTRA_SAMPLE_UNASSOCIATED_ALPHA; } } if(imageType == TIFF_UNSUPPORTED) { throw new Error("TIFFImageEncoder8"); } // Check JPEG compatibility. if(compression == COMP_JPEG_TTN2) { if(imageType == TIFF_PALETTE) { throw new Error("TIFFImageEncoder11"); } else if(!(sampleSize[0] == 8 && (imageType == TIFF_GRAY || imageType == TIFF_RGB || imageType == TIFF_YCBCR))) { throw new Error("TIFFImageEncoder9"); } } int photometricInterpretation = -1; switch (imageType) { case TIFF_BILEVEL_WHITE_IS_ZERO: photometricInterpretation = 0; break; case TIFF_BILEVEL_BLACK_IS_ZERO: photometricInterpretation = 1; break; case TIFF_GRAY: case TIFF_GENERIC: // Since the CS_GRAY colorspace is always of type black_is_zero photometricInterpretation = 1; break; case TIFF_PALETTE: photometricInterpretation = 3; icm = (IndexColorModel)colorModel; sizeOfColormap = icm.getMapSize(); byte[] r = new byte[sizeOfColormap]; icm.getReds(r); byte[] g = new byte[sizeOfColormap]; icm.getGreens(g); byte[] b = new byte[sizeOfColormap]; icm.getBlues(b); int redIndex = 0, greenIndex = sizeOfColormap; int blueIndex = 2 * sizeOfColormap; colormap = new char[sizeOfColormap * 3]; for (int i=0; i<sizeOfColormap; i++) { int tmp = 0xff & r[i]; // beware of sign extended bytes colormap[redIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & g[i]; colormap[greenIndex++] = (char)(( tmp << 8) | tmp ); tmp = 0xff & b[i]; colormap[blueIndex++] = (char)(( tmp << 8) | tmp ); } sizeOfColormap *= 3; break; case TIFF_RGB: photometricInterpretation = 2; break; case TIFF_CMYK: photometricInterpretation = 5; break; case TIFF_YCBCR: photometricInterpretation = 6; break; case TIFF_CIELAB: photometricInterpretation = 8; break; default: throw new Error("TIFFImageEncoder8"); } // Initialize tile dimensions. int tileWidth; int tileHeight; if(isTiled) { tileWidth = encodeParam.getTileWidth() > 0 ? encodeParam.getTileWidth() : im.getTileWidth(); tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : im.getTileHeight(); } else { tileWidth = width; tileHeight = encodeParam.getTileHeight() > 0 ? encodeParam.getTileHeight() : DEFAULT_ROWS_PER_STRIP; } // Re-tile for JPEG conformance if needed. JPEGEncodeParam jep = null; if(compression == COMP_JPEG_TTN2) { // Get JPEGEncodeParam from encodeParam. jep = encodeParam.getJPEGEncodeParam(); // Determine maximum subsampling. int maxSubH = jep.getHorizontalSubsampling(0); int maxSubV = jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { int subH = jep.getHorizontalSubsampling(i); if(subH > maxSubH) { maxSubH = subH; } int subV = jep.getVerticalSubsampling(i); if(subV > maxSubV) { maxSubV = subV; } } int factorV = 8*maxSubV; tileHeight = (int)((float)tileHeight/(float)factorV + 0.5F)*factorV; if(tileHeight < factorV) { tileHeight = factorV; } if(isTiled) { int factorH = 8*maxSubH; tileWidth = (int)((float)tileWidth/(float)factorH + 0.5F)*factorH; if(tileWidth < factorH) { tileWidth = factorH; } } } int numTiles; if(isTiled) { // NB: Parentheses are used in this statement for correct rounding. numTiles = ((width + tileWidth - 1)/tileWidth) * ((height + tileHeight - 1)/tileHeight); } else { numTiles = (int)Math.ceil((double)height/(double)tileHeight); } long[] tileByteCounts = new long[numTiles]; long bytesPerRow = (long)Math.ceil((sampleSize[0] / 8.0) * tileWidth * numBands); long bytesPerTile = bytesPerRow * tileHeight; for (int i=0; i<numTiles; i++) { tileByteCounts[i] = bytesPerTile; } if(!isTiled) { // Last strip may have lesser rows long lastStripRows = height - (tileHeight * (numTiles-1)); tileByteCounts[numTiles-1] = lastStripRows * bytesPerRow; } long totalBytesOfData = bytesPerTile * (numTiles - 1) + tileByteCounts[numTiles-1]; // The data will be written after the IFD: create the array here // but fill it in later. long[] tileOffsets = new long[numTiles]; // Basic fields - have to be in increasing numerical order. // ImageWidth 256 // ImageLength 257 // BitsPerSample 258 // Compression 259 // PhotoMetricInterpretation 262 // StripOffsets 273 // RowsPerStrip 278 // StripByteCounts 279 // XResolution 282 // YResolution 283 // ResolutionUnit 296 // Create Directory SortedSet fields = new TreeSet(); // Image Width fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {width})); // Image Length fields.add(new TIFFField(TIFFImageDecoder.TIFF_IMAGE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {height})); char [] shortSampleSize = new char[numBands]; for (int i=0; i<numBands; i++) shortSampleSize[i] = (char)sampleSize[i]; fields.add(new TIFFField(TIFFImageDecoder.TIFF_BITS_PER_SAMPLE, TIFFField.TIFF_SHORT, numBands, shortSampleSize)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_COMPRESSION, TIFFField.TIFF_SHORT, 1, new char[] {(char)compression})); fields.add( new TIFFField(TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION, TIFFField.TIFF_SHORT, 1, new char[] {(char)photometricInterpretation})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLES_PER_PIXEL, TIFFField.TIFF_SHORT, 1, new char[] {(char)numBands})); if(!isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if (colormap != null) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_COLORMAP, TIFFField.TIFF_SHORT, sizeOfColormap, colormap)); } if(isTiled) { fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_WIDTH, TIFFField.TIFF_LONG, 1, new long[] {tileWidth})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_LENGTH, TIFFField.TIFF_LONG, 1, new long[] {tileHeight})); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_OFFSETS, TIFFField.TIFF_LONG, numTiles, tileOffsets)); fields.add(new TIFFField(TIFFImageDecoder.TIFF_TILE_BYTE_COUNTS, TIFFField.TIFF_LONG, numTiles, tileByteCounts)); } if(numExtraSamples > 0) { char[] extraSamples = new char[numExtraSamples]; for(int i = 0; i < numExtraSamples; i++) { extraSamples[i] = (char)extraSampleType; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_EXTRA_SAMPLES, TIFFField.TIFF_SHORT, numExtraSamples, extraSamples)); } // Data Sample Format Extension fields. if(dataType != DataBuffer.TYPE_BYTE) { // SampleFormat char[] sampleFormat = new char[numBands]; if(dataType == DataBuffer.TYPE_FLOAT) { sampleFormat[0] = 3; } else if(dataType == DataBuffer.TYPE_USHORT) { sampleFormat[0] = 1; } else { sampleFormat[0] = 2; } for(int b = 1; b < numBands; b++) { sampleFormat[b] = sampleFormat[0]; } fields.add(new TIFFField(TIFFImageDecoder.TIFF_SAMPLE_FORMAT, TIFFField.TIFF_SHORT, numBands, sampleFormat)); // NOTE: We don't bother setting the SMinSampleValue and // SMaxSampleValue fields as these both default to the // extrema of the respective data types. Probably we should // check for the presence of the "extrema" property and // use it if available. } // Initialize some JPEG variables. com.sun.image.codec.jpeg.JPEGEncodeParam jpegEncodeParam = null; com.sun.image.codec.jpeg.JPEGImageEncoder jpegEncoder = null; int jpegColorID = 0; if(compression == COMP_JPEG_TTN2) { // Initialize JPEG color ID. jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_UNKNOWN; switch(imageType) { case TIFF_GRAY: case TIFF_PALETTE: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_GRAY; break; case TIFF_RGB: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_RGB; break; case TIFF_YCBCR: jpegColorID = com.sun.image.codec.jpeg.JPEGDecodeParam.COLOR_ID_YCbCr; break; } // Get the JDK encoding parameters. Raster tile00 = im.getTile(0, 0); jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam( tile00, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); // Write an abbreviated tables-only stream to JPEGTables field. jpegEncodeParam.setImageInfoValid(false); jpegEncodeParam.setTableInfoValid(true); ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder( tableStream, jpegEncodeParam); jpegEncoder.encode(tile00); byte[] tableData = tableStream.toByteArray(); fields.add(new TIFFField(TIFF_JPEG_TABLES, TIFFField.TIFF_UNDEFINED, tableData.length, tableData)); // Reset encoder so it's recreated below. jpegEncoder = null; } if(imageType == TIFF_YCBCR) { // YCbCrSubSampling: 2 is the default so we must write 1 as // we do not (yet) do any subsampling. char subsampleH = 1; char subsampleV = 1; // If JPEG, update values. if(compression == COMP_JPEG_TTN2) { // Determine maximum subsampling. subsampleH = (char)jep.getHorizontalSubsampling(0); subsampleV = (char)jep.getVerticalSubsampling(0); for(int i = 1; i < numBands; i++) { char subH = (char)jep.getHorizontalSubsampling(i); if(subH > subsampleH) { subsampleH = subH; } char subV = (char)jep.getVerticalSubsampling(i); if(subV > subsampleV) { subsampleV = subV; } } } fields.add(new TIFFField(TIFF_YCBCR_SUBSAMPLING, TIFFField.TIFF_SHORT, 2, new char[] {subsampleH, subsampleV})); // YCbCr positioning. fields.add(new TIFFField(TIFF_YCBCR_POSITIONING, TIFFField.TIFF_SHORT, 1, new char[] {(char)((compression == COMP_JPEG_TTN2)? 1 : 2)})); // Reference black/white. long[][] refbw; if(compression == COMP_JPEG_TTN2) { refbw = new long[][] { // no headroon/footroom {0, 1}, {255, 1}, {128, 1}, {255, 1}, {128, 1}, {255, 1} }; } else { refbw = new long[][] { // CCIR 601.1 headroom/footroom (presumptive) {15, 1}, {235, 1}, {128, 1}, {240, 1}, {128, 1}, {240, 1} }; } fields.add(new TIFFField(TIFF_REF_BLACK_WHITE, TIFFField.TIFF_RATIONAL, 6, refbw)); } // ---- No more automatically generated fields should be added // after this point. ---- // Add extra fields specified via the encoding parameters. TIFFField[] extraFields = encodeParam.getExtraFields(); if(extraFields != null) { List extantTags = new ArrayList(fields.size()); Iterator fieldIter = fields.iterator(); while(fieldIter.hasNext()) { TIFFField fld = (TIFFField)fieldIter.next(); extantTags.add(new Integer(fld.getTag())); } int numExtraFields = extraFields.length; for(int i = 0; i < numExtraFields; i++) { TIFFField fld = extraFields[i]; Integer tagValue = new Integer(fld.getTag()); if(!extantTags.contains(tagValue)) { fields.add(fld); extantTags.add(tagValue); } } } // ---- No more fields of any type should be added after this. ---- // Determine the size of the IFD which is written after the header // of the stream or after the data of the previous image in a // multi-page stream. int dirSize = getDirectorySize(fields); // The first data segment is written after the field overflow // following the IFD so initialize the first offset accordingly. tileOffsets[0] = ifdOffset + dirSize; // Branch here depending on whether data are being comrpressed. // If not, then the IFD is written immediately. // If so then there are three possibilities: // A) the OutputStream is a SeekableOutputStream (outCache null); // B) the OutputStream is not a SeekableOutputStream and a file cache // is used (outCache non-null, tempFile non-null); // C) the OutputStream is not a SeekableOutputStream and a memory cache // is used (outCache non-null, tempFile null). OutputStream outCache = null; byte[] compressBuf = null; File tempFile = null; int nextIFDOffset = 0; boolean skipByte = false; Deflater deflater = null; boolean jpegRGBToYCbCr = false; if(compression == COMP_NONE) { // Determine the number of bytes of padding necessary between // the end of the IFD and the first data segment such that the // alignment of the data conforms to the specification (required // for uncompressed data only). int numBytesPadding = 0; if(sampleSize[0] == 16 && tileOffsets[0] % 2 != 0) { numBytesPadding = 1; tileOffsets[0]++; } else if(sampleSize[0] == 32 && tileOffsets[0] % 4 != 0) { numBytesPadding = (int)(4 - tileOffsets[0] % 4); tileOffsets[0] += numBytesPadding; } // Update the data offsets (which TIFFField stores by reference). for (int i = 1; i < numTiles; i++) { tileOffsets[i] = tileOffsets[i-1] + tileByteCounts[i-1]; } if(!isLast) { // Determine the offset of the next IFD. nextIFDOffset = (int)(tileOffsets[0] + totalBytesOfData); // IFD offsets must be on a word boundary. if ((nextIFDOffset&0x01) != 0) { nextIFDOffset++; skipByte = true; } } // Write the IFD and field overflow before the image data. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write any padding bytes needed between the end of the IFD // and the start of the actual image data. if(numBytesPadding != 0) { for(int padding = 0; padding < numBytesPadding; padding++) { output.write((byte)0); } } } else { // If compressing, the cannot be written yet as the size of the // data segments is unknown. if( output instanceof SeekableOutputStream ) { // Simply seek to the first data segment position. ((SeekableOutputStream)output).seek(tileOffsets[0]); } else { // Cache the original OutputStream. outCache = output; try { // Attempt to create a temporary file. tempFile = File.createTempFile("jai-SOS-", ".tmp"); tempFile.deleteOnExit(); RandomAccessFile raFile = new RandomAccessFile(tempFile, "rw"); output = new SeekableOutputStream(raFile); // this method is exited! } catch(Exception e) { // Allocate memory for the entire image data (!). output = new ByteArrayOutputStream((int)totalBytesOfData); } } int bufSize = 0; switch(compression) { case COMP_PACKBITS: bufSize = (int)(bytesPerTile + ((bytesPerRow+127)/128)*tileHeight); break; case COMP_JPEG_TTN2: bufSize = 0; // Set color conversion flag. if(imageType == TIFF_YCBCR && colorModel != null && colorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB) { jpegRGBToYCbCr = true; } break; case COMP_DEFLATE: bufSize = (int)bytesPerTile; deflater = new Deflater(encodeParam.getDeflateLevel()); break; default: bufSize = 0; } if(bufSize != 0) { compressBuf = new byte[bufSize]; } } // ---- Writing of actual image data ---- // Buffer for up to tileHeight rows of pixels int[] pixels = null; float[] fpixels = null; // Whether to test for contiguous data. boolean checkContiguous = ((sampleSize[0] == 1 && sampleModel instanceof MultiPixelPackedSampleModel && dataType == DataBuffer.TYPE_BYTE) || (sampleSize[0] == 8 && sampleModel instanceof ComponentSampleModel)); // Also create a buffer to hold tileHeight lines of the // data to be written to the file, so we can use array writes. byte[] bpixels = null; if(compression != COMP_JPEG_TTN2) { if(dataType == DataBuffer.TYPE_BYTE) { bpixels = new byte[tileHeight * tileWidth * numBands]; } else if(dataTypeIsShort) { bpixels = new byte[2 * tileHeight * tileWidth * numBands]; } else if(dataType == DataBuffer.TYPE_INT || dataType == DataBuffer.TYPE_FLOAT) { bpixels = new byte[4 * tileHeight * tileWidth * numBands]; } } // Process tileHeight rows at a time int lastRow = minY + height; int lastCol = minX + width; int tileNum = 0; for (int row = minY; row < lastRow; row += tileHeight) { int rows = isTiled ? tileHeight : Math.min(tileHeight, lastRow - row); int size = rows * tileWidth * numBands; for(int col = minX; col < lastCol; col += tileWidth) { // Grab the pixels Raster src = im.getData(new Rectangle(col, row, tileWidth, rows)); boolean useDataBuffer = false; if(compression != COMP_JPEG_TTN2) { // JPEG access Raster if(checkContiguous) { if(sampleSize[0] == 8) { // 8-bit ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int[] bankIndices = csm.getBankIndices(); int[] bandOffsets = csm.getBandOffsets(); int pixelStride = csm.getPixelStride(); int lineStride = csm.getScanlineStride(); if(pixelStride != numBands || lineStride != bytesPerRow) { useDataBuffer = false; } else { useDataBuffer = true; for(int i = 0; useDataBuffer && i < numBands; i++) { if(bankIndices[i] != 0 || bandOffsets[i] != i) { useDataBuffer = false; } } } } else { // 1-bit MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); if(mpp.getNumBands() == 1 && mpp.getDataBitOffset() == 0 && mpp.getPixelBitStride() == 1) { useDataBuffer = true; } } } if(!useDataBuffer) { if(dataType == DataBuffer.TYPE_FLOAT) { fpixels = src.getPixels(col, row, tileWidth, rows, fpixels); } else { pixels = src.getPixels(col, row, tileWidth, rows, pixels); } } } int index; int pixel = 0; int k = 0; switch(sampleSize[0]) { case 1: if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); MultiPixelPackedSampleModel mpp = (MultiPixelPackedSampleModel)src.getSampleModel(); int lineStride = mpp.getScanlineStride(); int inOffset = mpp.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write number of pixels exactly divisible by 8 for (int j=0; j<tileWidth/8; j++) { pixel = (pixels[index++] << 7) | (pixels[index++] << 6) | (pixels[index++] << 5) | (pixels[index++] << 4) | (pixels[index++] << 3) | (pixels[index++] << 2) | (pixels[index++] << 1) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Write the pixels remaining after division by 8 if (tileWidth%8 > 0) { pixel = 0; for (int j=0; j<tileWidth%8; j++) { pixel |= (pixels[index++] << (7 - j)); } bpixels[k++] = (byte)pixel; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+7)/8)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 4: index = 0; // For each of the rows in a strip for (int i=0; i<rows; i++) { // Write the number of pixels that will fit into an // even number of nibbles. for (int j=0; j < tileWidth/2; j++) { pixel = (pixels[index++] << 4) | pixels[index++]; bpixels[k++] = (byte)pixel; } // Last pixel for odd-length lines if ((tileWidth & 1) == 1) { pixel = pixels[index++] << 4; bpixels[k++] = (byte)pixel; } } if(compression == COMP_NONE) { output.write(bpixels, 0, rows * ((tileWidth+1)/2)); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 8: if(compression != COMP_JPEG_TTN2) { if(useDataBuffer) { byte[] btmp = ((DataBufferByte)src.getDataBuffer()).getData(); ComponentSampleModel csm = (ComponentSampleModel)src.getSampleModel(); int inOffset = csm.getOffset(col - src.getSampleModelTranslateX(), row - src.getSampleModelTranslateY()); int lineStride = csm.getScanlineStride(); if(lineStride == (int)bytesPerRow) { System.arraycopy(btmp, inOffset, bpixels, 0, (int)bytesPerRow*rows); } else { int outOffset = 0; for(int j = 0; j < rows; j++) { System.arraycopy(btmp, inOffset, bpixels, outOffset, (int)bytesPerRow); inOffset += lineStride; outOffset += (int)bytesPerRow; } } } else { for (int i = 0; i < size; i++) { bpixels[i] = (byte)pixels[i]; } } } if(compression == COMP_NONE) { output.write(bpixels, 0, size); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_JPEG_TTN2) { long startPos = getOffset(output); // Recreate encoder and parameters if the encoder // is null (first data segment) or if its size // doesn't match the current data segment. if(jpegEncoder == null || jpegEncodeParam.getWidth() != src.getWidth() || jpegEncodeParam.getHeight() != src.getHeight()) { jpegEncodeParam = com.sun.image.codec.jpeg.JPEGCodec. getDefaultJPEGEncodeParam(src, jpegColorID); modifyEncodeParam(jep, jpegEncodeParam, numBands); jpegEncoder = com.sun.image.codec.jpeg.JPEGCodec. createJPEGEncoder(output, jpegEncodeParam); } if(jpegRGBToYCbCr) { WritableRaster wRas = null; if(src instanceof WritableRaster) { wRas = (WritableRaster)src; } else { wRas = src.createCompatibleWritableRaster(); wRas.setRect(src); } if (wRas.getMinX() != 0 || wRas.getMinY() != 0) { wRas = wRas.createWritableTranslatedChild(0, 0); } BufferedImage bi = new BufferedImage(colorModel, wRas, false, null); jpegEncoder.encode(bi); } else { jpegEncoder.encode(src.createTranslatedChild(0, 0)); } long endPos = getOffset(output); tileByteCounts[tileNum++] = (int)(endPos - startPos); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 16: int ls = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[ls++] = (byte)((value & 0xff00) >> 8); bpixels[ls++] = (byte) (value & 0x00ff); } if(compression == COMP_NONE) { output.write(bpixels, 0, size*2); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; case 32: if(dataType == DataBuffer.TYPE_INT) { int li = 0; for (int i = 0; i < size; i++) { int value = pixels[i]; bpixels[li++] = (byte)((value & 0xff000000) >>> 24); bpixels[li++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[li++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[li++] = (byte)( value & 0x000000ff); } } else { // DataBuffer.TYPE_FLOAT int lf = 0; for (int i = 0; i < size; i++) { int value = Float.floatToIntBits(fpixels[i]); bpixels[lf++] = (byte)((value & 0xff000000) >>> 24); bpixels[lf++] = (byte)((value & 0x00ff0000) >>> 16); bpixels[lf++] = (byte)((value & 0x0000ff00) >>> 8); bpixels[lf++] = (byte)( value & 0x000000ff); } } if(compression == COMP_NONE) { output.write(bpixels, 0, size*4); } else if(compression == COMP_PACKBITS) { int numCompressedBytes = compressPackBits(bpixels, rows, (int)bytesPerRow, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } else if(compression == COMP_DEFLATE) { int numCompressedBytes = deflate(deflater, bpixels, compressBuf); tileByteCounts[tileNum++] = numCompressedBytes; output.write(compressBuf, 0, numCompressedBytes); } break; } } } if(compression == COMP_NONE) { // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // Recompute the tile offsets the size of the compressed tiles. int totalBytes = 0; for (int i=1; i<numTiles; i++) { int numBytes = (int)tileByteCounts[i-1]; totalBytes += numBytes; tileOffsets[i] = tileOffsets[i-1] + numBytes; } totalBytes += (int)tileByteCounts[numTiles-1]; nextIFDOffset = isLast ? 0 : ifdOffset + dirSize + totalBytes; if ((nextIFDOffset & 0x01) != 0) { // make it even nextIFDOffset++; skipByte = true; } if(outCache == null) { // Original OutputStream must be a SeekableOutputStream. // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } SeekableOutputStream sos = (SeekableOutputStream)output; // Save current position. long savePos = sos.getFilePointer(); // Seek backward to the IFD offset and write IFD. sos.seek(ifdOffset); writeDirectory(ifdOffset, fields, nextIFDOffset); // Seek forward to position after data. sos.seek(savePos); } else if(tempFile != null) { // Using a file cache for the image data. // Open a FileInputStream from which to copy the data. FileInputStream fileStream = new FileInputStream(tempFile); // Close the original SeekableOutputStream. output.close(); // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. byte[] copyBuffer = new byte[8192]; int bytesCopied = 0; while(bytesCopied < totalBytes) { int bytesRead = fileStream.read(copyBuffer); if(bytesRead == -1) { break; } output.write(copyBuffer, 0, bytesRead); bytesCopied += bytesRead; } // Delete the temporary file. fileStream.close(); tempFile.delete(); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else if(output instanceof ByteArrayOutputStream) { // Using a memory cache for the image data. ByteArrayOutputStream memoryStream = (ByteArrayOutputStream)output; // Reset variable to the original OutputStream. output = outCache; // Write the IFD. writeDirectory(ifdOffset, fields, nextIFDOffset); // Write the image data. memoryStream.writeTo(output); // Write an extra byte for IFD word alignment if needed. if(skipByte) { output.write((byte)0); } } else { // This should never happen. throw new IllegalStateException(); } } return nextIFDOffset; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImageEncoder.java
private long getOffset(OutputStream out) throws IOException { if(out instanceof ByteArrayOutputStream) { return ((ByteArrayOutputStream)out).size(); } else if(out instanceof SeekableOutputStream) { return ((SeekableOutputStream)out).getFilePointer(); } else { // Shouldn't happen. throw new IllegalStateException(); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPalette() { if (!paletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam3")); } return (int[])(palette.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBackgroundPaletteIndex() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam4")); } return backgroundPaletteIndex; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public byte[] getPaletteTransparency() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam5")); } byte[] alpha = new byte[transparency.length]; for (int i = 0; i < alpha.length; i++) { alpha[i] = (byte)transparency[i]; } return alpha; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBackgroundGray() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam6")); } return backgroundPaletteGray; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getTransparentGray() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam7")); } int gray = transparency[0]; return gray; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBitShift() { if (!bitShiftSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam8")); } return bitShift; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getBackgroundRGB() { if (!backgroundSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam9")); } return backgroundRGB; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getTransparentRGB() { if (!transparencySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam10")); } return (int[])(transparency.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getBitDepth() { if (!bitDepthSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam11")); } return bitDepth; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public float[] getChromaticity() { if (!chromaticitySet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam12")); } return (float[])(chromaticity.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public float getGamma() { if (!gammaSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam13")); } return gamma; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPaletteHistogram() { if (!paletteHistogramSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam14")); } return paletteHistogram; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public byte[] getICCProfileData() { if (!ICCProfileDataSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam15")); } return (byte[])(ICCProfileData.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getPhysicalDimension() { if (!physicalDimensionSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam16")); } return (int[])(physicalDimension.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public PNGSuggestedPaletteEntry[] getSuggestedPalette() { if (!suggestedPaletteSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam17")); } return (PNGSuggestedPaletteEntry[])(suggestedPalette.clone()); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int[] getSignificantBits() { if (!significantBitsSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam18")); } return (int[])significantBits.clone(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public int getSRGBIntent() { if (!SRGBIntentSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam19")); } return SRGBIntent; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public String[] getText() { if (!textSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam20")); } return text; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public Date getModificationTime() { if (!modificationTimeSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam21")); } return modificationTime; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public String[] getCompressedText() { if (!zTextSet) { throw new IllegalStateException(PropertyUtil.getString("PNGEncodeParam22")); } return zText; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
protected void renderGVTTree() { Rectangle visRect = getRenderRect(); if (gvtRoot == null || visRect.width <= 0 || visRect.height <= 0) { return; } // Renderer setup. if (renderer == null || renderer.getTree() != gvtRoot) { renderer = createImageRenderer(); renderer.setTree(gvtRoot); } // Area of interest computation. AffineTransform inv; try { inv = renderingTransform.createInverse(); } catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); } Shape s = inv.createTransformedShape(visRect); // Rendering thread setup. gvtTreeRenderer = new GVTTreeRenderer(renderer, renderingTransform, doubleBufferedRendering, s, visRect.width, visRect.height); gvtTreeRenderer.setPriority(Thread.MIN_PRIORITY); Iterator it = gvtTreeRendererListeners.iterator(); while (it.hasNext()) { gvtTreeRenderer.addGVTTreeRendererListener ((GVTTreeRendererListener)it.next()); } // Disable the dispatch during the rendering // to avoid concurrent access to the GVT tree. if (eventDispatcher != null) { eventDispatcher.setEventDispatchEnabled(false); } gvtTreeRenderer.start(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void remove() { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.remove(lastRet); if (lastRet < cursor) { cursor--; } lastRet = -1; expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void set(Object o) { if (lastRet == -1) { throw new IllegalStateException(); } checkForComodification(); try { CompositeGraphicsNode.this.set(lastRet, o); expectedModCount = modCount; } catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); } }
// in sources/org/apache/batik/bridge/UpdateManager.java
public void dispatchSVGUnLoadEvent() { if (!started) { throw new IllegalStateException("UpdateManager not started."); } // Invoke first to cancel the pending tasks updateRunnableQueue.preemptLater(new Runnable() { public void run() { synchronized (UpdateManager.this) { AbstractEvent evt = (AbstractEvent) ((DocumentEvent)document).createEvent("SVGEvents"); String type; if (bridgeContext.isSVG12()) { type = "unload"; } else { type = "SVGUnload"; } evt.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, type, false, // canBubbleArg false); // cancelableArg ((EventTarget)(document.getDocumentElement())). dispatchEvent(evt); running = false; // Now shut everything down and disconnect // everything before we send the // UpdateMangerStopped event. scriptingEnvironment.interrupt(); updateRunnableQueue.getThread().halt(); bridgeContext.dispose(); // Send the UpdateManagerStopped event. UpdateManagerEvent ev = new UpdateManagerEvent (UpdateManager.this, null, null); fireEvent(stoppedDispatcher, ev); } } }); resume(); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
protected Map getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result) { SVGTextContentElement tce = null; if (element instanceof SVGTextContentElement) { // 'a' elements aren't SVGTextContentElements, so they shouldn't // be checked for 'textLength' or 'lengthAdjust' attributes. tce = (SVGTextContentElement) element; } Map inheritMap = null; String s; if (SVG_NAMESPACE_URI.equals(element.getNamespaceURI()) && element.getLocalName().equals(SVG_ALT_GLYPH_TAG)) { result.put(ALT_GLYPH_HANDLER, new SVGAltGlyphHandler(ctx, element)); } // Add null TPI objects to the text (after we set it on the // Text we will swap in the correct values. TextPaintInfo pi = new TextPaintInfo(); // Set some basic props so we can get bounds info for complex paints. pi.visible = true; pi.fillPaint = Color.black; result.put(PAINT_INFO, pi); elemTPI.put(element, pi); if (textPath != null) { result.put(TEXTPATH, textPath); } // Text-anchor TextNode.Anchor a = TextUtilities.convertTextAnchor(element); result.put(ANCHOR_TYPE, a); // Font family List fontList = getFontList(ctx, element, result); result.put(GVT_FONTS, fontList); // Text baseline adjustment. Object bs = TextUtilities.convertBaselineShift(element); if (bs != null) { result.put(BASELINE_SHIFT, bs); } // Unicode-bidi mode Value val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.UNICODE_BIDI_INDEX); s = val.getStringValue(); if (s.charAt(0) == 'n') { if (bidiLevel != null) result.put(TextAttribute.BIDI_EMBEDDING, bidiLevel); } else { // Text direction // XXX: this needs to coordinate with the unicode-bidi // property, so that when an explicit reversal // occurs, the BIDI_EMBEDDING level is // appropriately incremented or decremented. // Note that direction is implicitly handled by unicode // BiDi algorithm in most cases, this property // is only needed when one wants to override the // normal writing direction for a string/substring. val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.DIRECTION_INDEX); String rs = val.getStringValue(); int cbidi = 0; if (bidiLevel != null) cbidi = bidiLevel.intValue(); // We don't care if it was embed or override we just want // it's level here. So map override to positive value. if (cbidi < 0) cbidi = -cbidi; switch (rs.charAt(0)) { case 'l': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_LTR); if ((cbidi & 0x1) == 1) cbidi++; // was odd now even else cbidi+=2; // next greater even number break; case 'r': result.put(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); if ((cbidi & 0x1) == 1) cbidi+=2; // next greater odd number else cbidi++; // was even now odd break; } switch (s.charAt(0)) { case 'b': // bidi-override cbidi = -cbidi; // For bidi-override we want a negative number. break; } result.put(TextAttribute.BIDI_EMBEDDING, new Integer(cbidi)); } // Writing mode val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.WRITING_MODE_INDEX); s = val.getStringValue(); switch (s.charAt(0)) { case 'l': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_LTR); break; case 'r': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_RTL); break; case 't': result.put(GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE, GVTAttributedCharacterIterator. TextAttribute.WRITING_MODE_TTB); break; } // glyph-orientation-vertical val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX); int primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: // auto result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_AUTO); break; case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION, GVTAttributedCharacterIterator. TextAttribute.ORIENTATION_ANGLE); result.put(GVTAttributedCharacterIterator. TextAttribute.VERTICAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (V):" + primitiveType ); } // glyph-orientation-horizontal val = CSSUtilities.getComputedStyle (element, SVGCSSEngine.GLYPH_ORIENTATION_HORIZONTAL_INDEX); primitiveType = val.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_DEG: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue())); break; case CSSPrimitiveValue.CSS_RAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float( Math.toDegrees( val.getFloatValue() ) )); break; case CSSPrimitiveValue.CSS_GRAD: result.put(GVTAttributedCharacterIterator. TextAttribute.HORIZONTAL_ORIENTATION_ANGLE, new Float(val.getFloatValue() * 9 / 5)); break; default: // Cannot happen throw new IllegalStateException("unexpected primitiveType (H):" + primitiveType ); } // text spacing properties... // Letter Spacing Float sp = TextUtilities.convertLetterSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.LETTER_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Word spacing sp = TextUtilities.convertWordSpacing(element); if (sp != null) { result.put(GVTAttributedCharacterIterator. TextAttribute.WORD_SPACING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } // Kerning sp = TextUtilities.convertKerning(element); if (sp != null) { result.put(GVTAttributedCharacterIterator.TextAttribute.KERNING, sp); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } if (tce == null) { return inheritMap; } try { // textLength AbstractSVGAnimatedLength textLength = (AbstractSVGAnimatedLength) tce.getTextLength(); if (textLength.isSpecified()) { if (inheritMap == null) { inheritMap = new HashMap(); } Object value = new Float(textLength.getCheckedValue()); result.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); inheritMap.put (GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH, value); // lengthAdjust SVGOMAnimatedEnumeration _lengthAdjust = (SVGOMAnimatedEnumeration) tce.getLengthAdjust(); if (_lengthAdjust.getCheckedVal() == SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS) { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_ALL); } else { result.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.LENGTH_ADJUST, GVTAttributedCharacterIterator. TextAttribute.ADJUST_SPACING); result.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); inheritMap.put(GVTAttributedCharacterIterator. TextAttribute.CUSTOM_SPACING, Boolean.TRUE); } } } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } return inheritMap; }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static int convertPointerEvents(Element e) { Value v = getComputedStyle(e, SVGCSSEngine.POINTER_EVENTS_INDEX); String s = v.getStringValue(); switch(s.charAt(0)) { case 'v': if (s.length() == 7) { return GraphicsNode.VISIBLE; } else { switch(s.charAt(7)) { case 'p': return GraphicsNode.VISIBLE_PAINTED; case 'f': return GraphicsNode.VISIBLE_FILL; case 's': return GraphicsNode.VISIBLE_STROKE; default: // can't be reached throw new IllegalStateException("unexpected event, must be one of (p,f,s) is:" + s.charAt(7) ); } } case 'p': return GraphicsNode.PAINTED; case 'f': return GraphicsNode.FILL; case 's': return GraphicsNode.STROKE; case 'a': return GraphicsNode.ALL; case 'n': return GraphicsNode.NONE; default: // can't be reached throw new IllegalStateException("unexpected event, must be one of (v,p,f,s,a,n) is:" + s.charAt(0) ); } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Rectangle2D convertEnableBackground(Element e /*, UnitProcessor.Context uctx*/) { Value v = getComputedStyle(e, SVGCSSEngine.ENABLE_BACKGROUND_INDEX); if (v.getCssValueType() != CSSValue.CSS_VALUE_LIST) { return null; // accumulate } ListValue lv = (ListValue)v; int length = lv.getLength(); switch (length) { case 1: return CompositeGraphicsNode.VIEWPORT; // new case 5: // new <x>,<y>,<width>,<height> float x = lv.item(1).getFloatValue(); float y = lv.item(2).getFloatValue(); float w = lv.item(3).getFloatValue(); float h = lv.item(4).getFloatValue(); return new Rectangle2D.Float(x, y, w, h); default: throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static float[] convertClip(Element e) { Value v = getComputedStyle(e, SVGCSSEngine.CLIP_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_RECT: float [] off = new float[4]; off[0] = v.getTop().getFloatValue(); off[1] = v.getRight().getFloatValue(); off[2] = v.getBottom().getFloatValue(); off[3] = v.getLeft().getFloatValue(); return off; case CSSPrimitiveValue.CSS_IDENT: return null; // 'auto' means no offsets default: // can't be reached throw new IllegalStateException("Unexpected primitiveType:" + primitiveType ); } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Filter convertFilter(Element filteredElement, GraphicsNode filteredNode, BridgeContext ctx) { Value v = getComputedStyle(filteredElement, SVGCSSEngine.FILTER_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'filter:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element filter = ctx.getReferencedElement(filteredElement, uri); Bridge bridge = ctx.getBridge(filter); if (bridge == null || !(bridge instanceof FilterBridge)) { throw new BridgeException(ctx, filteredElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((FilterBridge)bridge).createFilter(ctx, filter, filteredElement, filteredNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static ClipRable convertClipPath(Element clippedElement, GraphicsNode clippedNode, BridgeContext ctx) { Value v = getComputedStyle(clippedElement, SVGCSSEngine.CLIP_PATH_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'clip-path:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element cp = ctx.getReferencedElement(clippedElement, uri); Bridge bridge = ctx.getBridge(cp); if (bridge == null || !(bridge instanceof ClipBridge)) { throw new BridgeException(ctx, clippedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((ClipBridge)bridge).createClip(ctx, cp, clippedElement, clippedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/bridge/CSSUtilities.java
public static Mask convertMask(Element maskedElement, GraphicsNode maskedNode, BridgeContext ctx) { Value v = getComputedStyle(maskedElement, SVGCSSEngine.MASK_INDEX); int primitiveType = v.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: return null; // 'mask:none' case CSSPrimitiveValue.CSS_URI: String uri = v.getStringValue(); Element m = ctx.getReferencedElement(maskedElement, uri); Bridge bridge = ctx.getBridge(m); if (bridge == null || !(bridge instanceof MaskBridge)) { throw new BridgeException(ctx, maskedElement, ERR_CSS_URI_BAD_TARGET, new Object[] {uri}); } return ((MaskBridge)bridge).createMask(ctx, m, maskedElement, maskedNode); default: throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void invokeLater(Runnable r) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (list) { list.push(new Link(r)); list.notify(); } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void invokeAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.push(l); list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public void preemptLater(Runnable r) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (list) { list.add(preemptCount, new Link(r)); preemptCount++; list.notify(); } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void preemptAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.add(preemptCount, l); preemptCount++; list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public void suspendExecution(boolean waitTillSuspended) { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } // System.err.println("Suspend Called"); synchronized (stateLock) { wasResumed = false; if (state == SUSPENDED) { // already suspended, notify stateLock so an event is // generated. stateLock.notifyAll(); return; } if (state == RUNNING) { state = SUSPENDING; synchronized (list) { // Wake up run thread if it is waiting for jobs, // so we go into the suspended case (notifying // run-handler etc...) list.notify(); } } if (waitTillSuspended) { while (state == SUSPENDING) { try { stateLock.wait(); } catch(InterruptedException ie) { } } } } }
// in sources/org/apache/batik/util/RunnableQueue.java
public void resumeExecution() { // System.err.println("Resume Called"); if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } synchronized (stateLock) { wasResumed = true; if (state != RUNNING) { state = RUNNING; stateLock.notifyAll(); // wake it up. } } }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public int getIntegerValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public float getFloatValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getDimensionUnitText() { switch (lexicalUnitType) { case LexicalUnit.SAC_CENTIMETER: return UNIT_TEXT_CENTIMETER; case LexicalUnit.SAC_DEGREE: return UNIT_TEXT_DEGREE; case LexicalUnit.SAC_EM: return UNIT_TEXT_EM; case LexicalUnit.SAC_EX: return UNIT_TEXT_EX; case LexicalUnit.SAC_GRADIAN: return UNIT_TEXT_GRADIAN; case LexicalUnit.SAC_HERTZ: return UNIT_TEXT_HERTZ; case LexicalUnit.SAC_INCH: return UNIT_TEXT_INCH; case LexicalUnit.SAC_KILOHERTZ: return UNIT_TEXT_KILOHERTZ; case LexicalUnit.SAC_MILLIMETER: return UNIT_TEXT_MILLIMETER; case LexicalUnit.SAC_MILLISECOND: return UNIT_TEXT_MILLISECOND; case LexicalUnit.SAC_PERCENTAGE: return UNIT_TEXT_PERCENTAGE; case LexicalUnit.SAC_PICA: return UNIT_TEXT_PICA; case LexicalUnit.SAC_PIXEL: return UNIT_TEXT_PIXEL; case LexicalUnit.SAC_POINT: return UNIT_TEXT_POINT; case LexicalUnit.SAC_RADIAN: return UNIT_TEXT_RADIAN; case LexicalUnit.SAC_REAL: return UNIT_TEXT_REAL; case LexicalUnit.SAC_SECOND: return UNIT_TEXT_SECOND; default: throw new IllegalStateException("No Unit Text for type: " + lexicalUnitType); } }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getFunctionName() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public LexicalUnit getParameters() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public String getStringValue() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/parser/CSSLexicalUnit.java
public LexicalUnit getSubValues() { throw new IllegalStateException(); }
// in sources/org/apache/batik/css/dom/CSSOMSVGColor.java
public short getColorType() { Value value = valueProvider.getValue(); int cssValueType = value.getCssValueType(); switch ( cssValueType ) { case CSSValue.CSS_PRIMITIVE_VALUE: int primitiveType = value.getPrimitiveType(); switch ( primitiveType ) { case CSSPrimitiveValue.CSS_IDENT: { if (value.getStringValue().equalsIgnoreCase (CSSConstants.CSS_CURRENTCOLOR_VALUE)) return SVG_COLORTYPE_CURRENTCOLOR; return SVG_COLORTYPE_RGBCOLOR; } case CSSPrimitiveValue.CSS_RGBCOLOR: return SVG_COLORTYPE_RGBCOLOR; } // there was no case for this primitiveType, prevent throwing the other exception throw new IllegalStateException("Found unexpected PrimitiveType:" + primitiveType ); case CSSValue.CSS_VALUE_LIST: return SVG_COLORTYPE_RGBCOLOR_ICCCOLOR; } // should not happen throw new IllegalStateException("Found unexpected CssValueType:" + cssValueType ); }
// in sources/org/apache/batik/css/engine/value/AbstractColorManager.java
public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { String ident = value.getStringValue(); // Search for a direct computed value. Value v = (Value)computedValues.get(ident); if (v != null) { return v; } // Must be a system color... if (values.get(ident) == null) { throw new IllegalStateException("Not a system-color:" + ident ); } return engine.getCSSContext().getSystemColor(ident); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
protected void inlineStyleAttributeUpdated(CSSStylableElement elt, StyleMap style, short attrChange, String prevValue, String newValue) { boolean[] updated = styleDeclarationUpdateHandler.updatedProperties; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { updated[i] = false; } switch (attrChange) { case MutationEvent.ADDITION: // intentional fall-through case MutationEvent.MODIFICATION: if (newValue.length() > 0) { element = elt; try { parser.setSelectorFactory(CSSSelectorFactory.INSTANCE); parser.setConditionFactory(cssConditionFactory); styleDeclarationUpdateHandler.styleMap = style; parser.setDocumentHandler(styleDeclarationUpdateHandler); parser.parseStyleDeclaration(newValue); styleDeclarationUpdateHandler.styleMap = null; } catch (Exception e) { String m = e.getMessage(); if (m == null) m = ""; String u = ((documentURI == null)?"<unknown>": documentURI.toString()); String s = Messages.formatMessage ("style.syntax.error.at", new Object[] { u, styleLocalName, newValue, m }); DOMException de = new DOMException(DOMException.SYNTAX_ERR, s); if (userAgent == null) throw de; userAgent.displayError(de); } finally { element = null; cssBaseURI = null; } } // Fall through case MutationEvent.REMOVAL: boolean removed = false; if (prevValue != null && prevValue.length() > 0) { // Check if the style map has cascaded styles which // come from the inline style attribute or override style. for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (style.isComputed(i) && !updated[i]) { short origin = style.getOrigin(i); if (origin >= StyleMap.INLINE_AUTHOR_ORIGIN) { // ToDo Jlint says: always same result ?? removed = true; updated[i] = true; } } } } if (removed) { invalidateProperties(elt, null, updated, true); } else { int count = 0; // Invalidate the relative values boolean fs = (fontSizeIndex == -1) ? false : updated[fontSizeIndex]; boolean lh = (lineHeightIndex == -1) ? false : updated[lineHeightIndex]; boolean cl = (colorIndex == -1) ? false : updated[colorIndex]; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (updated[i]) { count++; } else if ((fs && style.isFontSizeRelative(i)) || (lh && style.isLineHeightRelative(i)) || (cl && style.isColorRelative(i))) { updated[i] = true; clearComputedValue(style, i); count++; } } if (count > 0) { int[] props = new int[count]; count = 0; for (int i = getNumberOfProperties() - 1; i >= 0; --i) { if (updated[i]) { props[count++] = i; } } invalidateProperties(elt, props, null, true); } } break; default: // Must not happen throw new IllegalStateException("Invalid attrChangeType"); } }
1
            
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
0 1
            
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (IllegalStateException ise) { // Not running, which is probably ok since that's what we // wanted. Might be an issue if SVGUnload wasn't issued... }
0 0
unknown (Lib) IndexOutOfBoundsException 35
            
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public Shape getDependencyRegion(int srcIndex, Rectangle outputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Return empty rect if they don't intersect. if ( ! outputRgn.intersects(bounds) ) return new Rectangle(); // We only depend on our source for stuff that is inside // our bounds... return outputRgn.intersection(bounds); }
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public Shape getDirtyRegion(int srcIndex, Rectangle inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Return empty rect if they don't intersect. if ( ! inputRgn.intersects(bounds) ) return new Rectangle(); // Changes in the input region don't propogate outside our // bounds. return inputRgn.intersection(bounds); }
// in sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
public WritableRaster makeTile(int tileX, int tileY) { if ((tileX < minTileX) || (tileX >= minTileX+numXTiles) || (tileY < minTileY) || (tileY >= minTileY+numYTiles)) throw new IndexOutOfBoundsException ("Requested Tile (" + tileX + ',' + tileY + ") lies outside the bounds of image"); Point pt = new Point(tileGridXOff+tileX*tileWidth, tileGridYOff+tileY*tileHeight); WritableRaster wr; wr = Raster.createWritableRaster(sm, pt); // if (!(sm instanceof SinglePixelPackedSampleModel)) // wr = Raster.createWritableRaster(sm, pt); // else { // SinglePixelPackedSampleModel sppsm; // sppsm = (SinglePixelPackedSampleModel)sm; // int stride = sppsm.getScanlineStride(); // int sz = stride*sppsm.getHeight(); // // int [] data = reclaim.request(sz); // DataBuffer db = new DataBufferInt(data, sz); // // reclaim.register(db); // // wr = Raster.createWritableRaster(sm, db, pt); // } // System.out.println("MT DB: " + wr.getDataBuffer().getSize()); int x0 = wr.getMinX(); int y0 = wr.getMinY(); int x1 = x0+wr.getWidth() -1; int y1 = y0+wr.getHeight()-1; if ((x0 < bounds.x) || (x1 >= (bounds.x+bounds.width)) || (y0 < bounds.y) || (y1 >= (bounds.y+bounds.height))) { // Part of this raster lies outside our bounds so subset // it so it only advertises the stuff inside our bounds. if (x0 < bounds.x) x0 = bounds.x; if (y0 < bounds.y) y0 = bounds.y; if (x1 >= (bounds.x+bounds.width)) x1 = bounds.x+bounds.width-1; if (y1 >= (bounds.y+bounds.height)) y1 = bounds.y+bounds.height-1; wr = wr.createWritableChild(x0, y0, x1-x0+1, y1-y0+1, x0, y0, null); } return wr; }
// in sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
public Shape getDependencyRegion(int srcIndex, Rectangle outputRgn) { throw new IndexOutOfBoundsException ("Nonexistant source requested."); }
// in sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
public Shape getDirtyRegion(int srcIndex, Rectangle inputRgn) { throw new IndexOutOfBoundsException ("Nonexistant source requested."); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); if (invAffine == null) return null; return invAffine.createTransformedShape(outputRgn); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); return affine.createTransformedShape(inputRgn); }
// in sources/org/apache/batik/ext/awt/image/renderable/PadRable8Bit.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); // We only depend on our source for stuff that is inside // our bounds and his bounds (remember our bounds may be // tighter than his in one or both directions). Rectangle2D srect = getSource().getBounds2D(); if ( ! srect.intersects(outputRgn) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, outputRgn, srect); Rectangle2D bounds = getBounds2D(); if ( ! srect.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
// in sources/org/apache/batik/ext/awt/image/renderable/PadRable8Bit.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); inputRgn = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Changes in the input region don't propogate outside our // bounds. if ( ! inputRgn.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(inputRgn, bounds, inputRgn); return inputRgn; }
// in sources/org/apache/batik/ext/awt/image/renderable/AbstractRable.java
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // We only depend on our source for stuff that is inside // our bounds... Rectangle2D srect = (Rectangle2D)outputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Return empty rect if they don't intersect. if ( ! bounds.intersects(srect) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
// in sources/org/apache/batik/ext/awt/image/renderable/AbstractRable.java
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if ((srcIndex < 0) || (srcIndex > srcs.size())) throw new IndexOutOfBoundsException ("Nonexistant source requested."); // Changes in the input region don't propogate outside our // bounds. Rectangle2D drect = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Return empty rect if they don't intersect. if ( ! bounds.intersects(drect) ) return new Rectangle2D.Float(); Rectangle2D.intersect(drect, bounds, drect); return drect; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void add(int index, Object o) { // Check for correct arguments if (!(o instanceof GraphicsNode)) { throw new IllegalArgumentException(o+" is not a GraphicsNode"); } if (index > count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } GraphicsNode node = (GraphicsNode) o; { fireGraphicsNodeChangeStarted(node); } // Reparent the graphics node and tidy up the tree's state if (node.getParent() != null) { node.getParent().getChildren().remove(node); } // Insert the node to the children list ensureCapacity(count+1); // Increments modCount!! System.arraycopy(children, index, children, index+1, count-index); children[index] = node; count++; // Set parent of the graphics node ((AbstractGraphicsNode) node).setParent(this); // Set root of the graphics node ((AbstractGraphicsNode) node).setRoot(this.getRoot()); // Invalidates cached values invalidateGeometryCache(); // Create and dispatch event // int id = CompositeGraphicsNodeEvent.GRAPHICS_NODE_ADDED; // dispatchEvent(new CompositeGraphicsNodeEvent(this, id, node)); fireGraphicsNodeChangeCompleted(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public ListIterator listIterator(int index) { if (index < 0 || index > count) { throw new IndexOutOfBoundsException("Index: "+index); } return new ListItr(index); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
private void checkRange(int index) { if (index >= count || index < 0) { throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+count); } }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int getGlyphCode(int glyphIndex) throws IndexOutOfBoundsException { if (glyphIndex < 0 || glyphIndex > (glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex " + glyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } return glyphs[glyphIndex].getGlyphCode(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + "."); } return null; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public GVTGlyphMetrics getGlyphMetrics(int idx) { if (idx < 0 || (idx > glyphs.length-1)) throw new IndexOutOfBoundsException ("idx: " + idx + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); // check to see if we should kern this glyph // I return the kerning information in the glyph metrics // as a first pass at implementation (I don't want to // fiddle with layout too much right now). if (idx < glyphs.length - 1) { // check for kerning if (font != null) { float hkern = font.getHKern(glyphs[idx].getGlyphCode(), glyphs[idx+1].getGlyphCode()); float vkern = font.getVKern(glyphs[idx].getGlyphCode(), glyphs[idx+1].getGlyphCode()); return glyphs[idx].getGlyphMetrics(hkern, vkern); } } // get a normal metrics return glyphs[idx].getGlyphMetrics(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Shape getGlyphOutline(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + "."); } return glyphs[glyphIndex].getOutline(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Point2D getGlyphPosition(int glyphIndex) { if (glyphIndex == glyphs.length) return endPos; if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getPosition(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn) { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length+1) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + '+' + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (positionReturn == null) { positionReturn = new float[numEntries*2]; } if ((beginGlyphIndex+numEntries) == glyphs.length+1) { numEntries--; positionReturn[numEntries*2] = (float)endPos.getX(); positionReturn[numEntries*2+1] = (float)endPos.getY(); } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { Point2D glyphPos; glyphPos = glyphs[i].getPosition(); positionReturn[(i-beginGlyphIndex)*2] = (float)glyphPos.getX(); positionReturn[(i-beginGlyphIndex)*2 + 1] = (float)glyphPos.getY(); } return positionReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public AffineTransform getGlyphTransform(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getTransform(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public Shape getGlyphVisualBounds(int glyphIndex) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } return glyphs[glyphIndex].getOutline(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphPosition(int glyphIndex, Point2D newPos) throws IndexOutOfBoundsException { if (glyphIndex == glyphs.length) { endPos = (Point2D)newPos.clone(); return; } if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setPosition(newPos); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphTransform(int glyphIndex, AffineTransform newTX) { if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setTransform(newTX); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
0 3
            
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int getGlyphCode(int glyphIndex) throws IndexOutOfBoundsException { if (glyphIndex < 0 || glyphIndex > (glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex " + glyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } return glyphs[glyphIndex].getGlyphCode(); }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) throws IndexOutOfBoundsException, IllegalArgumentException { if (numEntries < 0) { throw new IllegalArgumentException("numEntries argument value, " + numEntries + ", is illegal. It must be > 0."); } if (beginGlyphIndex < 0) { throw new IndexOutOfBoundsException("beginGlyphIndex " + beginGlyphIndex + " is out of bounds, should be between 0 and " + (glyphs.length-1)); } if ((beginGlyphIndex+numEntries) > glyphs.length) { throw new IndexOutOfBoundsException("beginGlyphIndex + numEntries (" + beginGlyphIndex + "+" + numEntries + ") exceeds the number of glpyhs in this GlyphVector"); } if (codeReturn == null) { codeReturn = new int[numEntries]; } for (int i = beginGlyphIndex; i < (beginGlyphIndex+numEntries); i++) { codeReturn[i-beginGlyphIndex] = glyphs[i].getGlyphCode(); } return codeReturn; }
// in sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
public void setGlyphPosition(int glyphIndex, Point2D newPos) throws IndexOutOfBoundsException { if (glyphIndex == glyphs.length) { endPos = (Point2D)newPos.clone(); return; } if (glyphIndex < 0 || (glyphIndex > glyphs.length-1)) { throw new IndexOutOfBoundsException("glyphIndex: " + glyphIndex + ", is out of bounds. Should be between 0 and " + (glyphs.length-1) + '.' ); } glyphs[glyphIndex].setPosition(newPos); glyphLogicalBounds[glyphIndex] = null; outline = null; bounds2D = null; logicalBounds = null; }
7
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/text/GVTACIImpl.java
catch(IndexOutOfBoundsException e) { }
// in sources/org/apache/batik/gvt/text/GVTACIImpl.java
catch(IndexOutOfBoundsException e) { }
5
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { throw new ConcurrentModificationException(); }
0
unknown (Lib) InstantiationException 0 0 0 4
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
catch (InstantiationException e) { return null; }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
catch (InstantiationException e) { return null; }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
2
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/dom/ExtensibleDOMImplementation.java
catch (InstantiationException e) { throw new DOMException(DOMException.INVALID_ACCESS_ERR, formatMessage("css.parser.creation", new Object[] { pn })); }
1
unknown (Lib) InternalError 1
            
// in sources/org/apache/batik/css/dom/CSSOMSVGPaint.java
public String getUri() { switch (getPaintType()) { case SVG_PAINTTYPE_URI: return valueProvider.getValue().getStringValue(); case SVG_PAINTTYPE_URI_NONE: case SVG_PAINTTYPE_URI_CURRENTCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: return valueProvider.getValue().item(0).getStringValue(); } throw new InternalError(); }
0 0 0 0 0
runtime (Domain) InterpreterException
public class InterpreterException extends RuntimeException {
    private int line = -1; // -1 when unknown
    private int column = -1; // -1 when unknown
    private Exception embedded = null; // null when unknown

    /**
     * Builds an instance of <code>InterpreterException</code>.
     * @param message the <code>Exception</code> message.
     * @param lineno the number of the line the error occurs.
     * @param columnno the number of the column the error occurs.
     */
    public InterpreterException(String message, int lineno, int columnno) {
        super(message);
        line = lineno;
        column = columnno;
    }

    /**
     * Builds an instance of <code>InterpreterException</code>.
     * @param exception the embedded exception.
     * @param message the <code>Exception</code> message.
     * @param lineno the number of the line the error occurs.
     * @param columnno the number of the column the error occurs.
     */
    public InterpreterException(Exception exception,
                                String message, int lineno, int columnno) {
        this(message, lineno, columnno);
        embedded = exception;
    }

    /**
     * Returns the line number where the error occurs. If this value is not
     * known, returns -1.
     */
    public int getLineNumber() {
        return line;
    }

    /**
     * Returns the column number where the error occurs. If this value is not
     * known, returns -1.
     */
    public int getColumnNumber() {
        return column;
    }

    /**
     * Returns the embedded exception. If no embedded exception is set,
     * returns null.
     */
    public Exception getException() {
        return embedded;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }
}
12
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
public Object evaluate(String script) { try { interpreter.eval(script, 0); } catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } return interpreter.getResult(); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
public Object evaluate(String script) { try { interpreter.exec(script); } catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } return null; }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final Reader scriptReader, final String description) throws IOException { ContextAction evaluateAction = new ContextAction() { public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } } }; try { return contextFactory.call(evaluateAction); } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (InterruptedBridgeException ibe) { throw ibe; } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object evaluate(final String scriptStr) { ContextAction evalAction = new ContextAction() { public Object run(final Context cx) { Script script = null; Entry entry = null; Iterator it = compiledScripts.iterator(); // between nlog(n) and log(n) because it is // an AbstractSequentialList while (it.hasNext()) { if ((entry = (Entry) it.next()).str.equals(scriptStr)) { // if it is not at the end, remove it because // it will change from place (it is faster // to remove it now) script = entry.script; it.remove(); break; } } if (script == null) { // this script has not been compiled yet or has been // forgotten since the compilation: // compile it and store it for future use. PrivilegedAction compile = new PrivilegedAction() { public Object run() { try { return cx.compileReader (new StringReader(scriptStr), SOURCE_NAME_SVG, 1, rhinoClassLoader); } catch (IOException ioEx ) { // Should never happen: using a string throw new Error( ioEx.getMessage() ); } } }; script = (Script)AccessController.doPrivileged(compile); if (compiledScripts.size() + 1 > MAX_CACHED_SCRIPTS) { // too many cached items - we should delete the // oldest entry. all of this is very fast on // linkedlist compiledScripts.removeFirst(); } // storing is done here: compiledScripts.addLast(new Entry(scriptStr, script)); } else { // this script has been compiled before, // just update its index so it won't get deleted soon. compiledScripts.addLast(entry); } return script.exec(cx, globalObject); } }; try { return contextFactory.call(evalAction); } catch (InterpreterException ie) { throw ie; } catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); } catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } } catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); } }
12
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
0 6
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterpreterException ie) { throw ie; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { System.err.println("InterpExcept: " + e); handleInterpreterException(e); return; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (InterpreterException e) { handleInterpreterException(e); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (InterpreterException ie) { handleInterpreterException(ie); synchronized (this) { error = true; } }
1
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterpreterException ie) { throw ie; }
0
runtime (Domain) InterruptedBridgeException
public class InterruptedBridgeException extends RuntimeException {

    /**
     * Constructs a new InterruptedBridgeException.
     */
    public InterruptedBridgeException() { }
}
3
            
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl) { Rectangle2D bounds = getImageBounds(ctx, e); if ((bounds.getWidth() == 0) || (bounds.getHeight() == 0)) { ShapeNode sn = new ShapeNode(); sn.setShape(bounds); return sn; } SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument(); String docURL = svgDoc.getURL(); ParsedURL pDocURL = null; if (docURL != null) pDocURL = new ParsedURL(docURL); UserAgent userAgent = ctx.getUserAgent(); try { userAgent.checkLoadExternalResource(purl, pDocURL); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } DocumentLoader loader = ctx.getDocumentLoader(); ImageTagRegistry reg = ImageTagRegistry.getRegistry(); ICCColorSpaceExt colorspace = extractColorSpace(e, ctx); { /** * Before we open the URL we see if we have the * URL already cached and parsed */ try { /* Check the document loader cache */ Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } } catch (BridgeException ex) { throw ex; } catch (Exception ex) { /* Nothing to do */ } /* Check the ImageTagRegistry Cache */ Filter img = reg.checkCache(purl, colorspace); if (img != null) { return createRasterImageNode(ctx, e, img, purl); } } /* The Protected Stream ensures that the stream doesn't * get closed unless we want it to. It is also based on * a Buffered Reader so in general we can mark the start * and reset rather than reopening the stream. Finally * it hides the mark/reset methods so only we get to * use them. */ ProtectedStream reference = null; try { reference = openStream(e, purl); } catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (IOException ioe) { return createBrokenImageNode(ctx, e, purl.toString(), ioe.getLocalizedMessage()); } { /** * First see if we can id the file as a Raster via magic * number. This is probably the fastest mechanism. * We tell the registry what the source purl is but we * tell it not to open that url. */ Filter img = reg.readURL(reference, purl, colorspace, false, false); if (img != null) { try { reference.tie(); } catch (IOException ioe) { // This would be from a close, Let it slide... } // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } try { // Reset the stream for next try. reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { // Since we already opened the stream this is unlikely. return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { /** * Next see if it's an XML document. */ Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc; return createSVGImageNode(ctx, e, imgDocument); } catch (BridgeException ex) { reference.release(); throw ex; } catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); } catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); } catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; } catch (Exception ex) { /* Do nothing drop out... */ // ex.printStackTrace(); } try { reference.retry(); } catch (IOException ioe) { reference.release(); reference = null; try { // Couldn't reset stream so reopen it. reference = openStream(e, purl); } catch (IOException ioe2) { return createBrokenImageNode(ctx, e, purl.toString(), ioe2.getLocalizedMessage()); } } try { // Finally try to load the image as a raster image (JPG or // PNG) allowing the registry to open the url (so the // JDK readers can be checked). Filter img = reg.readURL(reference, purl, colorspace, true, true); if (img != null) { // It's a bouncing baby Raster... return createRasterImageNode(ctx, e, img, purl); } } finally { reference.release(); } return null; }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Node getReferencedNode(Element e, String uri) { try { SVGDocument document = (SVGDocument)e.getOwnerDocument(); URIResolver ur = createURIResolver(document, documentLoader); Node ref = ur.getNode(uri, e); if (ref == null) { throw new BridgeException(this, e, ERR_URI_BAD_TARGET, new Object[] {uri}); } else { SVGOMDocument refDoc = (SVGOMDocument) (ref.getNodeType() == Node.DOCUMENT_NODE ? ref : ref.getOwnerDocument()); // This is new rather than attaching this BridgeContext // with the new document we now create a whole new // BridgeContext to go with the new document. // This means that the new document has it's own // world of stuff and it should avoid memory leaks // since the new document isn't 'tied into' this // bridge context. if (refDoc != document) { createSubBridgeContext(refDoc); } return ref; } } catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); } catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); } catch (IOException ex) { //ex.printStackTrace(); throw new BridgeException(this, e, ex, ERR_URI_IO, new Object[] {uri}); } catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); } }
// in sources/org/apache/batik/bridge/GVTBuilder.java
protected void buildGraphicsNode(BridgeContext ctx, Element e, CompositeGraphicsNode parentNode) { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new InterruptedBridgeException(); } // get the appropriate bridge according to the specified element Bridge bridge = ctx.getBridge(e); if (bridge instanceof GenericBridge) { // If it is a GenericBridge just handle it and any GenericBridge // descendents and return. ((GenericBridge) bridge).handleElement(ctx, e); handleGenericBridges(ctx, e); return; } else if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) { handleGenericBridges(ctx, e); return; } // check the display property if (!CSSUtilities.convertDisplay(e)) { handleGenericBridges(ctx, e); return; } GraphicsNodeBridge gnBridge = (GraphicsNodeBridge)bridge; try { // create the associated graphics node GraphicsNode gn = gnBridge.createGraphicsNode(ctx, e); if (gn != null) { // attach the graphics node to the GVT tree now ! parentNode.getChildren().add(gn); // check if the element has children to build if (gnBridge.isComposite()) { buildComposite(ctx, e, (CompositeGraphicsNode)gn); } else { // if not then still handle the GenericBridges handleGenericBridges(ctx, e); } gnBridge.buildGraphicsNode(ctx, e, gn); } else { handleGenericBridges(ctx, e); } } catch (BridgeException ex) { // some bridge may decide that the node in error can be // displayed (e.g. polyline, path...) // In this case, the exception contains the GraphicsNode GraphicsNode errNode = ex.getGraphicsNode(); if (errNode != null) { parentNode.getChildren().add(errNode); gnBridge.buildGraphicsNode(ctx, e, errNode); ex.setGraphicsNode(null); } //ex.printStackTrace(); throw ex; } }
2
            
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
0 6
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterruptedBridgeException ibe) { throw ibe; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedBridgeException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (InterruptedBridgeException e) { // this sometimes happens with SVG Fonts since the glyphs are // not built till the rendering stage fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedBridgeException ibe) { /* do nothing */ }
2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (InterruptedBridgeException ibe) { throw ibe; }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedBridgeException ibe) { reference.release(); throw ibe; }
0
unknown (Lib) InterruptedException 0 0 8
            
// in sources/org/apache/batik/bridge/UpdateManager.java
public synchronized void dispatchSVGLoadEvent() throws InterruptedException { dispatchSVGLoadEvent(bridgeContext, scriptingEnvironment); for (int i = 0; i < secondaryScriptingEnvironments.length; i++) { BridgeContext ctx = secondaryBridgeContexts[i]; if (!((SVGOMDocument) ctx.getDocument()).isSVG12()) { continue; } ScriptingEnvironment se = secondaryScriptingEnvironments[i]; dispatchSVGLoadEvent(ctx, se); } secondaryBridgeContexts = null; secondaryScriptingEnvironments = null; }
// in sources/org/apache/batik/bridge/UpdateManager.java
public void dispatchSVGZoomEvent() throws InterruptedException { scriptingEnvironment.dispatchSVGZoomEvent(); }
// in sources/org/apache/batik/bridge/UpdateManager.java
public void dispatchSVGScrollEvent() throws InterruptedException { scriptingEnvironment.dispatchSVGScrollEvent(); }
// in sources/org/apache/batik/bridge/UpdateManager.java
public void dispatchSVGResizeEvent() throws InterruptedException { scriptingEnvironment.dispatchSVGResizeEvent(); }
// in sources/org/apache/batik/bridge/RepaintManager.java
public Collection updateRendering(Collection areas) throws InterruptedException { renderer.flush(areas); List rects = new ArrayList(areas.size()); AffineTransform at = renderer.getTransform(); Iterator i = areas.iterator(); while (i.hasNext()) { Shape s = (Shape)i.next(); s = at.createTransformedShape(s); Rectangle2D r2d = s.getBounds2D(); int x0 = (int)Math.floor(r2d.getX()); int y0 = (int)Math.floor(r2d.getY()); int x1 = (int)Math.ceil(r2d.getX()+r2d.getWidth()); int y1 = (int)Math.ceil(r2d.getY()+r2d.getHeight()); // This rectangle must be outset one pixel to ensure // it includes the effects of anti-aliasing on objects. Rectangle r = new Rectangle(x0-1, y0-1, x1-x0+3, y1-y0+3); rects.add(r); } RectListManager devRLM = null; try { devRLM = new RectListManager(rects); devRLM.mergeRects(COPY_OVERHEAD, COPY_LINE_OVERHEAD); } catch(Exception e) { e.printStackTrace(); } renderer.repaint(devRLM); return devRLM; }
// in sources/org/apache/batik/util/RunnableQueue.java
public void invokeAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.push(l); list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public void preemptAndWait(Runnable r) throws InterruptedException { if (runnableQueueThread == null) { throw new IllegalStateException ("RunnableQueue not started or has exited"); } if (runnableQueueThread == Thread.currentThread()) { throw new IllegalStateException ("Cannot be called from the RunnableQueue thread"); } LockableLink l = new LockableLink(r); synchronized (list) { list.add(preemptCount, l); preemptCount++; list.notify(); } l.lock(); // todo: the 'other side' of list may retrieve the l before it is locked... }
// in sources/org/apache/batik/util/RunnableQueue.java
public synchronized void lock() throws InterruptedException { locked = true; notify(); wait(); }
34
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InterruptedException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JAuthenticator.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/StatusBar.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/apps/svgbrowser/StatusBar.java
catch(InterruptedException e) { }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { // Loop around again see if src is set now... }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (InterruptedException e) { fireEvent(cancelledDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException e) { return; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (InterruptedException e) { return; }
// in sources/org/apache/batik/util/gui/MemoryMonitor.java
catch (InterruptedException e) {}
// in sources/org/apache/batik/util/CleanerThread.java
catch (InterruptedException ie) { continue; }
// in sources/org/apache/batik/util/SoftReferenceCache.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (InterruptedException e) { // Assume they will get delivered???? // be nice to wait on List but how??? }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { // just loop again. }
// in sources/org/apache/batik/util/RunnableQueue.java
catch(InterruptedException ie) { }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (InterruptedException ie) { // Loop again... }
0 0
unknown (Lib) InterruptedIOException 0 0 0 3
            
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (InterruptedIOException e) { fireEvent(cancelledDispatcher, evt); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
2
            
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (InterruptedIOException iioe) { reference.release(); if (HaltingThread.hasBeenHalted()) throw new InterruptedBridgeException(); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (InterruptedIOException ex) { throw new InterruptedBridgeException(); }
2
unknown (Lib) InvocationTargetException 0 0 0 11
            
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
catch (InvocationTargetException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (InvocationTargetException e) { e.printStackTrace(); }
9
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
9
unknown (Lib) JavaScriptException 0 0 0 2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (JavaScriptException e) { // exception from JavaScript (possibly wrapping a Java Ex) Object value = e.getValue(); Exception ex = value instanceof Exception ? (Exception) value : e; throw new InterpreterException(ex, ex.getMessage(), -1, -1); }
2
unknown (Lib) LinkageError 0 0 0 1
            
// in sources/org/apache/batik/util/Service.java
catch (LinkageError le) { // Just try the next file... }
0 0
runtime (Domain) LiveAttributeException
public class LiveAttributeException extends RuntimeException {

    // Constants for the error code.
    public static final short ERR_ATTRIBUTE_MISSING   = 0;
    public static final short ERR_ATTRIBUTE_MALFORMED = 1;
    public static final short ERR_ATTRIBUTE_NEGATIVE  = 2;

    /**
     * The element on which the error occured.
     */
    protected Element e;

    /**
     * The attribute name.
     */
    protected String attributeName;

    /**
     * The reason for the exception.  This must be one of the ERR_* constants
     * defined in this class.
     */
    protected short code;

    /**
     * The malformed attribute value.
     */
    protected String value;

    /**
     * Constructs a new <tt>LiveAttributeException</tt> with the specified
     * parameters.
     *
     * @param e the element on which the error occured
     * @param an the attribute name
     * @param code the error code
     * @param val the malformed attribute value
     */
    public LiveAttributeException(Element e, String an, short code,
                                  String val) {
        this.e = e;
        this.attributeName = an;
        this.code = code;
        this.value = val;
    }

    /**
     * Returns the element on which the error occurred.
     */
    public Element getElement() {
        return e;
    }

    /**
     * Returns the attribute name.
     */
    public String getAttributeName() {
        return attributeName;
    }

    /**
     * Returns the error code.
     */
    public short getCode() {
        return code;
    }

    /**
     * Returns the problematic attribute value.
     */
    public String getValue() {
        return value;
    }
}
18
            
// in sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java
public float getCheckedValue() { if (hasAnimVal) { if (animVal == null) { animVal = new AnimSVGLength(direction); } if (nonNegative && animVal.value < 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE, animVal.getValueAsString()); } return animVal.getValue(); } else { if (baseVal == null) { baseVal = new BaseSVGLength(direction); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } else if (baseVal.unitType == SVGLength.SVG_LENGTHTYPE_UNKNOWN) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } if (nonNegative && baseVal.value < 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_NEGATIVE, baseVal.getValueAsString()); } return baseVal.getValue(); } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedEnumeration.java
public short getCheckedVal() { if (hasAnimVal) { return animVal; } if (!valid) { update(); } if (baseVal == 0) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, getBaseValAsString()); } return baseVal; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void endNumberList() { if (count != 4) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGLengthList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGTransformList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGPointList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public void check() { if (!hasAnimVal) { if (pathSegs == null) { pathSegs = new BaseSVGPathSegList(); } pathSegs.revalidate(); if (pathSegs.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (pathSegs.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, pathSegs.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGNumberList(); } baseVal.revalidate(); if (baseVal.missing) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MISSING, null); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
public void check() { if (!hasAnimVal) { if (baseVal == null) { baseVal = new BaseSVGPARValue(); } if (baseVal.malformed) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, baseVal.getValueAsString()); } } }
0 0 20
            
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
20
            
// in sources/org/apache/batik/bridge/SVGPolylineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPathElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGPolygonElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGTextElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGRectElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGCircleElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGUseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGEllipseElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
// in sources/org/apache/batik/bridge/SVGLineElementBridge.java
catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); }
20
unknown (Lib) MalformedURLException 0 0 3
            
// in sources/org/apache/batik/bridge/URIResolver.java
public Element getElement(String uri, Element ref) throws MalformedURLException, IOException { Node n = getNode(uri, ref); if (n == null) { return null; } else if (n.getNodeType() == Node.DOCUMENT_NODE) { throw new IllegalArgumentException(); } else { return (Element)n; } }
// in sources/org/apache/batik/bridge/URIResolver.java
public Node getNode(String uri, Element ref) throws MalformedURLException, IOException, SecurityException { String baseURI = getRefererBaseURI(ref); // System.err.println("baseURI: " + baseURI); // System.err.println("URI: " + uri); if (baseURI == null && uri.charAt(0) == '#') { return getNodeByFragment(uri.substring(1), ref); } ParsedURL purl = new ParsedURL(baseURI, uri); // System.err.println("PURL: " + purl); if (documentURI == null) documentURI = document.getURL(); String frag = purl.getRef(); if ((frag != null) && (documentURI != null)) { ParsedURL pDocURL = new ParsedURL(documentURI); // System.out.println("doc: " + pDocURL); // System.out.println("Purl: " + purl); if (pDocURL.sameFile(purl)) { // System.out.println("match"); return document.getElementById(frag); } } // uri is not a reference into this document, so load the // document it does reference after doing a security // check with the UserAgent ParsedURL pDocURL = null; if (documentURI != null) { pDocURL = new ParsedURL(documentURI); } UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); String purlStr = purl.toString(); if (frag != null) { purlStr = purlStr.substring(0, purlStr.length()-(frag.length()+1)); } Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag); return doc; }
// in sources/org/apache/batik/util/ParsedURLData.java
protected URL buildURL() throws MalformedURLException { // System.out.println("File: " + file); // if (ref != null) // file += "#" + ref; // System.err.println("Building: " + protocol + " - " + // host + " - " + path); if ((protocol != null) && (host != null)) { String file = ""; if (path != null) file = path; if (port == -1) return new URL(protocol, host, file); return new URL(protocol, host, port, file); } return new URL(toString()); }
20
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (MalformedURLException mue) { System.err.println("Can't make sense of line:\n " + line); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MalformedURLException ex) { if (userAgent != null) { userAgent.displayError(ex); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
// in sources/org/apache/batik/script/InterpreterPool.java
catch (MalformedURLException e) { }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (MalformedURLException mue) { // No sense in trying it if we can't build a URL out of it. return false; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (MalformedURLException mue) { return null; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
catch (MalformedURLException e) { return null; }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (MalformedURLException mue) { /* nothing just let docURL be null */ }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { return false; }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
// in sources/org/apache/batik/util/ParsedURLJarProtocolHandler.java
catch (MalformedURLException mue) { return super.parseURL(baseURL, urlStr); }
// in sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java
catch (MalformedURLException mue) { // Built in URL wouldn't take it... // mue.printStackTrace(); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (MalformedURLException ex) { internal.remove(key); return defaultValue; }
7
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverterFileSource.java
catch(MalformedURLException e){ throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MalformedURLException e) { throw new IOException(e.getMessage()); }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (MalformedURLException ex) { throw new BridgeException(this, e, ex, ERR_URI_MALFORMED, new Object[] {uri}); }
// in sources/org/apache/batik/util/ParsedURLData.java
catch (MalformedURLException mue) { throw new IOException ("Unable to make sense of URL for connection"); }
2
runtime (Domain) MissingListenerException
public class MissingListenerException extends RuntimeException {
    /**
     * The class name of the listener bundle requested
     * @serial
     */
    private String className;

    /**
     * The name of the specific listener requested by the user
     * @serial
     */
    private String key;

    /**
     * Constructs a MissingListenerException with the specified information.
     * A detail message is a String that describes this particular exception.
     * @param s the detail message
     * @param className the name of the listener class
     * @param key the key for the missing listener.
     */
    public MissingListenerException(String s, String className, String key) {
        super(s);
        this.className = className;
        this.key = key;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getClassName() {
        return className;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getKey() {
        return key;
    }

    /**
     * Returns a printable representation of this object
     */
    public String toString() {
        return super.toString()+" ("+getKey()+", bundle: "+getClassName()+")";
    }
}
3
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public Action getAction(String key) throws MissingListenerException { Action result = (Action)listeners.get(key); //if (result == null) { //result = canvas.getAction(key); //} if (result == null) { throw new MissingListenerException("Can't find action.", RESOURCES, key); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
0 34
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action) listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action) listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/DOMViewer.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public Action getAction(String key) throws MissingListenerException { Action result = (Action)listeners.get(key); //if (result == null) { //result = canvas.getAction(key); //} if (result == null) { throw new MissingListenerException("Can't find action.", RESOURCES, key); } return result; }
// in sources/org/apache/batik/apps/svgbrowser/FindDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/UserStyleDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/URIChooser.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/JErrorPane.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/MemoryMonitor.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
// in sources/org/apache/batik/util/gui/CSSMediaPanel.java
public Action getAction(String key) throws MissingListenerException { return (Action)listeners.get(key); }
0 0 0
unknown (Lib) MissingResourceException 4
            
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public String getString(String key) throws MissingResourceException { setUsedLocale(); for (int i=0; hasNextResourceBundle(i); i++) { ResourceBundle rb = getResourceBundle(i); if (rb == null) continue; try { String ret = rb.getString(key); if (ret != null) return ret; } catch (MissingResourceException mre) { } } String classStr = (cls != null)?cls.toString():bundleName; throw new MissingResourceException("Unable to find resource: " + key, classStr, key); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getInteger(String key) throws MissingResourceException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); } }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getCharacter(String key) throws MissingResourceException { String s = getString(key); if(s == null || s.length() == 0){ throw new MissingResourceException ("Malformed character", bundleName, key); } return s.charAt(0); }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
protected static synchronized Properties getParserProps() { if (parserProps != null) return parserProps; parserProps = new Properties(); try { Class cls = XMLResourceDescriptor.class; InputStream is = cls.getResourceAsStream(RESOURCES); parserProps.load(is); } catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); } return parserProps; }
2
            
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/util/XMLResourceDescriptor.java
catch (IOException ioe) { throw new MissingResourceException(ioe.getMessage(), RESOURCES, null); }
64
            
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/apps/svgbrowser/Resources.java
public static int getCharacter(String key) throws MissingResourceException { return resourceManager.getCharacter(key); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
public static String get(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/svggen/font/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static String getString(String key) throws MissingResourceException { return localizableSupport.getString(key); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static int getInteger(String key) throws MissingResourceException { return localizableSupport.getInteger(key); }
// in sources/org/apache/batik/script/rhino/Messages.java
public static int getCharacter(String key) throws MissingResourceException { return localizableSupport.getCharacter(key); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Messages.java
public static String getString(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/ext/swing/Resources.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/xml/XMLScanner.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/parser/AbstractParser.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/transcoder/image/resources/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/AbstractDocument.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/AbstractDOMImplementation.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { try { return super.formatMessage(key, args); } catch (MissingResourceException e) { return localizableSupport.formatMessage(key, args); } }
// in sources/org/apache/batik/swing/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/swing/svg/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public String getString(String key) throws MissingResourceException { setUsedLocale(); for (int i=0; hasNextResourceBundle(i); i++) { ResourceBundle rb = getResourceBundle(i); if (rb == null) continue; try { String ret = rb.getString(key); if (ret != null) return ret; } catch (MissingResourceException mre) { } } String classStr = (cls != null)?cls.toString():bundleName; throw new MissingResourceException("Unable to find resource: " + key, classStr, key); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getInteger(String key) throws MissingResourceException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); } }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
public int getCharacter(String key) throws MissingResourceException { String s = getString(key); if(s == null || s.length() == 0){ throw new MissingResourceException ("Malformed character", bundleName, key); } return s.charAt(0); }
// in sources/org/apache/batik/bridge/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/bridge/Messages.java
public static String getMessage(String key) throws MissingResourceException { return formatMessage(key, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/Messages.java
public static String getString(String key) throws MissingResourceException { return resourceManager.getString(key); }
// in sources/org/apache/batik/util/Messages.java
public static int getInteger(String key) throws MissingResourceException { return resourceManager.getInteger(key); }
// in sources/org/apache/batik/util/Messages.java
public static int getCharacter(String key) throws MissingResourceException { return resourceManager.getCharacter(key); }
// in sources/org/apache/batik/util/io/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/resources/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public String getString(String key) throws MissingResourceException { return bundle.getString(key); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key) throws MissingResourceException { return getStringList(key, " \t\n\r\f", false); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key, String delim) throws MissingResourceException { return getStringList(key, delim, false); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public List getStringList(String key, String delim, boolean returnDelims) throws MissingResourceException { List result = new ArrayList(); StringTokenizer st = new StringTokenizer(getString(key), delim, returnDelims); while (st.hasMoreTokens()) { result.add(st.nextToken()); } return result; }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
// in sources/org/apache/batik/css/parser/Parser.java
public String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/css/engine/value/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/css/engine/Messages.java
public static String formatMessage(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); }
32
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (MissingResourceException e) { System.out.println(e.getMessage()); System.exit(0); }
// in sources/org/apache/batik/apps/rasterizer/Messages.java
catch(MissingResourceException e){ }
// in sources/org/apache/batik/ext/awt/image/codec/util/PropertyUtil.java
catch(MissingResourceException e){ return key; }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (MissingResourceException e) { m = message; }
// in sources/org/apache/batik/parser/AbstractParser.java
catch (MissingResourceException e) { return key; }
// in sources/org/apache/batik/dom/svg/SVGOMDocument.java
catch (MissingResourceException e) { return localizableSupport.formatMessage(key, args); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (MissingResourceException mre) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { s = getString(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { l = getStringList(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException mre) { b = getBoolean(name); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { result = new JToolbarToggleButton(); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/LocationBar.java
catch (MissingResourceException e) { }
// in sources/org/apache/batik/util/gui/LanguageDialog.java
catch (MissingResourceException e) { }
1
            
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
0
unknown (Lib) NoClassDefFoundError 0 0 0 1
            
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (NoClassDefFoundError e) { // This error was reported to happen when the rendering // is interrupted with JDK1.3.0rc1 Solaris. }
0 0
unknown (Lib) NoSuchElementException 6
            
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public Object next() { if (idx >= size) throw new NoSuchElementException("No Next Element"); forward = true; removeOk = true; return rects[idx++]; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public Object previous() { if (idx <= 0) throw new NoSuchElementException("No Previous Element"); forward = false; removeOk = true; return rects[--idx]; }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object next() { try { Object next = get(cursor); checkForComodification(); lastRet = cursor++; return next; } catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); } }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public Object previous() { try { Object previous = get(--cursor); checkForComodification(); lastRet = cursor; return previous; } catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); } }
// in sources/org/apache/batik/util/DoublyIndexedTable.java
public Object next() { if (finished) { throw new NoSuchElementException(); } Entry ret = nextEntry; findNext(); return ret; }
// in sources/org/apache/batik/util/RunnableQueue.java
public Object next() { if (head == null || head == link) { throw new NoSuchElementException(); } if (link == null) { link = (Link)head.getNext(); return head.runnable; } Object result = link.runnable; link = (Link)link.getNext(); return result; }
2
            
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
catch(IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); }
0 0 0 0
unknown (Lib) NoSuchFieldException 0 0 0 1
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (NoSuchFieldException e) { e.printStackTrace(); }
0 0
unknown (Lib) NoSuchMethodException 0 0 0 1
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoSuchMethodException nsme) { }
0 0
unknown (Lib) NoninvertibleTransformException 0 0 3 41
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException nite) { /* nothing */ }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/apps/svgbrowser/ThumbnailDialog.java
catch (NoninvertibleTransformException ex) { dim = svgThumbnailCanvas.getSize(); s = new Rectangle2D.Float(0, 0, dim.width, dim.height); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/ext/awt/g2d/GraphicContext.java
catch(NoninvertibleTransformException e){ return null; }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
// in sources/org/apache/batik/ext/awt/image/rendered/AffineRed.java
catch (NoninvertibleTransformException nite) { me2src = null; }
// in sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
catch (NoninvertibleTransformException nte) { // Grow the region in usr space. r = aoi.getBounds2D(); r = new Rectangle2D.Double(r.getX()-outsetX/scaleX, r.getY()-outsetY/scaleY, r.getWidth() +2*outsetX/scaleX, r.getHeight()+2*outsetY/scaleY); }
// in sources/org/apache/batik/ext/awt/image/renderable/AffineRable8Bit.java
catch (NoninvertibleTransformException e) { invAffine = null; }
// in sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable8Bit.java
catch(NoninvertibleTransformException e){ }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { handleException(e); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { // Degenerate case return null; r2d = null; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { // Degenerate case return null; r2d = null; }
// in sources/org/apache/batik/gvt/filter/BackgroundRable8Bit.java
catch (NoninvertibleTransformException nte) { ret = null; }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (NoninvertibleTransformException ex) { }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException ex) {}
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGSVGElementBridge.java
catch (NoninvertibleTransformException e) { }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (java.awt.geom.NoninvertibleTransformException ex) {}
14
            
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/ext/awt/g2d/AbstractGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/ext/awt/RadialGradientPaint.java
catch(NoninvertibleTransformException e){ throw new IllegalArgumentException("transform should be " + "invertible"); }
// in sources/org/apache/batik/ext/awt/LinearGradientPaint.java
catch(NoninvertibleTransformException e) { e.printStackTrace(); throw new IllegalArgumentException("transform should be" + "invertible"); }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
// in sources/org/apache/batik/dom/svg/SVGLocatableSupport.java
catch (NoninvertibleTransformException ex) { throw currentElt.createSVGException (SVGException.SVG_MATRIX_NOT_INVERTABLE, "noninvertiblematrix", null); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (NoninvertibleTransformException e) { throw new IllegalStateException( "NoninvertibleTransformEx:" + e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/CanvasGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
// in sources/org/apache/batik/gvt/AbstractGraphicsNode.java
catch(NoninvertibleTransformException e){ // Should never happen. throw new Error( e.getMessage() ); }
12
runtime (Lib) NullPointerException 8
            
// in sources/org/apache/batik/svggen/SVGCustomComposite.java
public SVGCompositeDescriptor toSVG(Composite composite) { if (composite == null) throw new NullPointerException(); SVGCompositeDescriptor compositeDesc = (SVGCompositeDescriptor)descMap.get(composite); if (compositeDesc == null) { // First time this composite is used. Request handler // to do the convertion SVGCompositeDescriptor desc = generatorContext. extensionHandler.handleComposite(composite, generatorContext); if (desc != null) { Element def = desc.getDef(); if(def != null) defSet.add(def); descMap.put(composite, desc); } } return compositeDesc; }
// in sources/org/apache/batik/ext/awt/image/rendered/MorphologyOp.java
public BufferedImage filter(BufferedImage src, BufferedImage dest){ if (src == null) throw new NullPointerException("Source image should not be null"); BufferedImage origSrc = src; BufferedImage finalDest = dest; if (!isCompatible(src.getColorModel(), src.getSampleModel())) { src = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE); GraphicsUtil.copyData(origSrc, src); } else if (!src.isAlphaPremultiplied()) { // Get a Premultipled CM. ColorModel srcCM, srcCMPre; srcCM = src.getColorModel(); srcCMPre = GraphicsUtil.coerceColorModel(srcCM, true); src = new BufferedImage(srcCMPre, src.getRaster(), true, null); GraphicsUtil.copyData(origSrc, src); } if (dest == null) { dest = createCompatibleDestImage(src, null); finalDest = dest; } else if (!isCompatible(dest.getColorModel(), dest.getSampleModel())) { dest = createCompatibleDestImage(src, null); } else if (!dest.isAlphaPremultiplied()) { // Get a Premultipled CM. ColorModel dstCM, dstCMPre; dstCM = dest.getColorModel(); dstCMPre = GraphicsUtil.coerceColorModel(dstCM, true); dest = new BufferedImage(dstCMPre, finalDest.getRaster(), true, null); } filter(src.getRaster(), dest.getRaster()); // Check to see if we need to 'fix' our source (divide out alpha). if ((src.getRaster() == origSrc.getRaster()) && (src.isAlphaPremultiplied() != origSrc.isAlphaPremultiplied())) { // Copy our source back the way it was... GraphicsUtil.copyData(src, origSrc); } // Check to see if we need to store our result... if ((dest.getRaster() != finalDest.getRaster()) || (dest.isAlphaPremultiplied() != finalDest.isAlphaPremultiplied())){ // Coerce our source back the way it was requested... GraphicsUtil.copyData(dest, finalDest); } return finalDest; }
// in sources/org/apache/batik/ext/awt/image/codec/util/MemoryCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // End-of-stream if (pos <= pointer) { return -1; } byte[] buf = (byte[])data.get((int)(pointer >> SECTOR_SHIFT)); int nbytes = Math.min(len, SECTOR_SIZE - (int)(pointer & SECTOR_MASK)); System.arraycopy(buf, (int)(pointer & SECTOR_MASK), b, off, nbytes); pointer += nbytes; return nbytes; }
// in sources/org/apache/batik/ext/awt/image/codec/util/FileCacheSeekableStream.java
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if ((off < 0) || (len < 0) || (off + len > b.length)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } long pos = readUntil(pointer + len); // len will always fit into an int so this is safe len = (int)Math.min(len, pos - pointer); if (len > 0) { cache.seek(pointer); cache.readFully(b, off, len); pointer += len; return len; } else { return -1; } }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public URL getPolicyURL() { ClassLoader cl = appMainClass.getClassLoader(); URL policyURL = cl.getResource(securityPolicy); if (policyURL == null) { throw new NullPointerException (Messages.formatMessage(EXCEPTION_NO_POLICY_FILE, new Object[]{securityPolicy})); } return policyURL; }
0 0 0 0 0
unknown (Lib) NumberFormatException 0 0 0 85
            
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse frame time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse transition time: " + args[i+1]); }
// in sources/org/apache/batik/apps/slideshow/Main.java
catch (NumberFormatException nfe) { System.err.println ("Can't parse window size: " + args[i+1]); }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (NumberFormatException e) { f = 0.85f; }
// in sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
catch (NumberFormatException e) { f = 15f; }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ // If an error occured, the x, y, w, h // values will not be valid }
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ // If an error occured, the a, r, g, b // values will not be in the 0-255 range // and the next if test will fail }
// in sources/org/apache/batik/script/ImportInfo.java
catch (NumberFormatException nfe) { }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
catch (NumberFormatException nfe) { }
// in sources/org/apache/batik/ext/swing/DoubleDocument.java
catch(NumberFormatException e){ // Ignore insertion, as it results in an out of range value }
// in sources/org/apache/batik/parser/NumberListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/LengthPairListParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/parser/AngleParser.java
catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(NumberFormatException e){ handleValueError(property, str); }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
catch(NumberFormatException nfe) { /* nothing */ }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/gvt/font/UnicodeRange.java
catch (NumberFormatException e) { firstUnicodeValue = -1; lastUnicodeValue = -1; }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (NumberFormatException nfe){ }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
// in sources/org/apache/batik/util/ParsedURLDefaultProtocolHandler.java
catch (NumberFormatException nfe) { // bad port leave as '-1' }
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException e) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { internal.remove(key); return defaultValue; }
// in sources/org/apache/batik/util/PreferenceManager.java
catch (NumberFormatException ex) { setFloat(key, defaultValue); return defaultValue; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
52
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(NumberFormatException e){ throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (NumberFormatException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_COUNT_ATTRIBUTE }); }
// in sources/org/apache/batik/extension/svg/BatikStarElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikRegularPolygonElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {BATIK_EXT_TRIM_ATTRIBUTE, s}); }
// in sources/org/apache/batik/extension/svg/BatikHistogramNormalizationElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (NumberFormatException e) { throw new MissingResourceException ("Malformed integer", bundleName, key); }
// in sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TABLE_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr }); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, underlineThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughPosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, strikethroughThicknessStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlinePosStr}); }
// in sources/org/apache/batik/bridge/SVGFontFaceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, overlineThicknessStr}); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VIEW_BOX_ATTRIBUTE, value, nfEx }); }
// in sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGGradientElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, stopElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_OFFSET_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_ORDER_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_MATRIX_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_DIVISOR_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_X_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TARGET_Y_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_KERNEL_UNIT_LENGTH_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (NumberFormatException e) { throw new BridgeException (ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_START_OFFSET_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); }
// in sources/org/apache/batik/bridge/AbstractSVGFilterPrimitiveElementBridge.java
catch (NumberFormatException nfEx) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s, nfEx}); }
// in sources/org/apache/batik/bridge/SVGMarkerElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, markerElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_ORIENT_ATTRIBUTE, s}); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString }); }
// in sources/org/apache/batik/bridge/SVGAnimateElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString }); }
// in sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/TextUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, element, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {attrName, valueStr}); }
// in sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_STD_DEVIATION_ATTRIBUTE, s, nfEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, elem, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, attrValue, nfEx }); }
// in sources/org/apache/batik/bridge/SVGFeTurbulenceElementBridge.java
catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s}); }
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (NumberFormatException e) { throw createCSSParseException("number.format"); }
48
runtime (Domain) ParseException
public class ParseException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;
    
    /**
     * @serial The line number.
     */
    protected int lineNumber;

    /**
     * @serial The column number.
     */
    protected int columnNumber;

    /**
     * Creates a new ParseException.
     * @param message The error or warning message.
     * @param line The line of the last parsed character.
     * @param column The column of the last parsed character.
     */
    public ParseException (String message, int line, int column) {
        super(message);
        exception = null;
        lineNumber = line;
        columnNumber = column;
    }
    
    /**
     * Creates a new ParseException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the ParseException.
     * @param e The exception to be wrapped in a ParseException.
     */
    public ParseException (Exception e) {
        exception = e;
        lineNumber = -1;
        columnNumber = -1;
    }
    
    /**
     * Creates a new ParseException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public ParseException (String message, Exception e) {
        super(message);
        this.exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the ParseException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Returns the line of the last parsed character.
     */
    public int getLineNumber() {
        return lineNumber;
    }

    /**
     * Returns the column of the last parsed character.
     */
    public int getColumnNumber() {
        return columnNumber;
    }
}public class ParseException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;
    
    /**
     * @serial The line number.
     */
    protected int lineNumber;

    /**
     * @serial The column number.
     */
    protected int columnNumber;

    /**
     * Creates a new ParseException.
     * @param message The error or warning message.
     * @param line The line of the last parsed character.
     * @param column The column of the last parsed character.
     */
    public ParseException (String message, int line, int column) {
        super(message);
        exception = null;
        lineNumber = line;
        columnNumber = column;
    }
    
    /**
     * Creates a new ParseException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the ParseException.
     * @param e The exception to be wrapped in a ParseException.
     */
    public ParseException (Exception e) {
        exception = e;
        lineNumber = -1;
        columnNumber = -1;
    }
    
    /**
     * Creates a new ParseException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public ParseException (String message, Exception e) {
        super(message);
        this.exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the ParseException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Returns the line of the last parsed character.
     */
    public int getLineNumber() {
        return lineNumber;
    }

    /**
     * Returns the column of the last parsed character.
     */
    public int getColumnNumber() {
        return columnNumber;
    }
}
40
            
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = EOF; return; case ':': nextChar(); type = COLON; return; case '[': nextChar(); type = LEFT_SQUARE_BRACKET; return; case ']': nextChar(); type = RIGHT_SQUARE_BRACKET; return; case '(': nextChar(); type = LEFT_PARENTHESIS; return; case ')': nextChar(); type = RIGHT_PARENTHESIS; return; case '*': nextChar(); type = ASTERISK; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (XMLUtilities.isXMLSpace((char) current)); nextToken(); return; case '\'': type = string1(); return; case '"': type = string2(); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; default: if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { do { nextChar(); } while (current != -1 && current != ':' && XMLUtilities.isXMLNameCharacter((char) current)); type = NAME; return; } nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string1() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int string2() throws IOException { start = position; loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '"': break loop; } } nextChar(); return STRING; }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return NUMBER; }
// in sources/org/apache/batik/css/parser/Scanner.java
public void scanAtRule() throws ParseException { try { // waiting for EOF, ';' or '{' loop: for (;;) { switch (current) { case '{': int brackets = 1; for (;;) { nextChar(); switch (current) { case '}': if (--brackets > 0) { break; } case -1: break loop; case '{': brackets++; } } case -1: case ';': break loop; } nextChar(); } end = position; } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = LexicalUnits.EOF; return; case '{': nextChar(); type = LexicalUnits.LEFT_CURLY_BRACE; return; case '}': nextChar(); type = LexicalUnits.RIGHT_CURLY_BRACE; return; case '=': nextChar(); type = LexicalUnits.EQUAL; return; case '+': nextChar(); type = LexicalUnits.PLUS; return; case ',': nextChar(); type = LexicalUnits.COMMA; return; case ';': nextChar(); type = LexicalUnits.SEMI_COLON; return; case '>': nextChar(); type = LexicalUnits.PRECEDE; return; case '[': nextChar(); type = LexicalUnits.LEFT_BRACKET; return; case ']': nextChar(); type = LexicalUnits.RIGHT_BRACKET; return; case '*': nextChar(); type = LexicalUnits.ANY; return; case '(': nextChar(); type = LexicalUnits.LEFT_BRACE; return; case ')': nextChar(); type = LexicalUnits.RIGHT_BRACE; return; case ':': nextChar(); type = LexicalUnits.COLON; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (ScannerUtilities.isCSSSpace((char)current)); type = LexicalUnits.SPACE; return; case '/': nextChar(); if (current != '*') { type = LexicalUnits.DIVIDE; return; } // Comment nextChar(); start = position - 1; do { while (current != -1 && current != '*') { nextChar(); } do { nextChar(); } while (current != -1 && current == '*'); } while (current != -1 && current != '/'); if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.COMMENT; return; case '\'': // String1 type = string1(); return; case '"': // String2 type = string2(); return; case '<': nextChar(); if (current != '!') { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (current == '-') { nextChar(); if (current == '-') { nextChar(); type = LexicalUnits.CDO; return; } } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '-': nextChar(); if (current != '-') { type = LexicalUnits.MINUS; return; } nextChar(); if (current == '>') { nextChar(); type = LexicalUnits.CDC; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '|': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.DASHMATCH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '~': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.INCLUDES; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '#': nextChar(); if (ScannerUtilities.isCSSNameCharacter((char)current)) { start = position - 1; do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); type = LexicalUnits.HASH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '@': nextChar(); switch (current) { case 'c': case 'C': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'h') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 's') && isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.CHARSET_SYMBOL; return; } break; case 'f': case 'F': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), '-') && isEqualIgnoreCase(nextChar(), 'f') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'c') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.FONT_FACE_SYMBOL; return; } break; case 'i': case 'I': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORT_SYMBOL; return; } break; case 'm': case 'M': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 'd') && isEqualIgnoreCase(nextChar(), 'i') && isEqualIgnoreCase(nextChar(), 'a')) { nextChar(); type = LexicalUnits.MEDIA_SYMBOL; return; } break; case 'p': case 'P': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'g') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.PAGE_SYMBOL; return; } break; default: if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } start = position - 1; } do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); type = LexicalUnits.AT_KEYWORD; return; case '!': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace((char)current)); if (isEqualIgnoreCase(current, 'i') && isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORTANT_SYMBOL; return; } if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } else { throw new ParseException("character", reader.getLine(), reader.getColumn()); } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = dotNumber(); return; default: type = LexicalUnits.DOT; return; } case 'u': case 'U': nextChar(); switch (current) { case '+': boolean range = false; for (int i = 0; i < 6; i++) { nextChar(); switch (current) { case '?': range = true; break; default: if (range && !ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); if (range) { type = LexicalUnits.UNICODE_RANGE; return; } if (current == '-') { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); type = LexicalUnits.UNICODE_RANGE; return; } case 'r': case 'R': nextChar(); switch (current) { case 'l': case 'L': nextChar(); switch (current) { case '(': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)); switch (current) { case '\'': string1(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case '"': string2(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case ')': throw new ParseException("character", reader.getLine(), reader.getColumn()); default: if (!ScannerUtilities.isCSSURICharacter ((char)current)) { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } start = position - 1; do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSURICharacter ((char)current)); blankCharacters++; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; } } } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; default: if (current == '\\') { do { nextChar(); escape(); } while(current == '\\'); } else if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } // Identifier while ((current != -1) && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); while (current == '\\') { nextChar(); escape(); } } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string1() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break loop; case '"': break; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int string2() throws IOException { start = position; // fix bug #29416 loop: for (;;) { switch (nextChar()) { case -1: throw new ParseException("eof", reader.getLine(), reader.getColumn()); case '\'': break; case '"': break loop; case '\\': switch (nextChar()) { case '\n': case '\f': break; default: escape(); } break; default: if (!ScannerUtilities.isCSSStringCharacter((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected int number() throws IOException { loop: for (;;) { switch (nextChar()) { case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return dotNumber(); } throw new ParseException("character", reader.getLine(), reader.getColumn()); default: break loop; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } return numberUnit(true); }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void escape() throws IOException { if (ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter((char)current)) { if (ScannerUtilities.isCSSSpace((char)current)) { nextChar(); } return; } } if ((current >= ' ' && current <= '~') || current >= 128) { nextChar(); return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); }
9
            
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/parser/AbstractScanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
// in sources/org/apache/batik/css/parser/Scanner.java
catch (IOException e) { throw new ParseException(e); }
419
            
// in sources/org/apache/batik/anim/timing/TimedElement.java
protected float parseClockValue(String s, boolean parseOffset) throws ParseException { ClockParser p = new ClockParser(parseOffset); class Handler implements ClockHandler { protected float v = 0; public void clockValue(float newClockValue) { v = newClockValue; } } Handler h = new Handler(); p.setClockHandler(h); p.parse(s); return h.v; }
// in sources/org/apache/batik/parser/PointsParser.java
protected void doParse() throws ParseException, IOException { pointsHandler.startPoints(); current = reader.read(); skipSpaces(); loop: for (;;) { if (current == -1) { break loop; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pointsHandler.point(x, y); skipCommaSpaces(); } pointsHandler.endPoints(); }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void startNumberList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void endNumberList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void startNumber() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void numberValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultNumberListHandler.java
public void endNumber() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultErrorHandler.java
public void error(ParseException e) throws ParseException { throw e; }
// in sources/org/apache/batik/parser/TimingSpecifierListParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); ((TimingSpecifierListHandler) timingSpecifierHandler) .startTimingSpecifierList(); skipSpaces(); if (current != -1) { for (;;) { Object[] spec = parseTimingSpecifier(); handleTimingSpecifier(spec); skipSpaces(); if (current == -1) { break; } if (current == ';') { current = reader.read(); continue; } reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportUnexpectedCharacterError( current ); } ((TimingSpecifierListHandler) timingSpecifierHandler) .endTimingSpecifierList(); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void startPath() throws ParseException { cs = new LinkedList(); c = new short[11]; ps = new LinkedList(); p = new float[11]; ccount = 0; pcount = 0; cindex = 0; pindex = 0; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void movetoRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_MOVETO_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void movetoAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_MOVETO_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void closePath() throws ParseException { command(SVGPathSeg.PATHSEG_CLOSEPATH); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoHorizontalRel(float x) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL); param(x); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoHorizontalAbs(float x) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS); param(x); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoVerticalRel(float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void linetoVerticalAbs(float y) throws ParseException { command(SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL); param(x1); param(y1); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS); param(x1); param(y1); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS); param(x2); param(y2); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL); param(x1); param(y1); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS); param(x1); param(y1); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_ARC_REL); param(rx); param(ry); param(xAxisRotation); param(largeArcFlag ? 1 : 0); param(sweepFlag ? 1 : 0); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { command(SVGPathSeg.PATHSEG_ARC_ABS); param(rx); param(ry); param(xAxisRotation); param(largeArcFlag ? 1 : 0); param(sweepFlag ? 1 : 0); param(x); param(y); }
// in sources/org/apache/batik/parser/PathArrayProducer.java
protected void command(short val) throws ParseException { if (cindex == c.length) { cs.add(c); c = new short[c.length * 2 + 1]; cindex = 0; } c[cindex++] = val; ccount++; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
protected void param(float val) throws ParseException { if (pindex == p.length) { ps.add(p); p = new float[p.length * 2 + 1]; pindex = 0; } p[pindex++] = val; pcount++; }
// in sources/org/apache/batik/parser/PathArrayProducer.java
public void endPath() throws ParseException { short[] allCommands = new short[ccount]; int pos = 0; Iterator it = cs.iterator(); while (it.hasNext()) { short[] a = (short[]) it.next(); System.arraycopy(a, 0, allCommands, pos, a.length); pos += a.length; } System.arraycopy(c, 0, allCommands, pos, cindex); cs.clear(); c = allCommands; float[] allParams = new float[pcount]; pos = 0; it = ps.iterator(); while (it.hasNext()) { float[] a = (float[]) it.next(); System.arraycopy(a, 0, allParams, pos, a.length); pos += a.length; } System.arraycopy(p, 0, allParams, pos, pindex); ps.clear(); p = allParams; }
// in sources/org/apache/batik/parser/NumberListParser.java
protected void doParse() throws ParseException, IOException { numberListHandler.startNumberList(); current = reader.read(); skipSpaces(); try { for (;;) { numberListHandler.startNumber(); float f = parseFloat(); numberListHandler.numberValue(f); numberListHandler.endNumber(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } numberListHandler.endNumberList(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PathParser p = new PathParser(); AWTPathProducer ph = new AWTPathProducer(); ph.setWindingRule(wr); p.setPathHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void startPath() throws ParseException { currentX = 0; currentY = 0; xCenter = 0; yCenter = 0; path = new ExtendedGeneralPath(windingRule); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void endPath() throws ParseException { }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void movetoRel(float x, float y) throws ParseException { path.moveTo(xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void movetoAbs(float x, float y) throws ParseException { path.moveTo(xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void closePath() throws ParseException { path.closePath(); Point2D pt = path.getCurrentPoint(); currentX = (float)pt.getX(); currentY = (float)pt.getY(); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoRel(float x, float y) throws ParseException { path.lineTo(xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoAbs(float x, float y) throws ParseException { path.lineTo(xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoHorizontalRel(float x) throws ParseException { path.lineTo(xCenter = currentX += x, yCenter = currentY); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoHorizontalAbs(float x) throws ParseException { path.lineTo(xCenter = currentX = x, yCenter = currentY); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoVerticalRel(float y) throws ParseException { path.lineTo(xCenter = currentX, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void linetoVerticalAbs(float y) throws ParseException { path.lineTo(xCenter = currentX, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX + x1, currentY + y1, xCenter = currentX + x2, yCenter = currentY + y2, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { path.curveTo(x1, y1, xCenter = x2, yCenter = y2, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX * 2 - xCenter, currentY * 2 - yCenter, xCenter = currentX + x2, yCenter = currentY + y2, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { path.curveTo(currentX * 2 - xCenter, currentY * 2 - yCenter, xCenter = x2, yCenter = y2, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { path.quadTo(xCenter = currentX + x1, yCenter = currentY + y1, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { path.quadTo(xCenter = x1, yCenter = y1, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { path.quadTo(xCenter = currentX * 2 - xCenter, yCenter = currentY * 2 - yCenter, currentX += x, currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { path.quadTo(xCenter = currentX * 2 - xCenter, yCenter = currentY * 2 - yCenter, currentX = x, currentY = y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { path.arcTo(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, xCenter = currentX += x, yCenter = currentY += y); }
// in sources/org/apache/batik/parser/AWTPathProducer.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { path.arcTo(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, xCenter = currentX = x, yCenter = currentY = y); }
// in sources/org/apache/batik/parser/LengthListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler)lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); if (current == -1) { break; } } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler)lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(Reader r) throws ParseException { try { reader = new StreamNormalizingReader(r); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(InputStream is, String enc) throws ParseException { try { reader = new StreamNormalizingReader(is, enc); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
public void parse(String s) throws ParseException { try { reader = new StringNormalizingReader(s); doParse(); } catch (IOException e) { errorHandler.error (new ParseException (createErrorMessage("io.exception", null), e)); } }
// in sources/org/apache/batik/parser/AbstractParser.java
protected void reportError(String key, Object[] args) throws ParseException { errorHandler.error(new ParseException(createErrorMessage(key, args), reader.getLine(), reader.getColumn())); }
// in sources/org/apache/batik/parser/NumberParser.java
protected float parseFloat() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; switch (current) { case '-': mantPos = false; // fallthrough case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return 0.0f; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; case '.': case 'e': case 'E': break m1; default: return 0.0f; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return 0.0f; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: if (!mantRead) { return 0.0f; } break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } switch (current) { case 'e': case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return 0f; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } return buildFloat(mant, exp); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } lengthHandler.endLength(); }
// in sources/org/apache/batik/parser/LengthParser.java
protected void parseLength() throws ParseException, IOException { int mant = 0; int mantDig = 0; boolean mantPos = true; boolean mantRead = false; int exp = 0; int expDig = 0; int expAdj = 0; boolean expPos = true; int unitState = 0; switch (current) { case '-': mantPos = false; case '+': current = reader.read(); } m1: switch (current) { default: reportUnexpectedCharacterError( current ); return; case '.': break; case '0': mantRead = true; l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m1; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mantRead = true; l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); } else { expAdj++; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } if (current == '.') { current = reader.read(); m2: switch (current) { default: case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; } break; case '0': if (mantDig == 0) { l: for (;;) { current = reader.read(); expAdj--; switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break m2; case '0': } } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (mantDig < 9) { mantDig++; mant = mant * 10 + (current - '0'); expAdj--; } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } } boolean le = false; es: switch (current) { case 'e': le = true; case 'E': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 1; break es; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; } unitState = 2; break es; case '-': expPos = false; case '+': current = reader.read(); switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } en: switch (current) { case '0': l: for (;;) { current = reader.read(); switch (current) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break l; default: break en; case '0': } } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': l: for (;;) { if (expDig < 3) { expDig++; exp = exp * 10 + (current - '0'); } current = reader.read(); switch (current) { default: break l; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': } } } default: } if (!expPos) { exp = -exp; } exp += expAdj; if (!mantPos) { mant = -mant; } lengthHandler.lengthValue(NumberParser.buildFloat(mant, exp)); switch (unitState) { case 1: lengthHandler.em(); current = reader.read(); return; case 2: lengthHandler.ex(); current = reader.read(); return; } switch (current) { case 'e': current = reader.read(); switch (current) { case 'm': lengthHandler.em(); current = reader.read(); break; case 'x': lengthHandler.ex(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'p': current = reader.read(); switch (current) { case 'c': lengthHandler.pc(); current = reader.read(); break; case 't': lengthHandler.pt(); current = reader.read(); break; case 'x': lengthHandler.px(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } break; case 'i': current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break; } lengthHandler.in(); current = reader.read(); break; case 'c': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.cm(); current = reader.read(); break; case 'm': current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm',current ); break; } lengthHandler.mm(); current = reader.read(); break; case '%': lengthHandler.percentage(); current = reader.read(); break; } }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void startPath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void endPath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void movetoRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void movetoAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void closePath() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoHorizontalRel(float x) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoHorizontalAbs(float x) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoVerticalRel(float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void linetoVerticalAbs(float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPathHandler.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void doParse() throws ParseException, IOException { bufferSize = 0; current = reader.read(); fragmentIdentifierHandler.startFragmentIdentifier(); ident: { String id = null; switch (current) { case 'x': bufferize(); current = reader.read(); if (current != 'p') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'o') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'n') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 't') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'r') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break ident; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break ident; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break ident; } current = reader.read(); if (current != '"' && current != '\'') { reportCharacterExpectedError( '\'', current ); break ident; } char q = (char)current; current = reader.read(); parseIdentifier(); id = getBufferContent(); bufferSize = 0; fragmentIdentifierHandler.idReference(id); if (current != q) { reportCharacterExpectedError( q, current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); break ident; } current = reader.read(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; case 's': bufferize(); current = reader.read(); if (current != 'v') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'g') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'V') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'i') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'e') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != 'w') { parseIdentifier(); break; } bufferize(); current = reader.read(); if (current != '(') { parseIdentifier(); break; } bufferSize = 0; current = reader.read(); parseViewAttributes(); if (current != ')') { reportCharacterExpectedError( ')', current ); } break ident; default: if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { break ident; } bufferize(); current = reader.read(); parseIdentifier(); } id = getBufferContent(); fragmentIdentifierHandler.idReference(id); } fragmentIdentifierHandler.endFragmentIdentifier(); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseViewAttributes() throws ParseException, IOException { boolean first = true; loop: for (;;) { switch (current) { case -1: case ')': if (first) { reportUnexpectedCharacterError( current ); break loop; } // fallthrough default: break loop; case ';': if (first) { reportUnexpectedCharacterError( current ); break loop; } current = reader.read(); break; case 'v': first = false; current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); break loop; } current = reader.read(); switch (current) { case 'B': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); float x = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float y = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float w = parseFloat(); if (current != ',') { reportCharacterExpectedError( ',', current ); break loop; } current = reader.read(); float h = parseFloat(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.viewBox(x, y, w, h); if (current != ')' && current != ';') { reportCharacterExpectedError( ')', current ); break loop; } break; case 'T': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.startViewTarget(); id: for (;;) { bufferSize = 0; if (current == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)current)) { reportUnexpectedCharacterError( current ); break loop; } bufferize(); current = reader.read(); parseIdentifier(); String s = getBufferContent(); fragmentIdentifierHandler.viewTarget(s); bufferSize = 0; switch (current) { case ')': current = reader.read(); break id; case ',': case ';': current = reader.read(); break; default: reportUnexpectedCharacterError( current ); break loop; } } fragmentIdentifierHandler.endViewTarget(); break; default: reportUnexpectedCharacterError( current ); break loop; } break; case 'p': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'v') { reportCharacterExpectedError( 'v', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'p') { reportCharacterExpectedError( 'p', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'R') { reportCharacterExpectedError( 'R', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); parsePreserveAspectRatio(); if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); break; case 't': first = false; current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } fragmentIdentifierHandler.startTransformList(); tloop: for (;;) { try { current = reader.read(); switch (current) { case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; default: break tloop; } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } fragmentIdentifierHandler.endTransformList(); break; case 'z': first = false; current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); break loop; } current = reader.read(); if (current != 'm') { reportCharacterExpectedError( 'm', current ); break loop; } current = reader.read(); if (current != 'A') { reportCharacterExpectedError( 'A', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError( 'd', current ); break loop; } current = reader.read(); if (current != 'P') { reportCharacterExpectedError( 'P', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != '(') { reportCharacterExpectedError( '(', current ); break loop; } current = reader.read(); switch (current) { case 'm': current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError( 'g', current ); break loop; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); break loop; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 'f') { reportCharacterExpectedError( 'f', current ); break loop; } current = reader.read(); if (current != 'y') { reportCharacterExpectedError( 'y', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(true); break; case 'd': current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); break loop; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); break loop; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); break loop; } current = reader.read(); if (current != 'b') { reportCharacterExpectedError( 'b', current ); break loop; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); break loop; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); break loop; } current = reader.read(); fragmentIdentifierHandler.zoomAndPan(false); break; default: reportUnexpectedCharacterError( current ); break loop; } if (current != ')') { reportCharacterExpectedError( ')', current ); break loop; } current = reader.read(); } } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseIdentifier() throws ParseException, IOException { for (;;) { if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { break; } bufferize(); current = reader.read(); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError( 's', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': fragmentIdentifierHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError( 'w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall-through case 'Y': break; default: reportCharacterExpectedError( 'X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } if (skewX) { fragmentIdentifierHandler.skewX(sk); } else { fragmentIdentifierHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { fragmentIdentifierHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'n', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); fragmentIdentifierHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMaxYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMidYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y', current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M', current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipIdentifier(); break align; } fragmentIdentifierHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': fragmentIdentifierHandler.xMinYMid(); current = reader.read(); break; case 'n': fragmentIdentifierHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipIdentifier(); break; } fragmentIdentifierHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c', current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e', current ); skipIdentifier(); break; } fragmentIdentifierHandler.slice(); current = reader.read(); } fragmentIdentifierHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void idReference(String s) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void viewBox(float x, float y, float width, float height) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startViewTarget() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void viewTarget(String name) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endViewTarget() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void startTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void rotate(float theta) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void rotate(float theta, float cx, float cy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void translate(float tx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void translate(float tx, float ty) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void scale(float sx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void scale(float sx, float sy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void skewX(float skx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void skewY(float sky) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultFragmentIdentifierHandler.java
public void endFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void startNumberList() throws ParseException { as = new LinkedList(); a = new float[11]; count = 0; index = 0; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void numberValue(float v) throws ParseException { if (index == a.length) { as.add(a); a = new float[a.length * 2 + 1]; index = 0; } a[index++] = v; count++; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void endNumberList() throws ParseException { float[] all = new float[count]; int pos = 0; Iterator it = as.iterator(); while (it.hasNext()) { float[] b = (float[]) it.next(); System.arraycopy(b, 0, all, pos, b.length); pos += b.length; } System.arraycopy(a, 0, all, pos, index); as.clear(); a = all; }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void startPoints() throws ParseException { startNumberList(); }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void point(float x, float y) throws ParseException { numberValue(x); numberValue(y); }
// in sources/org/apache/batik/parser/FloatArrayProducer.java
public void endPoints() throws ParseException { endNumberList(); }
// in sources/org/apache/batik/parser/LengthPairListParser.java
protected void doParse() throws ParseException, IOException { ((LengthListHandler) lengthHandler).startLengthList(); current = reader.read(); skipSpaces(); try { for (;;) { lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipCommaSpaces(); lengthHandler.startLength(); parseLength(); lengthHandler.endLength(); skipSpaces(); if (current == -1) { break; } if (current != ';') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } ((LengthListHandler) lengthHandler).endLengthList(); }
// in sources/org/apache/batik/parser/ClockParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); float clockValue = parseOffset ? parseOffset() : parseClockValue(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } if (clockHandler != null) { clockHandler.clockValue(clockValue); } }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void startTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void rotate(float theta) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void rotate(float theta, float cx, float cy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void translate(float tx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void translate(float tx, float ty) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void scale(float sx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void scale(float sx, float sy) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void skewX(float skx) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void skewY(float sky) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultTransformListHandler.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void startLengthList() throws ParseException { us = new LinkedList(); u = new short[11]; vs = new LinkedList(); v = new float[11]; count = 0; index = 0; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void numberValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void lengthValue(float val) throws ParseException { if (index == v.length) { vs.add(v); v = new float[v.length * 2 + 1]; us.add(u); u = new short[u.length * 2 + 1]; index = 0; } v[index] = val; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void startLength() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_NUMBER; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void endLength() throws ParseException { u[index++] = currentUnit; count++; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void em() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void ex() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void in() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void cm() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void mm() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void pc() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void pt() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void px() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void percentage() throws ParseException { currentUnit = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/parser/LengthArrayProducer.java
public void endLengthList() throws ParseException { float[] allValues = new float[count]; int pos = 0; Iterator it = vs.iterator(); while (it.hasNext()) { float[] a = (float[]) it.next(); System.arraycopy(a, 0, allValues, pos, a.length); pos += a.length; } System.arraycopy(v, 0, allValues, pos, index); vs.clear(); v = allValues; short[] allUnits = new short[count]; pos = 0; it = us.iterator(); while (it.hasNext()) { short[] a = (short[]) it.next(); System.arraycopy(a, 0, allUnits, pos, a.length); pos += a.length; } System.arraycopy(u, 0, allUnits, pos, index); us.clear(); u = allUnits; }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void startLength() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void lengthValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void em() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void ex() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void in() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void cm() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void mm() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void pc() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void pt() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void px() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void percentage() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthHandler.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); skipSpaces(); parsePreserveAspectRatio(); }
// in sources/org/apache/batik/parser/PreserveAspectRatioParser.java
protected void parsePreserveAspectRatio() throws ParseException, IOException { preserveAspectRatioHandler.startPreserveAspectRatio(); align: switch (current) { case 'n': current = reader.read(); if (current != 'o') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError( 'o',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break align; } current = reader.read(); skipSpaces(); preserveAspectRatioHandler.none(); break; case 'x': current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMaxYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMaxYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMaxYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'i': current = reader.read(); switch (current) { case 'd': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMidYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMidYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMidYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; case 'n': current = reader.read(); if (current != 'Y') { reportCharacterExpectedError( 'Y',current ); skipIdentifier(); break align; } current = reader.read(); if (current != 'M') { reportCharacterExpectedError( 'M',current ); skipIdentifier(); break align; } current = reader.read(); switch (current) { case 'a': current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x',current ); skipIdentifier(); break align; } preserveAspectRatioHandler.xMinYMax(); current = reader.read(); break; case 'i': current = reader.read(); switch (current) { case 'd': preserveAspectRatioHandler.xMinYMid(); current = reader.read(); break; case 'n': preserveAspectRatioHandler.xMinYMin(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); break align; } break; default: reportUnexpectedCharacterError( current ); skipIdentifier(); } break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipCommaSpaces(); switch (current) { case 'm': current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't',current ); skipIdentifier(); break; } preserveAspectRatioHandler.meet(); current = reader.read(); break; case 's': current = reader.read(); if (current != 'l') { reportCharacterExpectedError( 'l',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'c') { reportCharacterExpectedError( 'c',current ); skipIdentifier(); break; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError( 'e',current ); skipIdentifier(); break; } preserveAspectRatioHandler.slice(); current = reader.read(); break; default: if (current != -1) { reportUnexpectedCharacterError( current ); skipIdentifier(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } preserveAspectRatioHandler.endPreserveAspectRatio(); }
// in sources/org/apache/batik/parser/AngleParser.java
protected void doParse() throws ParseException, IOException { angleHandler.startAngle(); current = reader.read(); skipSpaces(); try { float f = parseFloat(); angleHandler.angleValue(f); s: if (current != -1) { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: break s; } switch (current) { case 'd': current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); break; } current = reader.read(); if (current != 'g') { reportCharacterExpectedError('g', current ); break; } angleHandler.deg(); current = reader.read(); break; case 'g': current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); break; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.grad(); current = reader.read(); break; case 'r': current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); break; } current = reader.read(); if (current != 'd') { reportCharacterExpectedError('d', current ); break; } angleHandler.rad(); current = reader.read(); break; default: reportUnexpectedCharacterError( current ); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } } catch (NumberFormatException e) { reportUnexpectedCharacterError( current ); } angleHandler.endAngle(); }
// in sources/org/apache/batik/parser/AbstractScanner.java
public int next() throws ParseException { blankCharacters = 0; start = position - 1; previousType = type; nextToken(); end = position - endGap(); return type; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToObjectBoundingBox(ur.value, ur.unit, d, ctx); }
// in sources/org/apache/batik/parser/UnitProcessor.java
public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void startLength() throws ParseException { }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void lengthValue(float v) throws ParseException { this.value = v; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void em() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void ex() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void in() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void cm() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void mm() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void pc() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void pt() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void px() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void percentage() throws ParseException { this.unit = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/parser/UnitProcessor.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void startAngle() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void angleValue(float v) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void deg() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void grad() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void rad() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultAngleHandler.java
public void endAngle() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void startPoints() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void point(float x, float y) throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPointsHandler.java
public void endPoints() throws ParseException { }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseTimingSpecifier() throws ParseException, IOException { skipSpaces(); boolean escaped = false; if (current == '\\') { escaped = true; current = reader.read(); } Object[] ret = null; if (current == '+' || (current == '-' && !escaped) || (current >= '0' && current <= '9')) { float offset = parseOffset(); ret = new Object[] { new Integer(TIME_OFFSET), new Float(offset) }; } else if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { ret = parseIDValue(escaped); } else { reportUnexpectedCharacterError( current ); } return ret; }
// in sources/org/apache/batik/parser/TimingParser.java
protected String parseName() throws ParseException, IOException { StringBuffer sb = new StringBuffer(); boolean midEscaped = false; do { sb.append((char) current); current = reader.read(); midEscaped = false; if (current == '\\') { midEscaped = true; current = reader.read(); } } while (XMLUtilities.isXMLNameCharacter((char) current) && (midEscaped || (current != '-' && current != '.'))); return sb.toString(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected Object[] parseIDValue(boolean escaped) throws ParseException, IOException { String id = parseName(); if ((id.equals("accessKey") && useSVG11AccessKeys || id.equals("accesskey")) && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); if (current == -1) { reportError("end.of.stream", new Object[0]); } char key = (char) current; current = reader.read(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY), new Float(offset), new Character(key) }; } else if (id.equals("accessKey") && useSVG12AccessKeys && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); StringBuffer keyName = new StringBuffer(); while (current >= 'A' && current <= 'Z' || current >= 'a' && current <= 'z' || current >= '0' && current <= '9' || current == '+') { keyName.append((char) current); current = reader.read(); } if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_ACCESSKEY_SVG12), new Float(offset), keyName.toString() }; } else if (id.equals("wallclock") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } current = reader.read(); skipSpaces(); Calendar wallclockValue = parseWallclockValue(); skipSpaces(); if (current != ')') { reportError("character.unexpected", new Object[] { new Integer(current) }); } current = reader.read(); return new Object[] { new Integer(TIME_WALLCLOCK), wallclockValue }; } else if (id.equals("indefinite") && !escaped) { return new Object[] { new Integer(TIME_INDEFINITE) }; } else { if (current == '.') { current = reader.read(); if (current == '\\') { escaped = true; current = reader.read(); } if (!XMLUtilities.isXMLNameFirstCharacter((char) current)) { reportUnexpectedCharacterError( current ); } String id2 = parseName(); if ((id2.equals("begin") || id2.equals("end")) && !escaped) { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_SYNCBASE), new Float(offset), id, id2 }; } else if (id2.equals("repeat") && !escaped) { Integer repeatIteration = null; if (current == '(') { current = reader.read(); repeatIteration = new Integer(parseDigits()); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); } skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_REPEAT), new Float(offset), id, repeatIteration }; } else if (id2.equals("marker") && !escaped) { if (current != '(') { reportUnexpectedCharacterError( current ); } String markerName = parseName(); if (current != ')') { reportUnexpectedCharacterError( current ); } current = reader.read(); return new Object[] { new Integer(TIME_MEDIA_MARKER), id, markerName }; } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), id, id2 }; } } else { skipSpaces(); float offset = 0; if (current == '+' || current == '-') { offset = parseOffset(); } return new Object[] { new Integer(TIME_EVENTBASE), new Float(offset), null, id }; } } }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseClockValue() throws ParseException, IOException { int d1 = parseDigits(); float offset; if (current == ':') { current = reader.read(); int d2 = parseDigits(); if (current == ':') { current = reader.read(); int d3 = parseDigits(); offset = d1 * 3600 + d2 * 60 + d3; } else { offset = d1 * 60 + d2; } if (current == '.') { current = reader.read(); offset += parseFraction(); } } else if (current == '.') { current = reader.read(); offset = (parseFraction() + d1) * parseUnit(); } else { offset = d1 * parseUnit(); } return offset; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseOffset() throws ParseException, IOException { boolean offsetNegative = false; if (current == '-') { offsetNegative = true; current = reader.read(); skipSpaces(); } else if (current == '+') { current = reader.read(); skipSpaces(); } if (offsetNegative) { return -parseClockValue(); } return parseClockValue(); }
// in sources/org/apache/batik/parser/TimingParser.java
protected int parseDigits() throws ParseException, IOException { int value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } do { value = value * 10 + (current - '0'); current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseFraction() throws ParseException, IOException { float value = 0; if (current < '0' || current > '9') { reportUnexpectedCharacterError( current ); } float weight = 0.1f; do { value += weight * (current - '0'); weight *= 0.1f; current = reader.read(); } while (current >= '0' && current <= '9'); return value; }
// in sources/org/apache/batik/parser/TimingParser.java
protected float parseUnit() throws ParseException, IOException { if (current == 'h') { current = reader.read(); return 3600; } else if (current == 'm') { current = reader.read(); if (current == 'i') { current = reader.read(); if (current != 'n') { reportUnexpectedCharacterError( current ); } current = reader.read(); return 60; } else if (current == 's') { current = reader.read(); return 0.001f; } else { reportUnexpectedCharacterError( current ); } } else if (current == 's') { current = reader.read(); } return 1; }
// in sources/org/apache/batik/parser/TimingParser.java
protected Calendar parseWallclockValue() throws ParseException, IOException { int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0, tzh = 0, tzm = 0; float frac = 0; boolean dateSpecified = false; boolean timeSpecified = false; boolean tzSpecified = false; boolean tzNegative = false; String tzn = null; int digits1 = parseDigits(); do { if (current == '-') { dateSpecified = true; y = digits1; current = reader.read(); M = parseDigits(); if (current != '-') { reportUnexpectedCharacterError( current ); } current = reader.read(); d = parseDigits(); if (current != 'T') { break; } current = reader.read(); digits1 = parseDigits(); if (current != ':') { reportUnexpectedCharacterError( current ); } } if (current == ':') { timeSpecified = true; h = digits1; current = reader.read(); m = parseDigits(); if (current == ':') { current = reader.read(); s = parseDigits(); if (current == '.') { current = reader.read(); frac = parseFraction(); } } if (current == 'Z') { tzSpecified = true; tzn = "UTC"; current = reader.read(); } else if (current == '+' || current == '-') { StringBuffer tznb = new StringBuffer(); tzSpecified = true; if (current == '-') { tzNegative = true; tznb.append('-'); } else { tznb.append('+'); } current = reader.read(); tzh = parseDigits(); if (tzh < 10) { tznb.append('0'); } tznb.append(tzh); if (current != ':') { reportUnexpectedCharacterError( current ); } tznb.append(':'); current = reader.read(); tzm = parseDigits(); if (tzm < 10) { tznb.append('0'); } tznb.append(tzm); tzn = tznb.toString(); } } } while (false); if (!dateSpecified && !timeSpecified) { reportUnexpectedCharacterError( current ); } Calendar wallclockTime; if (tzSpecified) { int offset = (tzNegative ? -1 : 1) * (tzh * 3600000 + tzm * 60000); wallclockTime = Calendar.getInstance(new SimpleTimeZone(offset, tzn)); } else { wallclockTime = Calendar.getInstance(); } if (dateSpecified && timeSpecified) { wallclockTime.set(y, M, d, h, m, s); } else if (dateSpecified) { wallclockTime.set(y, M, d, 0, 0, 0); } else { wallclockTime.set(Calendar.HOUR, h); wallclockTime.set(Calendar.MINUTE, m); wallclockTime.set(Calendar.SECOND, s); } if (frac == 0.0f) { wallclockTime.set(Calendar.MILLISECOND, (int) (frac * 1000)); } else { wallclockTime.set(Calendar.MILLISECOND, 0); } return wallclockTime; }
// in sources/org/apache/batik/parser/DefaultLengthListHandler.java
public void startLengthList() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultLengthListHandler.java
public void endLengthList() throws ParseException { }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public static AffineTransform createAffineTransform(Reader r) throws ParseException { TransformListParser p = new TransformListParser(); AWTTransformProducer th = new AWTTransformProducer(); p.setTransformListHandler(th); p.parse(r); return th.getAffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public static AffineTransform createAffineTransform(String s) throws ParseException { TransformListParser p = new TransformListParser(); AWTTransformProducer th = new AWTTransformProducer(); p.setTransformListHandler(th); p.parse(s); return th.getAffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void startTransformList() throws ParseException { affineTransform = new AffineTransform(); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { affineTransform.concatenate(new AffineTransform(a, b, c, d, e, f)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void rotate(float theta) throws ParseException { affineTransform.concatenate (AffineTransform.getRotateInstance( Math.toRadians( theta ) )); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void rotate(float theta, float cx, float cy) throws ParseException { AffineTransform at = AffineTransform.getRotateInstance( Math.toRadians( theta ), cx, cy); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void translate(float tx) throws ParseException { AffineTransform at = AffineTransform.getTranslateInstance(tx, 0); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void translate(float tx, float ty) throws ParseException { AffineTransform at = AffineTransform.getTranslateInstance(tx, ty); affineTransform.concatenate(at); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void scale(float sx) throws ParseException { affineTransform.concatenate(AffineTransform.getScaleInstance(sx, sx)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void scale(float sx, float sy) throws ParseException { affineTransform.concatenate(AffineTransform.getScaleInstance(sx, sy)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void skewX(float skx) throws ParseException { affineTransform.concatenate (AffineTransform.getShearInstance(Math.tan( Math.toRadians( skx ) ), 0)); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void skewY(float sky) throws ParseException { affineTransform.concatenate (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) ))); }
// in sources/org/apache/batik/parser/AWTTransformProducer.java
public void endTransformList() throws ParseException { }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolygonProducer ph = new AWTPolygonProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolygonProducer.java
public void endPoints() throws ParseException { path.closePath(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public static Shape createShape(Reader r, int wr) throws IOException, ParseException { PointsParser p = new PointsParser(); AWTPolylineProducer ph = new AWTPolylineProducer(); ph.setWindingRule(wr); p.setPointsHandler(ph); p.parse(r); return ph.getShape(); }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void startPoints() throws ParseException { path = new GeneralPath(windingRule); newPath = true; }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void point(float x, float y) throws ParseException { if (newPath) { newPath = false; path.moveTo(x, y); } else { path.lineTo(x, y); } }
// in sources/org/apache/batik/parser/AWTPolylineProducer.java
public void endPoints() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void startPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void none() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMaxYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMidYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMax() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMid() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void xMinYMin() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void meet() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void slice() throws ParseException { }
// in sources/org/apache/batik/parser/DefaultPreserveAspectRatioHandler.java
public void endPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/parser/PathParser.java
protected void doParse() throws ParseException, IOException { pathHandler.startPath(); current = reader.read(); loop: for (;;) { try { switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: current = reader.read(); break; case 'z': case 'Z': current = reader.read(); pathHandler.closePath(); break; case 'm': parsem(); break; case 'M': parseM(); break; case 'l': parsel(); break; case 'L': parseL(); break; case 'h': parseh(); break; case 'H': parseH(); break; case 'v': parsev(); break; case 'V': parseV(); break; case 'c': parsec(); break; case 'C': parseC(); break; case 'q': parseq(); break; case 'Q': parseQ(); break; case 's': parses(); break; case 'S': parseS(); break; case 't': parset(); break; case 'T': parseT(); break; case 'a': parsea(); break; case 'A': parseA(); break; case -1: break loop; default: reportUnexpected(current); break; } } catch (ParseException e) { errorHandler.error(e); skipSubPath(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } pathHandler.endPath(); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsem() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoRel(x, y); boolean expectNumber = skipCommaSpaces2(); _parsel(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseM() throws ParseException, IOException { current = reader.read(); skipSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.movetoAbs(x, y); boolean expectNumber = skipCommaSpaces2(); _parseL(expectNumber); }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsel() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parsel(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parsel(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseL() throws ParseException, IOException { current = reader.read(); skipSpaces(); _parseL(true); }
// in sources/org/apache/batik/parser/PathParser.java
protected void _parseL(boolean expectNumber) throws ParseException, IOException { for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.linetoAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseh() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseH() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoHorizontalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsev() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalRel(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseV() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); pathHandler.linetoVerticalAbs(x); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsec() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicRel(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseC() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicAbs(x1, y1, x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseq() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticRel(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseQ() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x1 = parseFloat(); skipCommaSpaces(); float y1 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticAbs(x1, y1, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parses() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothRel(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseS() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x2 = parseFloat(); skipCommaSpaces(); float y2 = parseFloat(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoCubicSmoothAbs(x2, y2, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parset() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothRel(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseT() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.curvetoQuadraticSmoothAbs(x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parsea() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcRel(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void parseA() throws ParseException, IOException { current = reader.read(); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportUnexpected(current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } float rx = parseFloat(); skipCommaSpaces(); float ry = parseFloat(); skipCommaSpaces(); float ax = parseFloat(); skipCommaSpaces(); boolean laf; switch (current) { default: reportUnexpected(current); return; case '0': laf = false; break; case '1': laf = true; break; } current = reader.read(); skipCommaSpaces(); boolean sf; switch (current) { default: reportUnexpected(current); return; case '0': sf = false; break; case '1': sf = true; break; } current = reader.read(); skipCommaSpaces(); float x = parseFloat(); skipCommaSpaces(); float y = parseFloat(); pathHandler.arcAbs(rx, ry, ax, laf, sf, x, y); expectNumber = skipCommaSpaces2(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void skipSubPath() throws ParseException, IOException { for (;;) { switch (current) { case -1: case 'm': case 'M': return; default: break; } current = reader.read(); } }
// in sources/org/apache/batik/parser/PathParser.java
protected void reportUnexpected(int ch) throws ParseException, IOException { reportUnexpectedCharacterError( current ); skipSubPath(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void doParse() throws ParseException, IOException { transformListHandler.startTransformList(); loop: for (;;) { try { current = reader.read(); switch (current) { case 0xD: case 0xA: case 0x20: case 0x9: case ',': break; case 'm': parseMatrix(); break; case 'r': parseRotate(); break; case 't': parseTranslate(); break; case 's': current = reader.read(); switch (current) { case 'c': parseScale(); break; case 'k': parseSkew(); break; default: reportUnexpectedCharacterError( current ); skipTransform(); } break; case -1: break loop; default: reportUnexpectedCharacterError( current ); skipTransform(); } } catch (ParseException e) { errorHandler.error(e); skipTransform(); } } skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } transformListHandler.endTransformList(); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError('i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError('x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.matrix(a, b, c, d, e, f); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseRotate() throws ParseException, IOException { current = reader.read(); // Parse 'otate wsp? ( wsp?' if (current != 'o') { reportCharacterExpectedError('o', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float theta = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.rotate(theta); return; case ',': current = reader.read(); skipSpaces(); } float cx = parseFloat(); skipCommaSpaces(); float cy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.rotate(theta, cx, cy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseTranslate() throws ParseException, IOException { current = reader.read(); // Parse 'ranslate wsp? ( wsp?' if (current != 'r') { reportCharacterExpectedError('r', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'n') { reportCharacterExpectedError('n', current ); skipTransform(); return; } current = reader.read(); if (current != 's') { reportCharacterExpectedError('s', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError('t', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float tx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.translate(tx); return; case ',': current = reader.read(); skipSpaces(); } float ty = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.translate(tx, ty); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseScale() throws ParseException, IOException { current = reader.read(); // Parse 'ale wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError('a', current ); skipTransform(); return; } current = reader.read(); if (current != 'l') { reportCharacterExpectedError('l', current ); skipTransform(); return; } current = reader.read(); if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sx = parseFloat(); skipSpaces(); switch (current) { case ')': transformListHandler.scale(sx); return; case ',': current = reader.read(); skipSpaces(); } float sy = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } transformListHandler.scale(sx, sy); }
// in sources/org/apache/batik/parser/TransformListParser.java
protected void parseSkew() throws ParseException, IOException { current = reader.read(); // Parse 'ew[XY] wsp? ( wsp?' if (current != 'e') { reportCharacterExpectedError('e', current ); skipTransform(); return; } current = reader.read(); if (current != 'w') { reportCharacterExpectedError('w', current ); skipTransform(); return; } current = reader.read(); boolean skewX = false; switch (current) { case 'X': skewX = true; // fall through case 'Y': break; default: reportCharacterExpectedError('X', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError('(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float sk = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError(')', current ); skipTransform(); return; } if (skewX) { transformListHandler.skewX(sk); } else { transformListHandler.skewY(sk); } }
// in sources/org/apache/batik/parser/TimingSpecifierParser.java
protected void doParse() throws ParseException, IOException { current = reader.read(); Object[] spec = parseTimingSpecifier(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } handleTimingSpecifier(spec); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ NumberListParser NumberListParser = new NumberListParser(); NumberListBuilder builder = new NumberListBuilder(handler); NumberListParser.setNumberListHandler(builder); NumberListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void startNumberList() throws ParseException{ listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void startNumber() throws ParseException { currentValue = 0.0f; }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void numberValue(float v) throws ParseException { currentValue = v; }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void endNumber() throws ParseException { listHandler.item(new SVGNumberItem(currentValue)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNumberList.java
public void endNumberList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
protected void parse(String s) { try { AngleParser angleParser = new AngleParser(); angleParser.setAngleHandler(new DefaultAngleHandler() { public void angleValue(float v) throws ParseException { value = v; } public void deg() throws ParseException { unitType = SVG_ANGLETYPE_DEG; } public void rad() throws ParseException { unitType = SVG_ANGLETYPE_RAD; } public void grad() throws ParseException { unitType = SVG_ANGLETYPE_GRAD; } }); unitType = SVG_ANGLETYPE_UNSPECIFIED; angleParser.parse(s); } catch (ParseException e) { unitType = SVG_ANGLETYPE_UNKNOWN; value = 0; } }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void angleValue(float v) throws ParseException { value = v; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void deg() throws ParseException { unitType = SVG_ANGLETYPE_DEG; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void rad() throws ParseException { unitType = SVG_ANGLETYPE_RAD; }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
public void grad() throws ParseException { unitType = SVG_ANGLETYPE_GRAD; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void meet() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
public void slice() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
protected void revalidate() { if (valid) { return; } Attr attr = element.getAttributeNodeNS(namespaceURI, localName); final String s = attr == null ? defaultValue : attr.getValue(); final float[] numbers = new float[4]; NumberListParser p = new NumberListParser(); p.setNumberListHandler(new DefaultNumberListHandler() { protected int count; public void endNumberList() { if (count != 4) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } } public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; } }); p.parse(s); x = numbers[0]; y = numbers[1]; w = numbers[2]; h = numbers[3]; valid = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedRect.java
public void numberValue(float v) throws ParseException { if (count < 4) { numbers[count] = v; } if (v < 0 && (count == 2 || count == 3)) { throw new LiveAttributeException (element, localName, LiveAttributeException.ERR_ATTRIBUTE_MALFORMED, s); } count++; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ PathParser pathParser = new PathParser(); PathSegListBuilder builder = new PathSegListBuilder(handler); pathParser.setPathHandler(builder); pathParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void startPath() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void endPath() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void movetoRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_REL,PATHSEG_MOVETO_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void movetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_ABS,PATHSEG_MOVETO_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void closePath() throws ParseException { listHandler.item(new SVGPathSegItem (SVGPathSeg.PATHSEG_CLOSEPATH,PATHSEG_CLOSEPATH_LETTER)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_REL,PATHSEG_LINETO_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_ABS,PATHSEG_LINETO_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoHorizontalRel(float x) throws ParseException { listHandler.item(new SVGPathSegLinetoHorizontalItem (SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL,PATHSEG_LINETO_HORIZONTAL_REL_LETTER, x)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoHorizontalAbs(float x) throws ParseException { listHandler.item(new SVGPathSegLinetoHorizontalItem (SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS,PATHSEG_LINETO_HORIZONTAL_ABS_LETTER, x)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoVerticalRel(float y) throws ParseException { listHandler.item(new SVGPathSegLinetoVerticalItem (SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL,PATHSEG_LINETO_VERTICAL_REL_LETTER, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void linetoVerticalAbs(float y) throws ParseException { listHandler.item(new SVGPathSegLinetoVerticalItem (SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS,PATHSEG_LINETO_VERTICAL_ABS_LETTER, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,PATHSEG_CURVETO_CUBIC_REL_LETTER, x1,y1,x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,PATHSEG_CURVETO_CUBIC_ABS_LETTER, x1,y1,x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicSmoothItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,PATHSEG_CURVETO_CUBIC_SMOOTH_REL_LETTER, x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicSmoothItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,PATHSEG_CURVETO_CUBIC_SMOOTH_ABS_LETTER, x2,y2,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL,PATHSEG_CURVETO_QUADRATIC_REL_LETTER, x1,y1,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS,PATHSEG_CURVETO_QUADRATIC_ABS_LETTER, x1,y1,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticSmoothItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoQuadraticSmoothItem (SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS_LETTER, x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { listHandler.item(new SVGPathSegArcItem (SVGPathSeg.PATHSEG_ARC_REL,PATHSEG_ARC_REL_LETTER, rx,ry,xAxisRotation,largeArcFlag,sweepFlag,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPathSegList.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { listHandler.item(new SVGPathSegArcItem (SVGPathSeg.PATHSEG_ARC_ABS,PATHSEG_ARC_ABS_LETTER, rx,ry,xAxisRotation,largeArcFlag,sweepFlag,x,y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
protected void doParse(String value, ListHandler handler) throws ParseException { PointsParser pointsParser = new PointsParser(); PointsListBuilder builder = new PointsListBuilder(handler); pointsParser.setPointsHandler(builder); pointsParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void startPoints() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void point(float x, float y) throws ParseException { listHandler.item(new SVGPointItem(x, y)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPointList.java
public void endPoints() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
protected void doParse(String value, ListHandler handler) throws ParseException { TransformListParser transformListParser = new TransformListParser(); TransformListBuilder builder = new TransformListBuilder(handler); transformListParser.setTransformListHandler(builder); transformListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void startTransformList() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void matrix(float a, float b, float c, float d, float e, float f) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.matrix(a, b, c, d, e, f); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void rotate(float theta) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.rotate(theta); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void rotate(float theta, float cx, float cy) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setRotate(theta, cx, cy); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void translate(float tx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.translate(tx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void translate(float tx, float ty) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setTranslate(tx, ty); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void scale(float sx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.scale(sx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void scale(float sx, float sy) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setScale(sx, sy); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void skewX(float skx) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setSkewX(skx); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void skewY(float sky) throws ParseException { SVGTransformItem item = new SVGTransformItem(); item.setSkewY(sky); listHandler.item(item); }
// in sources/org/apache/batik/dom/svg/AbstractSVGTransformList.java
public void endTransformList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
protected void doParse(String value, ListHandler handler) throws ParseException { PathParser pathParser = new PathParser(); NormalizedPathSegListBuilder builder = new NormalizedPathSegListBuilder(handler); pathParser.setPathHandler(builder); pathParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void startPath() throws ParseException { listHandler.startList(); lastAbs = new SVGPathSegGenericItem(SVGPathSeg.PATHSEG_MOVETO_ABS, PATHSEG_MOVETO_ABS_LETTER, 0,0,0,0,0,0); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void endPath() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void movetoRel(float x, float y) throws ParseException { movetoAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void movetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_MOVETO_ABS,PATHSEG_MOVETO_ABS_LETTER, x,y)); lastAbs.setX(x); lastAbs.setY(y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_MOVETO_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void closePath() throws ParseException { listHandler.item(new SVGPathSegItem (SVGPathSeg.PATHSEG_CLOSEPATH,PATHSEG_CLOSEPATH_LETTER)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoRel(float x, float y) throws ParseException { linetoAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoAbs(float x, float y) throws ParseException { listHandler.item(new SVGPathSegMovetoLinetoItem (SVGPathSeg.PATHSEG_LINETO_ABS,PATHSEG_LINETO_ABS_LETTER, x,y)); lastAbs.setX(x); lastAbs.setY(y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_LINETO_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoHorizontalRel(float x) throws ParseException { linetoAbs(lastAbs.getX() + x, lastAbs.getY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoHorizontalAbs(float x) throws ParseException { linetoAbs(x, lastAbs.getY()); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoVerticalRel(float y) throws ParseException { linetoAbs(lastAbs.getX(), lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void linetoVerticalAbs(float y) throws ParseException { linetoAbs(lastAbs.getX(), y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { curvetoCubicAbs(lastAbs.getX() +x1, lastAbs.getY() + y1, lastAbs.getX() +x2, lastAbs.getY() + y2, lastAbs.getX() +x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException { listHandler.item(new SVGPathSegCurvetoCubicItem (SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,PATHSEG_CURVETO_CUBIC_ABS_LETTER, x1,y1,x2,y2,x,y)); lastAbs.setValue(x1,y1,x2,y2,x,y); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicSmoothRel(float x2, float y2, float x, float y) throws ParseException { curvetoCubicSmoothAbs(lastAbs.getX() + x2, lastAbs.getY() + y2, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoCubicSmoothAbs(float x2, float y2, float x, float y) throws ParseException { if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) { curvetoCubicAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX2()), lastAbs.getY() + (lastAbs.getY() - lastAbs.getY2()), x2, y2, x, y); } else { curvetoCubicAbs(lastAbs.getX(), lastAbs.getY(), x2, y2, x, y); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticRel(float x1, float y1, float x, float y) throws ParseException { curvetoQuadraticAbs(lastAbs.getX() + x1, lastAbs.getY() + y1, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticAbs(float x1, float y1, float x, float y) throws ParseException { curvetoCubicAbs(lastAbs.getX() + 2 * (x1 - lastAbs.getX()) / 3, lastAbs.getY() + 2 * (y1 - lastAbs.getY()) / 3, x + 2 * (x1 - x) / 3, y + 2 * (y1 - y) / 3, x, y); lastAbs.setX1(x1); lastAbs.setY1(y1); lastAbs.setPathSegType(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticSmoothRel(float x, float y) throws ParseException { curvetoQuadraticSmoothAbs(lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void curvetoQuadraticSmoothAbs(float x, float y) throws ParseException { if (lastAbs.getPathSegType()==SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS) { curvetoQuadraticAbs(lastAbs.getX() + (lastAbs.getX() - lastAbs.getX1()), lastAbs.getY() + (lastAbs.getY() - lastAbs.getY1()), x, y); } else { curvetoQuadraticAbs(lastAbs.getX(), lastAbs.getY(), x, y); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { arcAbs(rx,ry,xAxisRotation, largeArcFlag, sweepFlag, lastAbs.getX() + x, lastAbs.getY() + y); }
// in sources/org/apache/batik/dom/svg/AbstractSVGNormPathSegList.java
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException { // Ensure radii are valid if (rx == 0 || ry == 0) { linetoAbs(x, y); return; } // Get the current (x, y) coordinates of the path double x0 = lastAbs.getX(); double y0 = lastAbs.getY(); if (x0 == x && y0 == y) { // If the endpoints (x, y) and (x0, y0) are identical, then this // is equivalent to omitting the elliptical arc segment entirely. return; } Arc2D arc = ExtendedGeneralPath.computeArc(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y); if (arc == null) return; AffineTransform t = AffineTransform.getRotateInstance (Math.toRadians(xAxisRotation), arc.getCenterX(), arc.getCenterY()); Shape s = t.createTransformedShape(arc); PathIterator pi = s.getPathIterator(new AffineTransform()); float[] d = {0,0,0,0,0,0}; int i = -1; while (!pi.isDone()) { i = pi.currentSegment(d); switch (i) { case PathIterator.SEG_CUBICTO: curvetoCubicAbs(d[0],d[1],d[2],d[3],d[4],d[5]); break; } pi.next(); } lastAbs.setPathSegType(SVGPathSeg.PATHSEG_ARC_ABS); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
protected void doParse(String value, ListHandler handler) throws ParseException{ LengthListParser lengthListParser = new LengthListParser(); LengthListBuilder builder = new LengthListBuilder(handler); lengthListParser.setLengthListHandler(builder); lengthListParser.parse(value); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void startLengthList() throws ParseException { listHandler.startList(); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void startLength() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_NUMBER; currentValue = 0.0f; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void lengthValue(float v) throws ParseException { currentValue = v; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void em() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void ex() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void in() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void cm() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void mm() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void pc() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void pt() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void px() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void percentage() throws ParseException { currentType = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void endLength() throws ParseException { listHandler.item (new SVGLengthItem(currentType,currentValue,direction)); }
// in sources/org/apache/batik/dom/svg/AbstractSVGLengthList.java
public void endLengthList() throws ParseException { listHandler.endList(); }
// in sources/org/apache/batik/bridge/svg12/XPathSubsetContentSelector.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = EOF; return; case ':': nextChar(); type = COLON; return; case '[': nextChar(); type = LEFT_SQUARE_BRACKET; return; case ']': nextChar(); type = RIGHT_SQUARE_BRACKET; return; case '(': nextChar(); type = LEFT_PARENTHESIS; return; case ')': nextChar(); type = RIGHT_PARENTHESIS; return; case '*': nextChar(); type = ASTERISK; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (XMLUtilities.isXMLSpace((char) current)); nextToken(); return; case '\'': type = string1(); return; case '"': type = string2(); return; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; default: if (XMLUtilities.isXMLNameFirstCharacter((char) current)) { do { nextChar(); } while (current != -1 && current != ':' && XMLUtilities.isXMLNameCharacter((char) current)); type = NAME; return; } nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endTransformList() throws ParseException { super.endTransformList(); hasTransform = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void idReference(String s) throws ParseException { id = s; hasId = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void viewBox(float x, float y, float width, float height) throws ParseException { hasViewBox = true; viewBox = new float[4]; viewBox[0] = x; viewBox[1] = y; viewBox[2] = width; viewBox[3] = height; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startViewTarget() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void viewTarget(String name) throws ParseException { viewTargetParams = name; hasViewTargetParams = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endViewTarget() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endFragmentIdentifier() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void startPreserveAspectRatio() throws ParseException { }
// in sources/org/apache/batik/bridge/ViewBox.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void meet() throws ParseException { meet = true; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void slice() throws ParseException { meet = false; }
// in sources/org/apache/batik/bridge/ViewBox.java
public void endPreserveAspectRatio() throws ParseException { hasPreserveAspectRatio = true; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
protected AbstractAnimation createAnimation(AnimationTarget target) { animationType = AnimationEngine.ANIM_TYPE_OTHER; attributeLocalName = "motion"; AnimatableValue from = parseLengthPair(SVG_FROM_ATTRIBUTE); AnimatableValue to = parseLengthPair(SVG_TO_ATTRIBUTE); AnimatableValue by = parseLengthPair(SVG_BY_ATTRIBUTE); boolean rotateAuto = false, rotateAutoReverse = false; float rotateAngle = 0; short rotateAngleUnit = SVGAngle.SVG_ANGLETYPE_UNKNOWN; String rotateString = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); if (rotateString.length() != 0) { if (rotateString.equals("auto")) { rotateAuto = true; } else if (rotateString.equals("auto-reverse")) { rotateAuto = true; rotateAutoReverse = true; } else { class Handler implements AngleHandler { float theAngle; short theUnit = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED; public void startAngle() throws ParseException { } public void angleValue(float v) throws ParseException { theAngle = v; } public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; } public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; } public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; } public void endAngle() throws ParseException { } } AngleParser ap = new AngleParser(); Handler h = new Handler(); ap.setAngleHandler(h); try { ap.parse(rotateString); } catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); } rotateAngle = h.theAngle; rotateAngleUnit = h.theUnit; } } return new MotionAnimation(timedElement, this, parseCalcMode(), parseKeyTimes(), parseKeySplines(), parseAdditive(), parseAccumulate(), parseValues(), from, to, by, parsePath(), parseKeyPoints(), rotateAuto, rotateAutoReverse, rotateAngle, rotateAngleUnit); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void startAngle() throws ParseException { }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void angleValue(float v) throws ParseException { theAngle = v; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void deg() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_DEG; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void grad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_GRAD; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void rad() throws ParseException { theUnit = SVGAngle.SVG_ANGLETYPE_RAD; }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
public void endAngle() throws ParseException { }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void startPreserveAspectRatio() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_UNKNOWN; meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void none() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMaxYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMidYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMax() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMid() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void xMinYMin() throws ParseException { align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void meet() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void slice() throws ParseException { meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void startLength() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_NUMBER; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void lengthValue(float v) throws ParseException { value = v; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void em() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_EMS; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void ex() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_EXS; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void in() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_IN; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void cm() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_CM; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void mm() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_MM; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void pc() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PC; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void pt() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PT; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void px() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PX; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void percentage() throws ParseException { type = SVGLength.SVG_LENGTHTYPE_PERCENTAGE; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
public void endLength() throws ParseException { }
// in sources/org/apache/batik/css/parser/Scanner.java
public void scanAtRule() throws ParseException { try { // waiting for EOF, ';' or '{' loop: for (;;) { switch (current) { case '{': int brackets = 1; for (;;) { nextChar(); switch (current) { case '}': if (--brackets > 0) { break; } case -1: break loop; case '{': brackets++; } } case -1: case ';': break loop; } nextChar(); } end = position; } catch (IOException e) { throw new ParseException(e); } }
// in sources/org/apache/batik/css/parser/Scanner.java
public int next() throws ParseException { blankCharacters = 0; start = position - 1; nextToken(); end = position - endGap(); return type; }
// in sources/org/apache/batik/css/parser/Scanner.java
protected void nextToken() throws ParseException { try { switch (current) { case -1: type = LexicalUnits.EOF; return; case '{': nextChar(); type = LexicalUnits.LEFT_CURLY_BRACE; return; case '}': nextChar(); type = LexicalUnits.RIGHT_CURLY_BRACE; return; case '=': nextChar(); type = LexicalUnits.EQUAL; return; case '+': nextChar(); type = LexicalUnits.PLUS; return; case ',': nextChar(); type = LexicalUnits.COMMA; return; case ';': nextChar(); type = LexicalUnits.SEMI_COLON; return; case '>': nextChar(); type = LexicalUnits.PRECEDE; return; case '[': nextChar(); type = LexicalUnits.LEFT_BRACKET; return; case ']': nextChar(); type = LexicalUnits.RIGHT_BRACKET; return; case '*': nextChar(); type = LexicalUnits.ANY; return; case '(': nextChar(); type = LexicalUnits.LEFT_BRACE; return; case ')': nextChar(); type = LexicalUnits.RIGHT_BRACE; return; case ':': nextChar(); type = LexicalUnits.COLON; return; case ' ': case '\t': case '\r': case '\n': case '\f': do { nextChar(); } while (ScannerUtilities.isCSSSpace((char)current)); type = LexicalUnits.SPACE; return; case '/': nextChar(); if (current != '*') { type = LexicalUnits.DIVIDE; return; } // Comment nextChar(); start = position - 1; do { while (current != -1 && current != '*') { nextChar(); } do { nextChar(); } while (current != -1 && current == '*'); } while (current != -1 && current != '/'); if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.COMMENT; return; case '\'': // String1 type = string1(); return; case '"': // String2 type = string2(); return; case '<': nextChar(); if (current != '!') { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (current == '-') { nextChar(); if (current == '-') { nextChar(); type = LexicalUnits.CDO; return; } } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '-': nextChar(); if (current != '-') { type = LexicalUnits.MINUS; return; } nextChar(); if (current == '>') { nextChar(); type = LexicalUnits.CDC; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '|': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.DASHMATCH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '~': nextChar(); if (current == '=') { nextChar(); type = LexicalUnits.INCLUDES; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '#': nextChar(); if (ScannerUtilities.isCSSNameCharacter((char)current)) { start = position - 1; do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter ((char)current)); type = LexicalUnits.HASH; return; } throw new ParseException("character", reader.getLine(), reader.getColumn()); case '@': nextChar(); switch (current) { case 'c': case 'C': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'h') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 's') && isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.CHARSET_SYMBOL; return; } break; case 'f': case 'F': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), '-') && isEqualIgnoreCase(nextChar(), 'f') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'c') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.FONT_FACE_SYMBOL; return; } break; case 'i': case 'I': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORT_SYMBOL; return; } break; case 'm': case 'M': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'e') && isEqualIgnoreCase(nextChar(), 'd') && isEqualIgnoreCase(nextChar(), 'i') && isEqualIgnoreCase(nextChar(), 'a')) { nextChar(); type = LexicalUnits.MEDIA_SYMBOL; return; } break; case 'p': case 'P': start = position - 1; if (isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'g') && isEqualIgnoreCase(nextChar(), 'e')) { nextChar(); type = LexicalUnits.PAGE_SYMBOL; return; } break; default: if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } start = position - 1; } do { nextChar(); while (current == '\\') { nextChar(); escape(); } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)); type = LexicalUnits.AT_KEYWORD; return; case '!': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace((char)current)); if (isEqualIgnoreCase(current, 'i') && isEqualIgnoreCase(nextChar(), 'm') && isEqualIgnoreCase(nextChar(), 'p') && isEqualIgnoreCase(nextChar(), 'o') && isEqualIgnoreCase(nextChar(), 'r') && isEqualIgnoreCase(nextChar(), 't') && isEqualIgnoreCase(nextChar(), 'a') && isEqualIgnoreCase(nextChar(), 'n') && isEqualIgnoreCase(nextChar(), 't')) { nextChar(); type = LexicalUnits.IMPORTANT_SYMBOL; return; } if (current == -1) { throw new ParseException("eof", reader.getLine(), reader.getColumn()); } else { throw new ParseException("character", reader.getLine(), reader.getColumn()); } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = number(); return; case '.': switch (nextChar()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': type = dotNumber(); return; default: type = LexicalUnits.DOT; return; } case 'u': case 'U': nextChar(); switch (current) { case '+': boolean range = false; for (int i = 0; i < 6; i++) { nextChar(); switch (current) { case '?': range = true; break; default: if (range && !ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } } } nextChar(); if (range) { type = LexicalUnits.UNICODE_RANGE; return; } if (current == '-') { nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { throw new ParseException("character", reader.getLine(), reader.getColumn()); } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); if (!ScannerUtilities.isCSSHexadecimalCharacter ((char)current)) { type = LexicalUnits.UNICODE_RANGE; return; } nextChar(); type = LexicalUnits.UNICODE_RANGE; return; } case 'r': case 'R': nextChar(); switch (current) { case 'l': case 'L': nextChar(); switch (current) { case '(': do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)); switch (current) { case '\'': string1(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case '"': string2(); blankCharacters += 2; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; case ')': throw new ParseException("character", reader.getLine(), reader.getColumn()); default: if (!ScannerUtilities.isCSSURICharacter ((char)current)) { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } start = position - 1; do { nextChar(); } while (current != -1 && ScannerUtilities.isCSSURICharacter ((char)current)); blankCharacters++; while (current != -1 && ScannerUtilities.isCSSSpace ((char)current)) { blankCharacters++; nextChar(); } if (current == -1) { throw new ParseException ("eof", reader.getLine(), reader.getColumn()); } if (current != ')') { throw new ParseException ("character", reader.getLine(), reader.getColumn()); } nextChar(); type = LexicalUnits.URI; return; } } } } while (current != -1 && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; default: if (current == '\\') { do { nextChar(); escape(); } while(current == '\\'); } else if (!ScannerUtilities.isCSSIdentifierStartCharacter ((char)current)) { nextChar(); throw new ParseException("identifier.character", reader.getLine(), reader.getColumn()); } // Identifier while ((current != -1) && ScannerUtilities.isCSSNameCharacter((char)current)) { nextChar(); while (current == '\\') { nextChar(); escape(); } } if (current == '(') { nextChar(); type = LexicalUnits.FUNCTION; return; } type = LexicalUnits.IDENTIFIER; return; } } catch (IOException e) { throw new ParseException(e); } }
41
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { this.min = 0; }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { this.max = INDEFINITE; }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/parser/FragmentIdentifierParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/parser/PathParser.java
catch (ParseException e) { errorHandler.error(e); skipSubPath(); }
// in sources/org/apache/batik/parser/TransformListParser.java
catch (ParseException e) { errorHandler.error(e); skipTransform(); }
// in sources/org/apache/batik/dom/svg/SVGOMAngle.java
catch (ParseException e) { unitType = SVG_ANGLETYPE_UNKNOWN; value = 0; }
// in sources/org/apache/batik/dom/svg/AbstractSVGLength.java
catch (ParseException e) { unitType = SVG_LENGTHTYPE_UNKNOWN; value = 0; }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedLengthList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedTransformList.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPoints.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
catch (ParseException e) { itemList = new ArrayList(1); malformed = true; }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedNumberList.java
catch (ParseException e) { itemList = new ArrayList(1); valid = true; malformed = true; }
// in sources/org/apache/batik/dom/svg/AbstractSVGList.java
catch (ParseException e) { itemList = null; }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGAnimationEngine.java
catch (ParseException e) { // XXX Do something better than returning null. return null; }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { reportError(e.getMessage()); return current; }
// in sources/org/apache/batik/css/parser/Parser.java
catch (ParseException e) { errorHandler.error(createCSSParseException(e.getMessage())); return current; }
18
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch (ParseException e) { throw new IllegalArgumentException(); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_BEGIN_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException e) { throw createException ("attribute.malformed", new Object[] { null, SMIL_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_END_ATTRIBUTE }); }
// in sources/org/apache/batik/anim/timing/TimedElement.java
catch (ParseException ex) { throw createException ("attribute.malformed", new Object[] { null, SMIL_REPEAT_DUR_ATTRIBUTE }); }
// in sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
catch (ParseException ex) { throw createDOMException (DOMException.INVALID_MODIFICATION_ERR, "preserve.aspect.ratio", new Object[] { value }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx) { throw new BridgeException (ctx, elt, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/ViewBox.java
catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); }
// in sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
catch (ParseException pEx) { throw new BridgeException(ctx, glyphElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_PATH_ATTRIBUTE, pathString }); }
// in sources/org/apache/batik/bridge/SVGAnimateMotionElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_VALUES_ATTRIBUTE, s }); }
// in sources/org/apache/batik/bridge/SVGTextPathElementBridge.java
catch (ParseException pEx ) { throw new BridgeException (ctx, pathElement, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_D_ATTRIBUTE}); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx }); }
// in sources/org/apache/batik/bridge/UnitProcessor.java
catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx) { throw new BridgeException(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, transform, pEx }); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch (ParseException pEx ) { throw new BridgeException (null, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] { SVG_SNAPSHOT_TIME_ATTRIBUTE, t, pEx }); }
13
unknown (Lib) ParserConfigurationException 0 0 0 2
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (ParserConfigurationException e1) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
1
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); }
0
unknown (Lib) PrinterException 0 0 1
            
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
public void print() throws PrinterException{ // // Now, request the transcoder to actually perform the // printing job. // PrinterJob printerJob = PrinterJob.getPrinterJob(); PageFormat pageFormat = printerJob.defaultPage(); // // Set the page parameters from the hints // Paper paper = pageFormat.getPaper(); Float pageWidth = (Float)hints.get(KEY_PAGE_WIDTH); Float pageHeight = (Float)hints.get(KEY_PAGE_HEIGHT); if(pageWidth != null){ paper.setSize(pageWidth.floatValue(), paper.getHeight()); } if(pageHeight != null){ paper.setSize(paper.getWidth(), pageHeight.floatValue()); } float x=0, y=0; float width =(float)paper.getWidth(); float height=(float)paper.getHeight(); Float leftMargin = (Float)hints.get(KEY_MARGIN_LEFT); Float topMargin = (Float)hints.get(KEY_MARGIN_TOP); Float rightMargin = (Float)hints.get(KEY_MARGIN_RIGHT); Float bottomMargin = (Float)hints.get(KEY_MARGIN_BOTTOM); if(leftMargin != null){ x = leftMargin.floatValue(); width -= leftMargin.floatValue(); } if(topMargin != null){ y = topMargin.floatValue(); height -= topMargin.floatValue(); } if(rightMargin != null){ width -= rightMargin.floatValue(); } if(bottomMargin != null){ height -= bottomMargin.floatValue(); } paper.setImageableArea(x, y, width, height); String pageOrientation = (String)hints.get(KEY_PAGE_ORIENTATION); if(VALUE_PAGE_ORIENTATION_PORTRAIT.equalsIgnoreCase(pageOrientation)){ pageFormat.setOrientation(PageFormat.PORTRAIT); } else if(VALUE_PAGE_ORIENTATION_LANDSCAPE.equalsIgnoreCase(pageOrientation)){ pageFormat.setOrientation(PageFormat.LANDSCAPE); } else if(VALUE_PAGE_ORIENTATION_REVERSE_LANDSCAPE.equalsIgnoreCase(pageOrientation)){ pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); } pageFormat.setPaper(paper); pageFormat = printerJob.validatePage(pageFormat); // // If required, pop up a dialog to adjust the page format // Boolean showPageFormat = (Boolean)hints.get(KEY_SHOW_PAGE_DIALOG); if ((showPageFormat != null) && (showPageFormat.booleanValue())) { PageFormat tmpPageFormat = printerJob.pageDialog(pageFormat); if(tmpPageFormat == pageFormat){ // Dialog was cancelled, meaning that the print process should // be stopped. return; } pageFormat = tmpPageFormat; } // Set printable before showing printer dialog so // it can update the pageFormat if it wishes... printerJob.setPrintable(this, pageFormat); // // If required, pop up a dialog to select the printer // Boolean showPrinterDialog; showPrinterDialog = (Boolean)hints.get(KEY_SHOW_PRINTER_DIALOG); if(showPrinterDialog != null && showPrinterDialog.booleanValue()){ if(!printerJob.printDialog()){ // Dialog was cancelled, meaning that the print process // should be stopped. return; } } // Print now printerJob.print(); }
1
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (PrinterException ex) { userAgent.displayError(ex); }
0 0
unknown (Lib) PyException 0 0 0 1
            
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
1
            
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (org.python.core.PyException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
1
runtime (Domain) ResourceFormatException
public class ResourceFormatException extends RuntimeException {

    /**
     * The class name of the resource bundle requested
     * @serial
     */
    protected String className;

    /**
     * The name of the specific resource requested by the user
     * @serial
     */
    protected String key;

    /**
     * Constructs a ResourceFormatException with the specified information.
     * A detail message is a String that describes this particular exception.
     * @param s the detail message
     * @param className the name of the resource class
     * @param key the key for the malformed resource.
     */
    public ResourceFormatException(String s, String className, String key) {
        super(s);
        this.className = className;
        this.key = key;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getClassName() {
        return className;
    }

    /**
     * Gets parameter passed by constructor.
     */
    public String getKey() {
        return key;
    }

    /**
     * Returns a printable representation of this object
     */
    public String toString() {
        return super.toString()+" ("+getKey()+", bundle: "+getClassName()+")";
    }
}
7
            
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
1
            
// in sources/org/apache/batik/util/resources/ResourceManager.java
catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); }
23
            
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuBar(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuBar createJMenuBar(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuBar result = new JMenuBar(); List menus = getSpecializedStringList(name, specialization); Iterator it = menus.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected JComponent createJMenuComponent(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { if (name.equals(SEPARATOR)) { buttonGroup = null; return new JSeparator(); } String type = getSpecializedString(name + TYPE_SUFFIX, specialization); JComponent item = null; if (type.equals(TYPE_RADIO)) { if (buttonGroup == null) { buttonGroup = new ButtonGroup(); } } else { buttonGroup = null; } if (type.equals(TYPE_MENU)) { item = createJMenu(name, specialization); } else if (type.equals(TYPE_ITEM)) { item = createJMenuItem(name, specialization); } else if (type.equals(TYPE_RADIO)) { item = createJRadioButtonMenuItem(name, specialization); buttonGroup.add((AbstractButton)item); } else if (type.equals(TYPE_CHECK)) { item = createJCheckBoxMenuItem(name, specialization); } else { throw new ResourceFormatException("Malformed resource", bundle.getClass().getName(), name+TYPE_SUFFIX); } return item; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenu(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenu createJMenu(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenu result = new JMenu(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); List items = getSpecializedStringList(name, specialization); Iterator it = items.iterator(); while (it.hasNext()) { result.add(createJMenuComponent((String)it.next(), specialization)); } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JMenuItem createJMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JMenuItem result = new JMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJRadioButtonMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JRadioButtonMenuItem createJRadioButtonMenuItem (String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButtonMenuItem result; result = new JRadioButtonMenuItem (getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return createJCheckBoxMenuItem(name, null); }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
public JCheckBoxMenuItem createJCheckBoxMenuItem(String name, String specialization) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBoxMenuItem result; result = new JCheckBoxMenuItem(getSpecializedString(name + TEXT_SUFFIX, specialization)); initializeJMenuItem(result, name, specialization); // is the item selected? try { result.setSelected(getSpecializedBoolean(name + SELECTED_SUFFIX, specialization)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/MenuFactory.java
protected void initializeJMenuItem(JMenuItem item, String name, String specialization) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction (getSpecializedString(name + ACTION_SUFFIX, specialization)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } item.setAction(a); item.setText(getSpecializedString(name + TEXT_SUFFIX, specialization)); if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(item); } } catch (MissingResourceException e) { } // Icon try { String s = getSpecializedString(name + ICON_SUFFIX, specialization); URL url = actions.getClass().getResource(s); if (url != null) { item.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getSpecializedString(name + MNEMONIC_SUFFIX, specialization); if (str.length() == 1) { item.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // Accelerator try { if (!(item instanceof JMenu)) { String str = getSpecializedString(name + ACCELERATOR_SUFFIX, specialization); KeyStroke ks = KeyStroke.getKeyStroke(str); if (ks != null) { item.setAccelerator(ks); } else { throw new ResourceFormatException ("Malformed accelerator", bundle.getClass().getName(), name+ACCELERATOR_SUFFIX); } } } catch (MissingResourceException e) { } // is the item enabled? try { item.setEnabled(getSpecializedBoolean(name + ENABLED_SUFFIX, specialization)); } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result = new JToolBar(); List buttons = getStringList(name); Iterator it = buttons.iterator(); while (it.hasNext()) { String s = (String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
// in sources/org/apache/batik/util/gui/resource/ToolBarFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { return buttonFactory.createJToolbarButton(name); }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JButton result; try { result = new JToolbarButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToggleButton result; try { result = new JToolbarToggleButton(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException e) { result = new JToolbarToggleButton(); } initializeButton(result, name); return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JRadioButton result = new JRadioButton(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JCheckBox result = new JCheckBox(getString(name+TEXT_SUFFIX)); initializeButton(result, name); // is the button selected? try { result.setSelected(getBoolean(name+SELECTED_SUFFIX)); } catch (MissingResourceException e) { } return result; }
// in sources/org/apache/batik/util/gui/resource/ButtonFactory.java
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException { // Action try { Action a = actions.getAction(getString(name+ACTION_SUFFIX)); if (a == null) { throw new MissingListenerException("", "Action", name+ACTION_SUFFIX); } b.setAction(a); try { b.setText(getString(name+TEXT_SUFFIX)); } catch (MissingResourceException mre) { // not all buttons have text defined so just // ignore this exception. } if (a instanceof JComponentModifier) { ((JComponentModifier)a).addJComponent(b); } } catch (MissingResourceException e) { } // Icon try { String s = getString(name+ICON_SUFFIX); URL url = actions.getClass().getResource(s); if (url != null) { b.setIcon(new ImageIcon(url)); } } catch (MissingResourceException e) { } // Mnemonic try { String str = getString(name+MNEMONIC_SUFFIX); if (str.length() == 1) { b.setMnemonic(str.charAt(0)); } else { throw new ResourceFormatException("Malformed mnemonic", bundle.getClass().getName(), name+MNEMONIC_SUFFIX); } } catch (MissingResourceException e) { } // ToolTip try { String s = getString(name+TOOLTIP_SUFFIX); if (s != null) { b.setToolTipText(s); } } catch (MissingResourceException e) { } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public boolean getBoolean(String key) throws MissingResourceException, ResourceFormatException { String b = getString(key); if (b.equals("true")) { return true; } else if (b.equals("false")) { return false; } else { throw new ResourceFormatException("Malformed boolean", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getInteger(String key) throws MissingResourceException, ResourceFormatException { String i = getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { throw new ResourceFormatException("Malformed integer", bundle.getClass().getName(), key); } }
// in sources/org/apache/batik/util/resources/ResourceManager.java
public int getCharacter(String key) throws MissingResourceException, ResourceFormatException { String s = getString(key); if(s == null || s.length() == 0){ throw new ResourceFormatException("Malformed character", bundle.getClass().getName(), key); } return s.charAt(0); }
0 0 0
runtime (Lib) RuntimeException 114
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected JFrame getDebugFrame() { try { return (JFrame) debuggerMethods[GET_DEBUG_FRAME_METHOD].invoke (debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected void setExitAction(Runnable r) { try { debuggerMethods[SET_EXIT_ACTION_METHOD].invoke (debuggerInstance, new Object[] { r }); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void attachTo(Object contextFactory) { try { debuggerMethods[ATTACH_TO_METHOD].invoke (debuggerInstance, new Object[] { contextFactory }); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void detach() { try { debuggerMethods[DETACH_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void go() { try { debuggerMethods[GO_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void clearAllBreakpoints() { try { debuggerMethods[CLEAR_ALL_BREAKPOINTS_METHOD].invoke (debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void dispose() { try { debuggerMethods[DISPOSE_METHOD].invoke(debuggerInstance, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
protected Object getContextFactory(Object rhinoInterpreter) { try { return getContextFactoryMethod.invoke(rhinoInterpreter, (Object[]) null); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); } catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); } }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private static final Raster decodeJPEG(byte[] data, JPEGDecodeParam decodeParam, boolean colorConvert, int minX, int minY) { // Create an InputStream from the compressed data array. ByteArrayInputStream jpegStream = new ByteArrayInputStream(data); // Create a decoder. JPEGImageDecoder decoder = decodeParam == null ? JPEGCodec.createJPEGDecoder(jpegStream) : JPEGCodec.createJPEGDecoder(jpegStream, decodeParam); // Decode the compressed data into a Raster. Raster jpegRaster; try { jpegRaster = colorConvert ? decoder.decodeAsBufferedImage().getWritableTile(0, 0) : decoder.decodeAsRaster(); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Translate the decoded Raster to the specified location and return. return jpegRaster.createTranslatedChild(minX, minY); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private final void inflate(byte[] deflated, byte[] inflated) { inflater.setInput(deflated); try { inflater.inflate(inflated); } catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); } inflater.reset(); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private long[] getFieldAsLongs(TIFFField field) { long[] value = null; if(field.getType() == TIFFField.TIFF_SHORT) { char[] charValue = field.getAsChars(); value = new long[charValue.length]; for(int i = 0; i < charValue.length; i++) { value[i] = charValue[i] & 0xffff; } } else if(field.getType() == TIFFField.TIFF_LONG) { value = field.getAsLongs(); } else { throw new RuntimeException(); } return value; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
public synchronized Raster getTile(int tileX, int tileY) { if ((tileX < 0) || (tileX >= tilesX) || (tileY < 0) || (tileY >= tilesY)) { throw new IllegalArgumentException("TIFFImage12"); } // System.out.println("Called TIFF getTile:" + tileX + "," + tileY); // Get the data array out of the DataBuffer byte[] bdata = null; short[] sdata = null; int[] idata = null; SampleModel sampleModel = getSampleModel(); WritableRaster tile = makeTile(tileX,tileY); DataBuffer buffer = tile.getDataBuffer(); int dataType = sampleModel.getDataType(); if (dataType == DataBuffer.TYPE_BYTE) { bdata = ((DataBufferByte)buffer).getData(); } else if (dataType == DataBuffer.TYPE_USHORT) { sdata = ((DataBufferUShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_SHORT) { sdata = ((DataBufferShort)buffer).getData(); } else if (dataType == DataBuffer.TYPE_INT) { idata = ((DataBufferInt)buffer).getData(); } // Variables used for swapping when converting from RGB to BGR byte bswap; short sswap; int iswap; // Save original file pointer position and seek to tile data location. long save_offset = 0; try { save_offset = stream.getFilePointer(); stream.seek(tileOffsets[tileY*tilesX + tileX]); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Number of bytes in this tile (strip) after compression. int byteCount = (int)tileByteCounts[tileY*tilesX + tileX]; // Find out the number of bytes in the current tile Rectangle newRect; if (!tiled) newRect = tile.getBounds(); else newRect = new Rectangle(tile.getMinX(), tile.getMinY(), tileWidth, tileHeight); int unitsInThisTile = newRect.width * newRect.height * numBands; // Allocate read buffer if needed. byte[] data = compression != COMP_NONE || imageType == TYPE_PALETTE ? new byte[byteCount] : null; // Read the data, uncompressing as needed. There are four cases: // bilevel, palette-RGB, 4-bit grayscale, and everything else. if(imageType == TYPE_BILEVEL) { // bilevel try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 8 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/8) * newRect.height; } else { bytesInThisTile = (newRect.width/8 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_FAX_G3_1D) { stream.readFully(data, 0, byteCount); decoder.decode1D(bdata, data, 0, newRect.height); } else if (compression == COMP_FAX_G3_2D) { stream.readFully(data, 0, byteCount); decoder.decode2D(bdata, data, 0, newRect.height, tiffT4Options); } else if (compression == COMP_FAX_G4_2D) { stream.readFully(data, 0, byteCount); decoder.decodeT6(bdata, data, 0, newRect.height, tiffT6Options); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else if(imageType == TYPE_PALETTE) { // palette-RGB if (sampleSize == 16) { if (decodePaletteAsShorts) { short[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Since unitsBeforeLookup is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply it by 2 in order to figure out // how many bytes we'll get after decompression. int entries = unitsBeforeLookup * 2; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; decodePackbits(data, entries, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_LZW) { // Read in all the compressed data for this tile stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; lzwDecoder.decode(data, byteArray, newRect.height); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[entries]; inflate(data, byteArray); tempData = new short[unitsBeforeLookup]; interpretBytesAsShorts(byteArray, tempData, unitsBeforeLookup); } else if (compression == COMP_NONE) { // byteCount tells us how many bytes are there // in this tile, but we need to read in shorts, // which will take half the space, so while // allocating we divide byteCount by 2. tempData = new short[byteCount/2]; readShorts(byteCount/2, tempData); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } if (dataType == DataBuffer.TYPE_USHORT) { // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else if (dataType == DataBuffer.TYPE_SHORT) { // Expand the palette image into an rgb image with // short data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xffff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)cmapValue; // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)cmapValue; // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)cmapValue; } } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 8) { if (decodePaletteAsShorts) { byte[] tempData= null; // At this point the data is 1 banded and will // become 3 banded only after we've done the palette // lookup, since unitsInThisTile was calculated with // 3 bands, we need to divide this by 3. int unitsBeforeLookup = unitsInThisTile / 3; // Read the data, if compressed, decode it, reset the pointer try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; decodePackbits(data, unitsBeforeLookup, tempData); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); Raster tempTile = decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY()); int[] tempPixels = new int[unitsBeforeLookup]; tempTile.getPixels(tile.getMinX(), tile.getMinY(), tile.getWidth(), tile.getHeight(), tempPixels); tempData = new byte[unitsBeforeLookup]; for(int i = 0; i < unitsBeforeLookup; i++) { tempData[i] = (byte)tempPixels[i]; } } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); tempData = new byte[unitsBeforeLookup]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = new byte[byteCount]; stream.readFully(tempData, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Expand the palette image into an rgb image with ushort // data type. int cmapValue; int count = 0, lookup, len = colormap.length/3; int len2 = len * 2; for (int i=0; i<unitsBeforeLookup; i++) { // Get the index into the colormap lookup = tempData[i] & 0xff; // Get the blue value cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the green value cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); // Get the red value cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // No lookup being done here, when RGB values are needed, // the associated IndexColorModel can be used to get them. try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } else if (sampleSize == 4) { int padding = (newRect.width % 2 == 0) ? 0 : 1; int bytesPostDecoding = ((newRect.width/2 + padding) * newRect.height); // Output short images if (decodePaletteAsShorts) { byte[] tempData = null; try { stream.readFully(data, 0, byteCount); stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // If compressed, decode the data. if (compression == COMP_PACKBITS) { tempData = new byte[bytesPostDecoding]; decodePackbits(data, bytesPostDecoding, tempData); } else if (compression == COMP_LZW) { tempData = new byte[bytesPostDecoding]; lzwDecoder.decode(data, tempData, newRect.height); } else if (compression == COMP_DEFLATE) { tempData = new byte[bytesPostDecoding]; inflate(data, tempData); } else if (compression == COMP_NONE) { tempData = data; } int bytes = unitsInThisTile / 3; // Unpack the 2 pixels packed into each byte. data = new byte[bytes]; int srcCount = 0, dstCount = 0; for (int j=0; j<newRect.height; j++) { for (int i=0; i<newRect.width/2; i++) { data[dstCount++] = (byte)((tempData[srcCount] & 0xf0) >> 4); data[dstCount++] = (byte)(tempData[srcCount++] & 0x0f); } if (padding == 1) { data[dstCount++] = (byte)((tempData[srcCount++] & 0xf0) >> 4); } } int len = colormap.length/3; int len2 = len*2; int cmapValue, lookup; int count = 0; for (int i=0; i<bytes; i++) { lookup = data[i] & 0xff; cmapValue = colormap[lookup+len2]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup+len]; sdata[count++] = (short)(cmapValue & 0xffff); cmapValue = colormap[lookup]; sdata[count++] = (short)(cmapValue & 0xffff); } } else { // Output byte values, use IndexColorModel for unpacking try { // If compressed, decode the data. if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, bytesPostDecoding, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } } } else if(imageType == TYPE_GRAY_4BIT) { // 4-bit gray try { if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since the decompressed data will still be packed // 2 pixels into 1 byte, calculate bytesInThisTile int bytesInThisTile; if ((newRect.width % 8) == 0) { bytesInThisTile = (newRect.width/2) * newRect.height; } else { bytesInThisTile = (newRect.width/2 + 1) * newRect.height; } decodePackbits(data, bytesInThisTile, bdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } else { stream.readFully(bdata, 0, byteCount); } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } } else { // everything else try { if (sampleSize == 8) { if (compression == COMP_NONE) { stream.readFully(bdata, 0, byteCount); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); lzwDecoder.decode(data, bdata, newRect.height); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); decodePackbits(data, unitsInThisTile, bdata); } else if (compression == COMP_JPEG_TTN2) { stream.readFully(data, 0, byteCount); tile.setRect(decodeJPEG(data, decodeParam, colorConvertJPEG, tile.getMinX(), tile.getMinY())); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); inflate(data, bdata); } } else if (sampleSize == 16) { if (compression == COMP_NONE) { readShorts(byteCount/2, sdata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 2]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of shorts, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 2 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 2; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 2]; inflate(data, byteArray); interpretBytesAsShorts(byteArray, sdata, unitsInThisTile); } } else if (sampleSize == 32 && dataType == DataBuffer.TYPE_INT) { // redundant if (compression == COMP_NONE) { readInts(byteCount/4, idata); } else if (compression == COMP_LZW) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. byte[] byteArray = new byte[unitsInThisTile * 4]; lzwDecoder.decode(data, byteArray, newRect.height); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_PACKBITS) { stream.readFully(data, 0, byteCount); // Since unitsInThisTile is the number of ints, // but we do our decompression in terms of bytes, we // need to multiply unitsInThisTile by 4 in order to // figure out how many bytes we'll get after // decompression. int bytesInThisTile = unitsInThisTile * 4; byte[] byteArray = new byte[bytesInThisTile]; decodePackbits(data, bytesInThisTile, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } else if (compression == COMP_DEFLATE) { stream.readFully(data, 0, byteCount); byte[] byteArray = new byte[unitsInThisTile * 4]; inflate(data, byteArray); interpretBytesAsInts(byteArray, idata, unitsInThisTile); } } stream.seek(save_offset); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } // Modify the data for certain special cases. switch(imageType) { case TYPE_GRAY: case TYPE_GRAY_ALPHA: if(isWhiteZero) { // Since we are using a ComponentColorModel with this // image, we need to change the WhiteIsZero data to // BlackIsZero data so it will display properly. if (dataType == DataBuffer.TYPE_BYTE && !(getColorModel() instanceof IndexColorModel)) { for (int l = 0; l < bdata.length; l += numBands) { bdata[l] = (byte)(255 - bdata[l]); } } else if (dataType == DataBuffer.TYPE_USHORT) { int ushortMax = Short.MAX_VALUE - Short.MIN_VALUE; for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(ushortMax - sdata[l]); } } else if (dataType == DataBuffer.TYPE_SHORT) { for (int l = 0; l < sdata.length; l += numBands) { sdata[l] = (short)(~sdata[l]); } } else if (dataType == DataBuffer.TYPE_INT) { long uintMax = ((long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE); for (int l = 0; l < idata.length; l += numBands) { idata[l] = (int)(uintMax - idata[l]); } } } break; case TYPE_RGB: // Change RGB to BGR order, as Java2D displays that faster. // Unnecessary for JPEG-in-TIFF as the decoder handles it. if (sampleSize == 8 && compression != COMP_JPEG_TTN2) { for (int i=0; i<unitsInThisTile; i+=3) { bswap = bdata[i]; bdata[i] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=3) { sswap = sdata[i]; sdata[i] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=3) { iswap = idata[i]; idata[i] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_RGB_ALPHA: // Convert from RGBA to ABGR for Java2D if (sampleSize == 8) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A bswap = bdata[i]; bdata[i] = bdata[i+3]; bdata[i+3] = bswap; // Swap G and B bswap = bdata[i+1]; bdata[i+1] = bdata[i+2]; bdata[i+2] = bswap; } } else if (sampleSize == 16) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A sswap = sdata[i]; sdata[i] = sdata[i+3]; sdata[i+3] = sswap; // Swap G and B sswap = sdata[i+1]; sdata[i+1] = sdata[i+2]; sdata[i+2] = sswap; } } else if (sampleSize == 32) { if(dataType == DataBuffer.TYPE_INT) { for (int i=0; i<unitsInThisTile; i+=4) { // Swap R and A iswap = idata[i]; idata[i] = idata[i+3]; idata[i+3] = iswap; // Swap G and B iswap = idata[i+1]; idata[i+1] = idata[i+2]; idata[i+2] = iswap; } } } break; case TYPE_YCBCR_SUB: // Post-processing for YCbCr with subsampled chrominance: // simply replicate the chroma channels for displayability. int pixelsPerDataUnit = chromaSubH*chromaSubV; int numH = newRect.width/chromaSubH; int numV = newRect.height/chromaSubV; byte[] tempData = new byte[numH*numV*(pixelsPerDataUnit + 2)]; System.arraycopy(bdata, 0, tempData, 0, tempData.length); int samplesPerDataUnit = pixelsPerDataUnit*3; int[] pixels = new int[samplesPerDataUnit]; int bOffset = 0; int offsetCb = pixelsPerDataUnit; int offsetCr = offsetCb + 1; int y = newRect.y; for(int j = 0; j < numV; j++) { int x = newRect.x; for(int i = 0; i < numH; i++) { int Cb = tempData[bOffset + offsetCb]; int Cr = tempData[bOffset + offsetCr]; int k = 0; while(k < samplesPerDataUnit) { pixels[k++] = tempData[bOffset++]; pixels[k++] = Cb; pixels[k++] = Cr; } bOffset += 2; tile.setPixels(x, y, chromaSubH, chromaSubV, pixels); x += chromaSubH; } y += chromaSubV; } break; } } return tile; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private void readShorts(int shortCount, short[] shortArray) { // Since each short consists of 2 bytes, we need a // byte array of double size int byteCount = 2 * shortCount; byte[] byteArray = new byte[byteCount]; try { stream.readFully(byteArray, 0, byteCount); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } interpretBytesAsShorts(byteArray, shortArray, shortCount); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private void readInts(int intCount, int[] intArray) { // Since each int consists of 4 bytes, we need a // byte array of quadruple size int byteCount = 4 * intCount; byte[] byteArray = new byte[byteCount]; try { stream.readFully(byteArray, 0, byteCount); } catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); } interpretBytesAsInts(byteArray, intArray, intCount); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
private byte[] decodePackbits(byte[] data, int arraySize, byte[] dst) { if (dst == null) { dst = new byte[arraySize]; } int srcCount = 0, dstCount = 0; byte repeat, b; try { while (dstCount < arraySize) { b = data[srcCount++]; if (b >= 0 && b <= 127) { // literal run packet for (int i=0; i<(b + 1); i++) { dst[dstCount++] = data[srcCount++]; } } else if (b <= -1 && b >= -127) { // 2 byte encoded run packet repeat = data[srcCount++]; for (int i=0; i<(-b + 1); i++) { dst[dstCount++] = repeat; } } else { // no-op packet. Do nothing srcCount++; } } } catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); } return dst; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) { final String stdmeta = "javax_imageio_1.0"; if (meta.isStandardMetadataFormatSupported()) { IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(stdmeta); IIOMetadataNode dim = getChildNode(root, "Dimension"); IIOMetadataNode child; if (params.getResolution() != null) { child = getChildNode(dim, "HorizontalPixelSize"); if (child == null) { child = new IIOMetadataNode("HorizontalPixelSize"); dim.appendChild(child); } child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4)); child = getChildNode(dim, "VerticalPixelSize"); if (child == null) { child = new IIOMetadataNode("VerticalPixelSize"); dim.appendChild(child); } child.setAttribute("value", Double.toString(params.getResolution().doubleValue() / 25.4)); } try { meta.mergeTree(stdmeta, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); } } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
Override protected IIOMetadata updateMetadata(IIOMetadata meta, ImageWriterParams params) { //ImageIODebugUtil.dumpMetadata(meta); if (JPEG_NATIVE_FORMAT.equals(meta.getNativeMetadataFormatName())) { meta = addAdobeTransform(meta); IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(JPEG_NATIVE_FORMAT); IIOMetadataNode jv = getChildNode(root, "JPEGvariety"); if (jv == null) { jv = new IIOMetadataNode("JPEGvariety"); root.appendChild(jv); } IIOMetadataNode child; if (params.getResolution() != null) { child = getChildNode(jv, "app0JFIF"); if (child == null) { child = new IIOMetadataNode("app0JFIF"); jv.appendChild(child); } //JPEG gets special treatment because there seems to be a bug in //the JPEG codec in ImageIO converting the pixel size incorrectly //(or not at all) when using standard metadata format. child.setAttribute("majorVersion", null); child.setAttribute("minorVersion", null); child.setAttribute("resUnits", "1"); //dots per inch child.setAttribute("Xdensity", params.getResolution().toString()); child.setAttribute("Ydensity", params.getResolution().toString()); child.setAttribute("thumbWidth", null); child.setAttribute("thumbHeight", null); } try { meta.setFromTree(JPEG_NATIVE_FORMAT, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); } //ImageIODebugUtil.dumpMetadata(meta); } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
private static IIOMetadata addAdobeTransform(IIOMetadata meta) { // add the adobe transformation (transform 1 -> to YCbCr) IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(JPEG_NATIVE_FORMAT); IIOMetadataNode markerSequence = getChildNode(root, "markerSequence"); if (markerSequence == null) { throw new RuntimeException("Invalid metadata!"); } IIOMetadataNode adobeTransform = getChildNode(markerSequence, "app14Adobe"); if (adobeTransform == null) { adobeTransform = new IIOMetadataNode("app14Adobe"); adobeTransform.setAttribute("transform" , "1"); // convert RGB to YCbCr adobeTransform.setAttribute("version", "101"); adobeTransform.setAttribute("flags0", "0"); adobeTransform.setAttribute("flags1", "0"); markerSequence.appendChild(adobeTransform); } else { adobeTransform.setAttribute("transform" , "1"); } try { meta.setFromTree(JPEG_NATIVE_FORMAT, root); } catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); } return meta; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
public void encode(RenderedImage im) throws IOException { this.image = im; this.width = image.getWidth(); this.height = image.getHeight(); SampleModel sampleModel = image.getSampleModel(); int[] sampleSize = sampleModel.getSampleSize(); // Set bitDepth to a sentinel value this.bitDepth = -1; this.bitShift = 0; // Allow user to override the bit depth of gray images if (param instanceof PNGEncodeParam.Gray) { PNGEncodeParam.Gray paramg = (PNGEncodeParam.Gray)param; if (paramg.isBitDepthSet()) { this.bitDepth = paramg.getBitDepth(); } if (paramg.isBitShiftSet()) { this.bitShift = paramg.getBitShift(); } } // Get bit depth from image if not set in param if (this.bitDepth == -1) { // Get bit depth from channel 0 of the image this.bitDepth = sampleSize[0]; // Ensure all channels have the same bit depth for (int i = 1; i < sampleSize.length; i++) { if (sampleSize[i] != bitDepth) { throw new RuntimeException(); } } // Round bit depth up to a power of 2 if (bitDepth > 2 && bitDepth < 4) { bitDepth = 4; } else if (bitDepth > 4 && bitDepth < 8) { bitDepth = 8; } else if (bitDepth > 8 && bitDepth < 16) { bitDepth = 16; } else if (bitDepth > 16) { throw new RuntimeException(); } } this.numBands = sampleModel.getNumBands(); this.bpp = numBands*((bitDepth == 16) ? 2 : 1); ColorModel colorModel = image.getColorModel(); if (colorModel instanceof IndexColorModel) { if (bitDepth < 1 || bitDepth > 8) { throw new RuntimeException(); } if (sampleModel.getNumBands() != 1) { throw new RuntimeException(); } IndexColorModel icm = (IndexColorModel)colorModel; int size = icm.getMapSize(); redPalette = new byte[size]; greenPalette = new byte[size]; bluePalette = new byte[size]; alphaPalette = new byte[size]; icm.getReds(redPalette); icm.getGreens(greenPalette); icm.getBlues(bluePalette); icm.getAlphas(alphaPalette); this.bpp = 1; if (param == null) { param = createGrayParam(redPalette, greenPalette, bluePalette, alphaPalette); } // If param is still null, it can't be expressed as gray if (param == null) { param = new PNGEncodeParam.Palette(); } if (param instanceof PNGEncodeParam.Palette) { // If palette not set in param, create one from the ColorModel. PNGEncodeParam.Palette parami = (PNGEncodeParam.Palette)param; if (parami.isPaletteSet()) { int[] palette = parami.getPalette(); size = palette.length/3; int index = 0; for (int i = 0; i < size; i++) { redPalette[i] = (byte)palette[index++]; greenPalette[i] = (byte)palette[index++]; bluePalette[i] = (byte)palette[index++]; alphaPalette[i] = (byte)255; } } this.colorType = PNG_COLOR_PALETTE; } else if (param instanceof PNGEncodeParam.Gray) { redPalette = greenPalette = bluePalette = alphaPalette = null; this.colorType = PNG_COLOR_GRAY; } else { throw new RuntimeException(); } } else if (numBands == 1) { if (param == null) { param = new PNGEncodeParam.Gray(); } this.colorType = PNG_COLOR_GRAY; } else if (numBands == 2) { if (param == null) { param = new PNGEncodeParam.Gray(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 1; if ((sampleSize[0] == 8) && (bitDepth < 8)) { compressGray = true; } bpp = (bitDepth == 16) ? 2 : 1; this.colorType = PNG_COLOR_GRAY; } else { if (this.bitDepth < 8) { this.bitDepth = 8; } this.colorType = PNG_COLOR_GRAY_ALPHA; } } else if (numBands == 3) { if (param == null) { param = new PNGEncodeParam.RGB(); } this.colorType = PNG_COLOR_RGB; } else if (numBands == 4) { if (param == null) { param = new PNGEncodeParam.RGB(); } if (param.isTransparencySet()) { skipAlpha = true; numBands = 3; bpp = (bitDepth == 16) ? 6 : 3; this.colorType = PNG_COLOR_RGB; } else { this.colorType = PNG_COLOR_RGB_ALPHA; } } interlace = param.getInterlacing(); writeMagic(); writeIHDR(); writeCHRM(); writeGAMA(); writeICCP(); writeSBIT(); writeSRGB(); writePLTE(); writeHIST(); writeTRNS(); writeBKGD(); writePHYS(); writeSPLT(); writeTIME(); writeTEXT(); writeZTXT(); writePrivateChunks(); writeIDAT(); writeIEND(); dataOutput.flush(); dataOutput.close(); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitShift(int bitShift) { if (bitShift < 0) { throw new RuntimeException(); } this.bitShift = bitShift; bitShiftSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBitDepth(int bitDepth) { if (bitDepth != 8 && bitDepth != 16) { throw new RuntimeException(); } this.bitDepth = bitDepth; bitDepthSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void setBackgroundRGB(int[] rgb) { if (rgb.length != 3) { throw new RuntimeException(); } backgroundRGB = rgb; backgroundSet = true; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public void unsetBackground() { throw new RuntimeException(PropertyUtil.getString("PNGEncodeParam23")); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGEncodeParam.java
public boolean isBackgroundSet() { throw new RuntimeException(PropertyUtil.getString("PNGEncodeParam24")); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_IHDR_chunk(PNGChunk chunk) { tileWidth = width = chunk.getInt4(0); tileHeight = height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); if ((bitDepth != 1) && (bitDepth != 2) && (bitDepth != 4) && (bitDepth != 8) && (bitDepth != 16)) { // Error -- bad bit depth String msg = PropertyUtil.getString("PNGImageDecoder3"); throw new RuntimeException(msg); } maxOpacity = (1 << bitDepth) - 1; colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && (colorType != PNG_COLOR_PALETTE) && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { System.out.println(PropertyUtil.getString("PNGImageDecoder4")); } if ((colorType == PNG_COLOR_RGB) && (bitDepth < 8)) { // Error -- RGB images must have 8 or 16 bits String msg = PropertyUtil.getString("PNGImageDecoder5"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_PALETTE) && (bitDepth == 16)) { // Error -- palette images must have < 16 bits String msg = PropertyUtil.getString("PNGImageDecoder6"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_GRAY_ALPHA) && (bitDepth < 8)) { // Error -- gray/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder7"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_RGB_ALPHA) && (bitDepth < 8)) { // Error -- RGB/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder8"); throw new RuntimeException(msg); } if (emitProperties) { properties.put("color_type", colorTypeNames[colorType]); } if (generateEncodeParam) { if (colorType == PNG_COLOR_PALETTE) { encodeParam = new PNGEncodeParam.Palette(); } else if (colorType == PNG_COLOR_GRAY || colorType == PNG_COLOR_GRAY_ALPHA) { encodeParam = new PNGEncodeParam.Gray(); } else { encodeParam = new PNGEncodeParam.RGB(); } decodeParam.setEncodeParam(encodeParam); } if (encodeParam != null) { encodeParam.setBitDepth(bitDepth); } if (emitProperties) { properties.put("bit_depth", new Integer(bitDepth)); } if (performGammaCorrection) { // Assume file gamma is 1/2.2 unless we get a gAMA chunk float gamma = (1.0F/2.2F)*(displayExponent/userExponent); if (encodeParam != null) { encodeParam.setGamma(gamma); } if (emitProperties) { properties.put("gamma", new Float(gamma)); } } compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { // Error -- only know about compression method 0 String msg = PropertyUtil.getString("PNGImageDecoder9"); throw new RuntimeException(msg); } filterMethod = chunk.getInt1(11); if (filterMethod != 0) { // Error -- only know about filter method 0 String msg = PropertyUtil.getString("PNGImageDecoder10"); throw new RuntimeException(msg); } interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) { encodeParam.setInterlacing(false); } if (emitProperties) { properties.put("interlace_method", "None"); } } else if (interlaceMethod == 1) { if (encodeParam != null) { encodeParam.setInterlacing(true); } if (emitProperties) { properties.put("interlace_method", "Adam7"); } } else { // Error -- only know about Adam7 interlacing String msg = PropertyUtil.getString("PNGImageDecoder11"); throw new RuntimeException(msg); } bytesPerPixel = (bitDepth == 16) ? 2 : 1; switch (colorType) { case PNG_COLOR_GRAY: inputBands = 1; outputBands = 1; if (output8BitGray && (bitDepth < 8)) { postProcess = POST_GRAY_LUT; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_RGB: inputBands = 3; bytesPerPixel *= 3; outputBands = 3; if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_PALETTE: inputBands = 1; bytesPerPixel = 1; outputBands = expandPalette ? 3 : 1; if (expandPalette) { postProcess = POST_PALETTE_TO_RGB; } else { postProcess = POST_NONE; } break; case PNG_COLOR_GRAY_ALPHA: inputBands = 2; bytesPerPixel *= 2; if (suppressAlpha) { outputBands = 1; postProcess = POST_REMOVE_GRAY_TRANS; } else { if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } if (expandGrayAlpha) { postProcess |= POST_EXP_MASK; outputBands = 4; } else { outputBands = 2; } } break; case PNG_COLOR_RGB_ALPHA: inputBands = 4; bytesPerPixel *= 4; outputBands = (!suppressAlpha) ? 4 : 3; if (suppressAlpha) { postProcess = POST_REMOVE_RGB_TRANS; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_hIST_chunk(PNGChunk chunk) { if (redPalette == null) { String msg = PropertyUtil.getString("PNGImageDecoder18"); throw new RuntimeException(msg); } int length = redPalette.length; int[] hist = new int[length]; for (int i = 0; i < length; i++) { hist[i] = chunk.getInt2(2*i); } if (encodeParam != null) { encodeParam.setPaletteHistogram(hist); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_pHYs_chunk(PNGChunk chunk) { int xPixelsPerUnit = chunk.getInt4(0); int yPixelsPerUnit = chunk.getInt4(4); int unitSpecifier = chunk.getInt1(8); if (encodeParam != null) { encodeParam.setPhysicalDimension(xPixelsPerUnit, yPixelsPerUnit, unitSpecifier); } if (emitProperties) { properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit)); properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit)); properties.put("pixel_aspect_ratio", new Float((float)xPixelsPerUnit/yPixelsPerUnit)); if (unitSpecifier == 1) { properties.put("pixel_units", "Meters"); } else if (unitSpecifier != 0) { // Error -- unit specifier must be 0 or 1 String msg = PropertyUtil.getString("PNGImageDecoder12"); throw new RuntimeException(msg); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_sBIT_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { significantBits = new int[3]; } else { significantBits = new int[inputBands]; } for (int i = 0; i < significantBits.length; i++) { int bits = chunk.getByte(i); int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth; if (bits <= 0 || bits > depth) { // Error -- significant bits must be between 0 and // image bit depth. String msg = PropertyUtil.getString("PNGImageDecoder13"); throw new RuntimeException(msg); } significantBits[i] = bits; } if (encodeParam != null) { encodeParam.setSignificantBits(significantBits); } if (emitProperties) { properties.put("significant_bits", significantBits); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { // Error -- mustn't have more alpha than RGB palette entries String msg = PropertyUtil.getString("PNGImageDecoder14"); throw new RuntimeException(msg); } // Load beginning of palette from the chunk alphaPalette = new byte[paletteEntries]; for (int i = 0; i < entries; i++) { alphaPalette[i] = chunk.getByte(i); } // Fill rest of palette with 255 for (int i = entries; i < paletteEntries; i++) { alphaPalette[i] = (byte)255; } if (!suppressAlpha) { if (expandPalette) { postProcess = POST_PALETTE_TO_RGBA; outputBands = 4; } else { outputHasAlphaPalette = true; } } } else if (colorType == PNG_COLOR_GRAY) { grayTransparentAlpha = chunk.getInt2(0); if (!suppressAlpha) { if (bitDepth < 8) { output8BitGray = true; maxOpacity = 255; postProcess = POST_GRAY_LUT_ADD_TRANS; } else { postProcess = POST_ADD_GRAY_TRANS; } if (expandGrayAlpha) { outputBands = 4; postProcess |= POST_EXP_MASK; } else { outputBands = 2; } if (encodeParam != null) { ((PNGEncodeParam.Gray)encodeParam). setTransparentGray(grayTransparentAlpha); } } } else if (colorType == PNG_COLOR_RGB) { redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4); if (!suppressAlpha) { outputBands = 4; postProcess = POST_ADD_RGB_TRANS; if (encodeParam != null) { int[] rgbTrans = new int[3]; rgbTrans[0] = redTransparentAlpha; rgbTrans[1] = greenTransparentAlpha; rgbTrans[2] = blueTransparentAlpha; ((PNGEncodeParam.RGB)encodeParam). setTransparentRGB(rgbTrans); } } } else if (colorType == PNG_COLOR_GRAY_ALPHA || colorType == PNG_COLOR_RGB_ALPHA) { // Error -- GA or RGBA image can't have a tRNS chunk. String msg = PropertyUtil.getString("PNGImageDecoder15"); throw new RuntimeException(msg); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
private void decodePass(WritableRaster imRas, int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) { if ((passWidth == 0) || (passHeight == 0)) { return; } int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; byte[] curr = new byte[bytesPerRow]; byte[] prior = new byte[bytesPerRow]; // Create a 1-row tall Raster to hold the data WritableRaster passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, bitDepth); DataBuffer dataBuffer = passRow.getDataBuffer(); int type = dataBuffer.getDataType(); byte[] byteData = null; short[] shortData = null; if (type == DataBuffer.TYPE_BYTE) { byteData = ((DataBufferByte)dataBuffer).getData(); } else { shortData = ((DataBufferUShort)dataBuffer).getData(); } // Decode the (sub)image row-by-row int srcY, dstY; for (srcY = 0, dstY = yOffset; srcY < passHeight; srcY++, dstY += yStep) { // Read the filter type byte and a row of data int filter = 0; try { filter = dataStream.read(); dataStream.readFully(curr, 0, bytesPerRow); } catch (Exception e) { e.printStackTrace(); } switch (filter) { case PNG_FILTER_NONE: break; case PNG_FILTER_SUB: decodeSubFilter(curr, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_UP: decodeUpFilter(curr, prior, bytesPerRow); break; case PNG_FILTER_AVERAGE: decodeAverageFilter(curr, prior, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_PAETH: decodePaethFilter(curr, prior, bytesPerRow, bytesPerPixel); break; default: // Error -- uknown filter type String msg = PropertyUtil.getString("PNGImageDecoder16"); throw new RuntimeException(msg); } // Copy data into passRow byte by byte if (bitDepth < 16) { System.arraycopy(curr, 0, byteData, 0, bytesPerRow); } else { int idx = 0; for (int j = 0; j < eltsPerRow; j++) { shortData[j] = (short)((curr[idx] << 8) | (curr[idx + 1] & 0xff)); idx += 2; } } processPixels(postProcess, passRow, imRas, xOffset, xStep, dstY, passWidth); // Swap curr and prior byte[] tmp = prior; prior = curr; curr = tmp; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bounds = new Rectangle(0, 0, width, height); bitDepth = chunk.getInt1(8); int validMask = (1 << 1) | ( 1 << 2 ) | ( 1 << 4 ) | ( 1 << 8 ) | ( 1 << 16 ); if (( ( 1 << bitDepth ) & validMask ) == 0 ) { // bitDepth is not one of { 1, 2, 4, 8, 16 }: Error -- bad bit depth String msg = PropertyUtil.getString("PNGImageDecoder3"); throw new RuntimeException(msg); } maxOpacity = (1 << bitDepth) - 1; colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && (colorType != PNG_COLOR_PALETTE) && (colorType != PNG_COLOR_GRAY_ALPHA) && (colorType != PNG_COLOR_RGB_ALPHA)) { System.out.println(PropertyUtil.getString("PNGImageDecoder4")); } if ((colorType == PNG_COLOR_RGB) && (bitDepth < 8)) { // Error -- RGB images must have 8 or 16 bits String msg = PropertyUtil.getString("PNGImageDecoder5"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_PALETTE) && (bitDepth == 16)) { // Error -- palette images must have < 16 bits String msg = PropertyUtil.getString("PNGImageDecoder6"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_GRAY_ALPHA) && (bitDepth < 8)) { // Error -- gray/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder7"); throw new RuntimeException(msg); } if ((colorType == PNG_COLOR_RGB_ALPHA) && (bitDepth < 8)) { // Error -- RGB/alpha images must have >= 8 bits String msg = PropertyUtil.getString("PNGImageDecoder8"); throw new RuntimeException(msg); } if (emitProperties) { properties.put("color_type", colorTypeNames[colorType]); } if (generateEncodeParam) { if (colorType == PNG_COLOR_PALETTE) { encodeParam = new PNGEncodeParam.Palette(); } else if (colorType == PNG_COLOR_GRAY || colorType == PNG_COLOR_GRAY_ALPHA) { encodeParam = new PNGEncodeParam.Gray(); } else { encodeParam = new PNGEncodeParam.RGB(); } decodeParam.setEncodeParam(encodeParam); } if (encodeParam != null) { encodeParam.setBitDepth(bitDepth); } if (emitProperties) { properties.put("bit_depth", new Integer(bitDepth)); } if (performGammaCorrection) { // Assume file gamma is 1/2.2 unless we get a gAMA chunk float gamma = (1.0F/2.2F)*(displayExponent/userExponent); if (encodeParam != null) { encodeParam.setGamma(gamma); } if (emitProperties) { properties.put("gamma", new Float(gamma)); } } compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { // Error -- only know about compression method 0 String msg = PropertyUtil.getString("PNGImageDecoder9"); throw new RuntimeException(msg); } filterMethod = chunk.getInt1(11); if (filterMethod != 0) { // Error -- only know about filter method 0 String msg = PropertyUtil.getString("PNGImageDecoder10"); throw new RuntimeException(msg); } interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) { encodeParam.setInterlacing(false); } if (emitProperties) { properties.put("interlace_method", "None"); } } else if (interlaceMethod == 1) { if (encodeParam != null) { encodeParam.setInterlacing(true); } if (emitProperties) { properties.put("interlace_method", "Adam7"); } } else { // Error -- only know about Adam7 interlacing String msg = PropertyUtil.getString("PNGImageDecoder11"); throw new RuntimeException(msg); } bytesPerPixel = (bitDepth == 16) ? 2 : 1; switch (colorType) { case PNG_COLOR_GRAY: inputBands = 1; outputBands = 1; if (output8BitGray && (bitDepth < 8)) { postProcess = POST_GRAY_LUT; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_RGB: inputBands = 3; bytesPerPixel *= 3; outputBands = 3; if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; case PNG_COLOR_PALETTE: inputBands = 1; bytesPerPixel = 1; outputBands = expandPalette ? 3 : 1; if (expandPalette) { postProcess = POST_PALETTE_TO_RGB; } else { postProcess = POST_NONE; } break; case PNG_COLOR_GRAY_ALPHA: inputBands = 2; bytesPerPixel *= 2; if (suppressAlpha) { outputBands = 1; postProcess = POST_REMOVE_GRAY_TRANS; } else { if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } if (expandGrayAlpha) { postProcess |= POST_EXP_MASK; outputBands = 4; } else { outputBands = 2; } } break; case PNG_COLOR_RGB_ALPHA: inputBands = 4; bytesPerPixel *= 4; outputBands = (!suppressAlpha) ? 4 : 3; if (suppressAlpha) { postProcess = POST_REMOVE_RGB_TRANS; } else if (performGammaCorrection) { postProcess = POST_GAMMA; } else { postProcess = POST_NONE; } break; } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_hIST_chunk(PNGChunk chunk) { if (redPalette == null) { String msg = PropertyUtil.getString("PNGImageDecoder18"); throw new RuntimeException(msg); } int length = redPalette.length; int[] hist = new int[length]; for (int i = 0; i < length; i++) { hist[i] = chunk.getInt2(2*i); } if (encodeParam != null) { encodeParam.setPaletteHistogram(hist); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_pHYs_chunk(PNGChunk chunk) { int xPixelsPerUnit = chunk.getInt4(0); int yPixelsPerUnit = chunk.getInt4(4); int unitSpecifier = chunk.getInt1(8); if (encodeParam != null) { encodeParam.setPhysicalDimension(xPixelsPerUnit, yPixelsPerUnit, unitSpecifier); } if (emitProperties) { properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit)); properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit)); properties.put("pixel_aspect_ratio", new Float((float)xPixelsPerUnit/yPixelsPerUnit)); if (unitSpecifier == 1) { properties.put("pixel_units", "Meters"); } else if (unitSpecifier != 0) { // Error -- unit specifier must be 0 or 1 String msg = PropertyUtil.getString("PNGImageDecoder12"); throw new RuntimeException(msg); } } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_sBIT_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { significantBits = new int[3]; } else { significantBits = new int[inputBands]; } for (int i = 0; i < significantBits.length; i++) { int bits = chunk.getByte(i); int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth; if (bits <= 0 || bits > depth) { // Error -- significant bits must be between 0 and // image bit depth. String msg = PropertyUtil.getString("PNGImageDecoder13"); throw new RuntimeException(msg); } significantBits[i] = bits; } if (encodeParam != null) { encodeParam.setSignificantBits(significantBits); } if (emitProperties) { properties.put("significant_bits", significantBits); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { // Error -- mustn't have more alpha than RGB palette entries String msg = PropertyUtil.getString("PNGImageDecoder14"); throw new RuntimeException(msg); } // Load beginning of palette from the chunk alphaPalette = new byte[paletteEntries]; for (int i = 0; i < entries; i++) { alphaPalette[i] = chunk.getByte(i); } // Fill rest of palette with 255 for (int i = entries; i < paletteEntries; i++) { alphaPalette[i] = (byte)255; } if (!suppressAlpha) { if (expandPalette) { postProcess = POST_PALETTE_TO_RGBA; outputBands = 4; } else { outputHasAlphaPalette = true; } } } else if (colorType == PNG_COLOR_GRAY) { grayTransparentAlpha = chunk.getInt2(0); if (!suppressAlpha) { if (bitDepth < 8) { output8BitGray = true; maxOpacity = 255; postProcess = POST_GRAY_LUT_ADD_TRANS; } else { postProcess = POST_ADD_GRAY_TRANS; } if (expandGrayAlpha) { outputBands = 4; postProcess |= POST_EXP_MASK; } else { outputBands = 2; } if (encodeParam != null) { ((PNGEncodeParam.Gray)encodeParam). setTransparentGray(grayTransparentAlpha); } } } else if (colorType == PNG_COLOR_RGB) { redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4); if (!suppressAlpha) { outputBands = 4; postProcess = POST_ADD_RGB_TRANS; if (encodeParam != null) { int[] rgbTrans = new int[3]; rgbTrans[0] = redTransparentAlpha; rgbTrans[1] = greenTransparentAlpha; rgbTrans[2] = blueTransparentAlpha; ((PNGEncodeParam.RGB)encodeParam). setTransparentRGB(rgbTrans); } } } else if (colorType == PNG_COLOR_GRAY_ALPHA || colorType == PNG_COLOR_RGB_ALPHA) { // Error -- GA or RGBA image can't have a tRNS chunk. String msg = PropertyUtil.getString("PNGImageDecoder15"); throw new RuntimeException(msg); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
private void decodePass(WritableRaster imRas, int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) { if ((passWidth == 0) || (passHeight == 0)) { return; } int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; byte[] curr = new byte[bytesPerRow]; byte[] prior = new byte[bytesPerRow]; // Create a 1-row tall Raster to hold the data WritableRaster passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, bitDepth); DataBuffer dataBuffer = passRow.getDataBuffer(); int type = dataBuffer.getDataType(); byte[] byteData = null; short[] shortData = null; if (type == DataBuffer.TYPE_BYTE) { byteData = ((DataBufferByte)dataBuffer).getData(); } else { shortData = ((DataBufferUShort)dataBuffer).getData(); } // Decode the (sub)image row-by-row int srcY, dstY; for (srcY = 0, dstY = yOffset; srcY < passHeight; srcY++, dstY += yStep) { // Read the filter type byte and a row of data int filter = 0; try { filter = dataStream.read(); dataStream.readFully(curr, 0, bytesPerRow); } catch (Exception e) { e.printStackTrace(); } switch (filter) { case PNG_FILTER_NONE: break; case PNG_FILTER_SUB: decodeSubFilter(curr, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_UP: decodeUpFilter(curr, prior, bytesPerRow); break; case PNG_FILTER_AVERAGE: decodeAverageFilter(curr, prior, bytesPerRow, bytesPerPixel); break; case PNG_FILTER_PAETH: decodePaethFilter(curr, prior, bytesPerRow, bytesPerPixel); break; default: // Error -- unknown filter type String msg = PropertyUtil.getString("PNGImageDecoder16"); throw new RuntimeException(msg); } // Copy data into passRow byte by byte if (bitDepth < 16) { System.arraycopy(curr, 0, byteData, 0, bytesPerRow); } else { int idx = 0; for (int j = 0; j < eltsPerRow; j++) { shortData[j] = (short)((curr[idx] << 8) | (curr[idx + 1] & 0xff)); idx += 2; } } processPixels(postProcess, passRow, imRas, xOffset, xStep, dstY, passWidth); // Swap curr and prior byte[] tmp = prior; prior = curr; curr = tmp; } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayError(String message) { try { SVGAbstractTranscoder.this.handler.error (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayError(Exception e) { try { e.printStackTrace(); SVGAbstractTranscoder.this.handler.error (new TranscoderException(e)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void displayMessage(String message) { try { SVGAbstractTranscoder.this.handler.warning (new TranscoderException(message)); } catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/dom/AbstractStylableDocument.java
public StyleSheetList getStyleSheets() { throw new RuntimeException(" !!! Not implemented"); }
// in sources/org/apache/batik/dom/AbstractStylableDocument.java
public CSSStyleDeclaration getOverrideStyle(Element elt, String pseudoElt) { throw new RuntimeException(" !!! Not implemented"); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, InputStream is) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, is); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public Document createDocument(String ns, String root, String uri, Reader r) throws IOException { if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(ns) || !"svg".equals(root)) { throw new RuntimeException("Bad root element"); } return createDocument(uri, r); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public DOMImplementation getDOMImplementation(String ver) { if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
public String printNode(Node n) { try { Writer writer = new StringWriter(); DOMUtilities.writeNode(n, writer); writer.close(); return writer.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } }
// in sources/org/apache/batik/bridge/svg12/AbstractContentSelector.java
public static AbstractContentSelector createSelector (String selectorLanguage, ContentManager cm, XBLOMContentElement content, Element bound, String selector) { ContentSelectorFactory f = (ContentSelectorFactory) selectorFactories.get(selectorLanguage); if (f == null) { throw new RuntimeException ("Invalid XBL content selector language '" + selectorLanguage + "'"); } return f.createSelector(cm, content, bound, selector); }
// in sources/org/apache/batik/bridge/BridgeContext.java
public Interpreter getInterpreter(String language) { if (document == null) { throw new RuntimeException("Unknown document"); } Interpreter interpreter = (Interpreter)interpreterMap.get(language); if (interpreter == null) { try { interpreter = interpreterPool.createInterpreter(document, language, null); String[] mimeTypes = interpreter.getMimeTypes(); for (int i = 0; i < mimeTypes.length; i++) { interpreterMap.put(mimeTypes[i], interpreter); } } catch (Exception e) { if (userAgent != null) { userAgent.displayError(e); return null; } } } if (interpreter == null) { if (userAgent != null) { userAgent.displayError(new Exception("Unknown language: " + language)); } } return interpreter; }
// in sources/org/apache/batik/util/ClassFileUtilities.java
public static Set getClassDependencies(InputStream is) throws IOException { DataInputStream dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) { throw new IOException("Invalid classfile"); } dis.readInt(); int len = dis.readShort(); String[] strs = new String[len]; Set classes = new HashSet(); Set desc = new HashSet(); for (int i = 1; i < len; i++) { int constCode = dis.readByte() & 0xff; switch ( constCode ) { case CONSTANT_LONG_INFO: case CONSTANT_DOUBLE_INFO: dis.readLong(); i++; break; case CONSTANT_FIELDREF_INFO: case CONSTANT_METHODREF_INFO: case CONSTANT_INTERFACEMETHODREF_INFO: case CONSTANT_INTEGER_INFO: case CONSTANT_FLOAT_INFO: dis.readInt(); break; case CONSTANT_CLASS_INFO: classes.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_STRING_INFO: dis.readShort(); break; case CONSTANT_NAMEANDTYPE_INFO: dis.readShort(); desc.add(new Integer(dis.readShort() & 0xffff)); break; case CONSTANT_UTF8_INFO: strs[i] = dis.readUTF(); break; default: throw new RuntimeException("unexpected data in constant-pool:" + constCode ); } } Set result = new HashSet(); Iterator it = classes.iterator(); while (it.hasNext()) { result.add(strs[((Integer)it.next()).intValue()]); } it = desc.iterator(); while (it.hasNext()) { result.addAll(getDescriptorClasses(strs[((Integer)it.next()).intValue()])); } return result; }
45
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { ite.printStackTrace(); throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InstantiationException ie) { throw new RuntimeException(ie.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (InvocationTargetException ite) { throw new RuntimeException(ite.getMessage()); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (IllegalAccessException iae) { throw new RuntimeException(iae.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch(DataFormatException dfe) { throw new RuntimeException("TIFFImage17"+": "+ dfe.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (IOException ioe) { throw new RuntimeException("TIFFImage13"); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFImage.java
catch (java.lang.ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("TIFFImage14"); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage()); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java
catch (IIOInvalidTreeException e) { throw new RuntimeException("Cannot update image metadata: " + e.getMessage(), e); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGImageDecoder.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder1"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
catch (Exception e) { e.printStackTrace(); String msg = PropertyUtil.getString("PNGImageDecoder2"); throw new RuntimeException(msg); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (IOException ex) { throw new RuntimeException(ex); }
0 13
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (RuntimeException re) { rex = re; }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
// in sources/org/apache/batik/bridge/BridgeEventSupport.java
catch (RuntimeException e) { ua.displayError(e); }
4
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jpython/JPythonInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (RuntimeException re) { throw new InterpreterException(re, re.getMessage(), -1, -1); }
4
unknown (Lib) SAXException 3
            
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public InputSource resolveEntity(String publicId, String systemId) throws SAXException { try { synchronized (LOCK) { // Bootstrap if needed - move to a static block??? if (dtdProps == null) { dtdProps = new Properties(); try { Class cls = SAXSVGDocumentFactory.class; InputStream is = cls.getResourceAsStream ("resources/dtdids.properties"); dtdProps.load(is); } catch (IOException ioe) { throw new SAXException(ioe); } } if (dtdids == null) dtdids = dtdProps.getProperty(KEY_PUBLIC_IDS); if (skippable_dtdids == null) skippable_dtdids = dtdProps.getProperty(KEY_SKIPPABLE_PUBLIC_IDS); if (skip_dtd == null) skip_dtd = dtdProps.getProperty(KEY_SKIP_DTD); } if (publicId == null) return null; // Let SAX Parser find it. if (!isValidating && (skippable_dtdids.indexOf(publicId) != -1)) { // We are not validating and this is a DTD we can // safely skip so do it... Here we provide just enough // of the DTD to keep stuff running (set svg and // xlink namespaces). return new InputSource(new StringReader(skip_dtd)); } if (dtdids.indexOf(publicId) != -1) { String localSystemId = dtdProps.getProperty(KEY_SYSTEM_ID + publicId.replace(' ', '_')); if (localSystemId != null && !"".equals(localSystemId)) { return new InputSource (getClass().getResource(localSystemId).toString()); } } } catch (MissingResourceException e) { throw new SAXException(e); } // Let the SAX parser find the entity. return null; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new SAXException(new InterruptedIOException()); } if (inProlog) { inProlog = false; if (parser != null) { try { isStandalone = parser.getFeature ("http://xml.org/sax/features/is-standalone"); } catch (SAXNotRecognizedException ex) { } try { xmlVersion = (String) parser.getProperty ("http://xml.org/sax/properties/document-xml-version"); } catch (SAXNotRecognizedException ex) { } } } // Namespaces resolution int len = attributes.getLength(); namespaces.push(); String version = null; for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); int slen = aname.length(); if (slen < 5) continue; if (aname.equals("version")) { version = attributes.getValue(i); continue; } if (!aname.startsWith("xmlns")) continue; if (slen == 5) { String ns = attributes.getValue(i); if (ns.length() == 0) ns = null; namespaces.put("", ns); } else if (aname.charAt(5) == ':') { String ns = attributes.getValue(i); if (ns.length() == 0) { ns = null; } namespaces.put(aname.substring(6), ns); } } // Add any collected String Data before element. appendStringData(); // Element creation Element e; int idx = rawName.indexOf(':'); String nsp = (idx == -1 || idx == rawName.length()-1) ? "" : rawName.substring(0, idx); String nsURI = namespaces.get(nsp); if (currentNode == null) { implementation = getDOMImplementation(version); document = implementation.createDocument(nsURI, rawName, doctype); Iterator i = preInfo.iterator(); currentNode = e = document.getDocumentElement(); while (i.hasNext()) { PreInfo pi = (PreInfo)i.next(); Node n = pi.createNode(document); document.insertBefore(n, e); } preInfo = null; } else { e = document.createElementNS(nsURI, rawName); currentNode.appendChild(e); currentNode = e; } // Storage of the line number. if (createDocumentDescriptor && locator != null) { documentDescriptor.setLocation(e, locator.getLineNumber(), locator.getColumnNumber()); } // Attributes creation for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); if (aname.equals("xmlns")) { e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, aname, attributes.getValue(i)); } else { idx = aname.indexOf(':'); nsURI = (idx == -1) ? null : namespaces.get(aname.substring(0, idx)); e.setAttributeNS(nsURI, aname, attributes.getValue(i)); } } }
2
            
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (IOException ioe) { throw new SAXException(ioe); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
catch (MissingResourceException e) { throw new SAXException(e); }
21
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
private Element parseXml(String xmlString) { Document doc = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { javax.xml.parsers.DocumentBuilder parser = factory .newDocumentBuilder(); parser.setErrorHandler(new ErrorHandler() { public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { } public void warning(SAXParseException exception) throws SAXException { } }); doc = parser.parse(new InputSource(new StringReader(xmlString))); } catch (ParserConfigurationException e1) { } catch (SAXException e1) { } catch (IOException e1) { } if (doc != null) { return doc.getDocumentElement(); } return null; }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void error(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void fatalError(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
public void warning(SAXParseException exception) throws SAXException { }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public void startDocument() throws SAXException { super.startDocument(); // Do not assume namespace declarations when no DTD has been specified. // namespaces.put("", SVGDOMImplementation.SVG_NAMESPACE_URI); // namespaces.put("xlink", XLinkSupport.XLINK_NAMESPACE_URI); }
// in sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
public InputSource resolveEntity(String publicId, String systemId) throws SAXException { try { synchronized (LOCK) { // Bootstrap if needed - move to a static block??? if (dtdProps == null) { dtdProps = new Properties(); try { Class cls = SAXSVGDocumentFactory.class; InputStream is = cls.getResourceAsStream ("resources/dtdids.properties"); dtdProps.load(is); } catch (IOException ioe) { throw new SAXException(ioe); } } if (dtdids == null) dtdids = dtdProps.getProperty(KEY_PUBLIC_IDS); if (skippable_dtdids == null) skippable_dtdids = dtdProps.getProperty(KEY_SKIPPABLE_PUBLIC_IDS); if (skip_dtd == null) skip_dtd = dtdProps.getProperty(KEY_SKIP_DTD); } if (publicId == null) return null; // Let SAX Parser find it. if (!isValidating && (skippable_dtdids.indexOf(publicId) != -1)) { // We are not validating and this is a DTD we can // safely skip so do it... Here we provide just enough // of the DTD to keep stuff running (set svg and // xlink namespaces). return new InputSource(new StringReader(skip_dtd)); } if (dtdids.indexOf(publicId) != -1) { String localSystemId = dtdProps.getProperty(KEY_SYSTEM_ID + publicId.replace(' ', '_')); if (localSystemId != null && !"".equals(localSystemId)) { return new InputSource (getClass().getResource(localSystemId).toString()); } } } catch (MissingResourceException e) { throw new SAXException(e); } // Let the SAX parser find the entity. return null; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void fatalError(SAXParseException ex) throws SAXException { throw ex; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void error(SAXParseException ex) throws SAXException { throw ex; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void warning(SAXParseException ex) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startDocument() throws SAXException { preInfo = new LinkedList(); namespaces = new HashTableStack(); namespaces.put("xml", XMLSupport.XML_NAMESPACE_URI); namespaces.put("xmlns", XMLSupport.XMLNS_NAMESPACE_URI); namespaces.put("", null); inDTD = false; inCDATA = false; inProlog = true; currentNode = null; document = null; doctype = null; isStandalone = false; xmlVersion = XMLConstants.XML_VERSION_10; stringBuffer.setLength(0); stringContent = false; if (createDocumentDescriptor) { documentDescriptor = new DocumentDescriptor(); } else { documentDescriptor = null; } }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException { // Check If we should halt early. if (HaltingThread.hasBeenHalted()) { throw new SAXException(new InterruptedIOException()); } if (inProlog) { inProlog = false; if (parser != null) { try { isStandalone = parser.getFeature ("http://xml.org/sax/features/is-standalone"); } catch (SAXNotRecognizedException ex) { } try { xmlVersion = (String) parser.getProperty ("http://xml.org/sax/properties/document-xml-version"); } catch (SAXNotRecognizedException ex) { } } } // Namespaces resolution int len = attributes.getLength(); namespaces.push(); String version = null; for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); int slen = aname.length(); if (slen < 5) continue; if (aname.equals("version")) { version = attributes.getValue(i); continue; } if (!aname.startsWith("xmlns")) continue; if (slen == 5) { String ns = attributes.getValue(i); if (ns.length() == 0) ns = null; namespaces.put("", ns); } else if (aname.charAt(5) == ':') { String ns = attributes.getValue(i); if (ns.length() == 0) { ns = null; } namespaces.put(aname.substring(6), ns); } } // Add any collected String Data before element. appendStringData(); // Element creation Element e; int idx = rawName.indexOf(':'); String nsp = (idx == -1 || idx == rawName.length()-1) ? "" : rawName.substring(0, idx); String nsURI = namespaces.get(nsp); if (currentNode == null) { implementation = getDOMImplementation(version); document = implementation.createDocument(nsURI, rawName, doctype); Iterator i = preInfo.iterator(); currentNode = e = document.getDocumentElement(); while (i.hasNext()) { PreInfo pi = (PreInfo)i.next(); Node n = pi.createNode(document); document.insertBefore(n, e); } preInfo = null; } else { e = document.createElementNS(nsURI, rawName); currentNode.appendChild(e); currentNode = e; } // Storage of the line number. if (createDocumentDescriptor && locator != null) { documentDescriptor.setLocation(e, locator.getLineNumber(), locator.getColumnNumber()); } // Attributes creation for (int i = 0; i < len; i++) { String aname = attributes.getQName(i); if (aname.equals("xmlns")) { e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, aname, attributes.getValue(i)); } else { idx = aname.indexOf(':'); nsURI = (idx == -1) ? null : namespaces.get(aname.substring(0, idx)); e.setAttributeNS(nsURI, aname, attributes.getValue(i)); } } }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endElement(String uri, String localName, String rawName) throws SAXException { appendStringData(); // add string data if any. if (currentNode != null) currentNode = currentNode.getParentNode(); namespaces.pop(); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void characters(char[] ch, int start, int length) throws SAXException { stringBuffer.append(ch, start, length); stringContent = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { stringBuffer.append(ch, start, length); stringContent = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void processingInstruction(String target, String data) throws SAXException { if (inDTD) return; appendStringData(); // Add any collected String Data before PI if (currentNode == null) preInfo.add(new ProcessingInstructionInfo(target, data)); else currentNode.appendChild (document.createProcessingInstruction(target, data)); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startDTD(String name, String publicId, String systemId) throws SAXException { appendStringData(); // Add collected string data before entering DTD doctype = implementation.createDocumentType(name, publicId, systemId); inDTD = true; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endDTD() throws SAXException { inDTD = false; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startEntity(String name) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endEntity(String name) throws SAXException { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void startCDATA() throws SAXException { appendStringData(); // Add any collected String Data before CData inCDATA = true; stringContent = true; // always create CDATA even if empty. }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void endCDATA() throws SAXException { appendStringData(); // Add the CDATA section inCDATA = false; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public void comment(char[] ch, int start, int length) throws SAXException { if (inDTD) return; appendStringData(); String str = new String(ch, start, length); if (currentNode == null) { preInfo.add(new CommentInfo(str)); } else { currentNode.appendChild(document.createComment(str)); } }
3
            
// in sources/org/apache/batik/apps/svgbrowser/NodePickerPanel.java
catch (SAXException e1) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
4
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
0
checked (Domain) SAXIOException
public class SAXIOException extends IOException {

    protected SAXException saxe;

    public SAXIOException( SAXException saxe) {
        super(saxe.getMessage());
        this.saxe = saxe;
    }

    public SAXException getSAXException() { return saxe; }
    public Throwable    getCause() { return saxe; }
}
2
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
public Document createDocument(String ns, String root, String uri, XMLReader r) throws IOException { r.setContentHandler(this); r.setDTDHandler(this); r.setEntityResolver(this); try { r.parse(uri); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; return ret; }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
protected Document createDocument(InputSource is) throws IOException { try { if (parserClassName != null) { parser = XMLReaderFactory.createXMLReader(parserClassName); } else { SAXParser saxParser; try { saxParser = saxFactory.newSAXParser(); } catch (ParserConfigurationException pce) { throw new IOException("Could not create SAXParser: " + pce.getMessage()); } parser = saxParser.getXMLReader(); } parser.setContentHandler(this); parser.setDTDHandler(this); parser.setEntityResolver(this); parser.setErrorHandler((errorHandler == null) ? this : errorHandler); parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", isValidating); parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); parser.parse(is); } catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); } currentNode = null; Document ret = document; document = null; doctype = null; locator = null; parser = null; return ret; }
2
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException) ex; } throw new SAXIOException(e); }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXException e) { Exception ex = e.getException(); if (ex != null && ex instanceof InterruptedIOException) { throw (InterruptedIOException)ex; } throw new SAXIOException(e); }
0 0 0 0
unknown (Lib) SAXNotRecognizedException 0 0 0 2
            
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXNotRecognizedException ex) { }
// in sources/org/apache/batik/dom/util/SAXDocumentFactory.java
catch (SAXNotRecognizedException ex) { }
0 0
checked (Domain) SVGConverterException
public class SVGConverterException extends Exception {
    /**
     * Error code
     */
    protected String errorCode;

    /**
     * Additional information about the error condition
     */
    protected Object[] errorInfo;

    /**
     * Defines whether or not this is a fatal error condition
     */
    protected boolean isFatal;

    public SVGConverterException(String errorCode){
        this(errorCode, null, false);
    }

    public SVGConverterException(String errorCode, 
                                  Object[] errorInfo){
        this(errorCode, errorInfo, false);
    }

    public SVGConverterException(String errorCode,
                                  Object[] errorInfo,
                                  boolean isFatal){
        this.errorCode = errorCode;
        this.errorInfo = errorInfo;
        this.isFatal = isFatal;
    }

    public SVGConverterException(String errorCode,
                                  boolean isFatal){
        this(errorCode, null, isFatal);
    }

    public boolean isFatal(){
        return isFatal;
    }

    public String getMessage(){
        return Messages.formatMessage(errorCode, errorInfo);
    }

    public String getErrorCode(){
        return errorCode;
    }
}
12
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void execute() throws SVGConverterException { // Compute the set of SVGConverterSource from the source properties // (srcDir and srcFile); // This throws an exception if there is not at least one src file. List sources = computeSources(); // Compute the destination files from dest List dstFiles = null; if(sources.size() == 1 && dst != null && isFile(dst)){ dstFiles = new ArrayList(); dstFiles.add(dst); } else{ dstFiles = computeDstFiles(sources); } // Now, get the transcoder to use for the operation Transcoder transcoder = destinationType.getTranscoder(); if(transcoder == null) { throw new SVGConverterException(ERROR_CANNOT_ACCESS_TRANSCODER, new Object[]{destinationType.toString()}, true /* fatal error */); } // Now, compute the set of transcoding hints to use Map hints = computeTranscodingHints(); transcoder.setTranscodingHints(hints); // Notify listener that task has been computed if(!controller.proceedWithComputedTask(transcoder, hints, sources, dstFiles)){ return; } // Convert files one by one for(int i = 0 ; i < sources.size() ; i++) { // Get the file from the vector. SVGConverterSource currentFile = (SVGConverterSource)sources.get(i); File outputFile = (File)dstFiles.get(i); createOutputDir(outputFile); transcode(currentFile, outputFile, transcoder); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeDstFiles(List sources) throws SVGConverterException { List dstFiles = new ArrayList(); if (dst != null) { if (dst.exists() && dst.isFile()) { throw new SVGConverterException(ERROR_CANNOT_USE_DST_FILE); } // // Either dst exist and is a directory or dst does not // exist and we may fail later on in createOutputDir // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); // Generate output filename from input filename. File outputName = new File(dst.getPath(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } else { // // No destination directory has been specified. // Try and create files in the same directory as the // sources. This only work if sources are files. // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); if (!(src instanceof SVGConverterFileSource)) { throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION, new Object[]{src}); } // Generate output filename from input filename. SVGConverterFileSource fs = (SVGConverterFileSource)src; File outputName = new File(fs.getFile().getParent(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } return dstFiles; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeSources() throws SVGConverterException{ List sources = new ArrayList(); // Check that at least one source has been specified. if (this.sources == null){ throw new SVGConverterException(ERROR_NO_SOURCES_SPECIFIED); } int n = this.sources.size(); for (int i=0; i<n; i++){ String sourceString = (String)(this.sources.get(i)); File file = new File(sourceString); if (file.exists()) { sources.add(new SVGConverterFileSource(file)); } else { String[] fileNRef = getFileNRef(sourceString); file = new File(fileNRef[0]); if (file.exists()){ sources.add(new SVGConverterFileSource(file, fileNRef[1])); } else{ sources.add(new SVGConverterURLSource(sourceString)); } } } return sources; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void transcode(SVGConverterSource inputFile, File outputFile, Transcoder transcoder) throws SVGConverterException { TranscoderInput input = null; TranscoderOutput output = null; OutputStream outputStream = null; if (!controller.proceedWithSourceTranscoding(inputFile, outputFile)){ return; } try { if (inputFile.isSameAs(outputFile.getPath())) { throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION, true /* fatal error */); } // Compute transcoder input. if (!inputFile.isReadable()) { throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE, new Object[]{inputFile.getName()}); } try { InputStream in = inputFile.openStream(); in.close(); } catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); } input = new TranscoderInput(inputFile.getURI()); // Compute transcoder output. if (!isWriteable(outputFile)) { throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE, new Object[] {outputFile.getName()}); } try { outputStream = new FileOutputStream(outputFile); } catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); } output = new TranscoderOutput(outputStream); } catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } } // Transcode now boolean success = false; try { transcoder.transcode(input, output); success = true; } catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } } // Close streams and clean up. try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) { return; } if (success){ controller.onSourceTranscodingSuccess(inputFile, outputFile); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void createOutputDir(File output) throws SVGConverterException { File outputDir; // Output directory object. boolean success = true; // false if the output directory // doesn't exist and it can't be created // true otherwise // Create object from output directory. String parentDir = output.getParent(); if (parentDir != null){ outputDir = new File(output.getParent()); if ( ! outputDir.exists() ) { // Output directory doesn't exist, so create it. success = outputDir.mkdirs(); } else { if ( ! outputDir.isDirectory() ) { // File, which have a same name as the output directory, exists. // Create output directory. success = outputDir.mkdirs(); } } } if (!success) { throw new SVGConverterException(ERROR_UNABLE_TO_CREATE_OUTPUT_DIR); } }
3
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } }
6
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
public void execute() throws SVGConverterException { // Compute the set of SVGConverterSource from the source properties // (srcDir and srcFile); // This throws an exception if there is not at least one src file. List sources = computeSources(); // Compute the destination files from dest List dstFiles = null; if(sources.size() == 1 && dst != null && isFile(dst)){ dstFiles = new ArrayList(); dstFiles.add(dst); } else{ dstFiles = computeDstFiles(sources); } // Now, get the transcoder to use for the operation Transcoder transcoder = destinationType.getTranscoder(); if(transcoder == null) { throw new SVGConverterException(ERROR_CANNOT_ACCESS_TRANSCODER, new Object[]{destinationType.toString()}, true /* fatal error */); } // Now, compute the set of transcoding hints to use Map hints = computeTranscodingHints(); transcoder.setTranscodingHints(hints); // Notify listener that task has been computed if(!controller.proceedWithComputedTask(transcoder, hints, sources, dstFiles)){ return; } // Convert files one by one for(int i = 0 ; i < sources.size() ; i++) { // Get the file from the vector. SVGConverterSource currentFile = (SVGConverterSource)sources.get(i); File outputFile = (File)dstFiles.get(i); createOutputDir(outputFile); transcode(currentFile, outputFile, transcoder); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeDstFiles(List sources) throws SVGConverterException { List dstFiles = new ArrayList(); if (dst != null) { if (dst.exists() && dst.isFile()) { throw new SVGConverterException(ERROR_CANNOT_USE_DST_FILE); } // // Either dst exist and is a directory or dst does not // exist and we may fail later on in createOutputDir // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); // Generate output filename from input filename. File outputName = new File(dst.getPath(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } else { // // No destination directory has been specified. // Try and create files in the same directory as the // sources. This only work if sources are files. // int n = sources.size(); for(int i=0; i<n; i++){ SVGConverterSource src = (SVGConverterSource)sources.get(i); if (!(src instanceof SVGConverterFileSource)) { throw new SVGConverterException(ERROR_CANNOT_COMPUTE_DESTINATION, new Object[]{src}); } // Generate output filename from input filename. SVGConverterFileSource fs = (SVGConverterFileSource)src; File outputName = new File(fs.getFile().getParent(), getDestinationFile(src.getName())); dstFiles.add(outputName); } } return dstFiles; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected List computeSources() throws SVGConverterException{ List sources = new ArrayList(); // Check that at least one source has been specified. if (this.sources == null){ throw new SVGConverterException(ERROR_NO_SOURCES_SPECIFIED); } int n = this.sources.size(); for (int i=0; i<n; i++){ String sourceString = (String)(this.sources.get(i)); File file = new File(sourceString); if (file.exists()) { sources.add(new SVGConverterFileSource(file)); } else { String[] fileNRef = getFileNRef(sourceString); file = new File(fileNRef[0]); if (file.exists()){ sources.add(new SVGConverterFileSource(file, fileNRef[1])); } else{ sources.add(new SVGConverterURLSource(sourceString)); } } } return sources; }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void transcode(SVGConverterSource inputFile, File outputFile, Transcoder transcoder) throws SVGConverterException { TranscoderInput input = null; TranscoderOutput output = null; OutputStream outputStream = null; if (!controller.proceedWithSourceTranscoding(inputFile, outputFile)){ return; } try { if (inputFile.isSameAs(outputFile.getPath())) { throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION, true /* fatal error */); } // Compute transcoder input. if (!inputFile.isReadable()) { throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE, new Object[]{inputFile.getName()}); } try { InputStream in = inputFile.openStream(); in.close(); } catch(IOException ioe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE, new Object[] {inputFile.getName(), ioe.toString()}); } input = new TranscoderInput(inputFile.getURI()); // Compute transcoder output. if (!isWriteable(outputFile)) { throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE, new Object[] {outputFile.getName()}); } try { outputStream = new FileOutputStream(outputFile); } catch(FileNotFoundException fnfe) { throw new SVGConverterException(ERROR_CANNOT_OPEN_OUTPUT_FILE, new Object[] {outputFile.getName()}); } output = new TranscoderOutput(outputStream); } catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } } // Transcode now boolean success = false; try { transcoder.transcode(input, output); success = true; } catch(Exception te) { te.printStackTrace(); try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) {} // Report error to the controller. If controller decides // to stop, throw an exception boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, ERROR_WHILE_RASTERIZING_FILE); if (!proceed){ throw new SVGConverterException(ERROR_WHILE_RASTERIZING_FILE, new Object[] {outputFile.getName(), te.getMessage()}); } } // Close streams and clean up. try { outputStream.flush(); outputStream.close(); } catch(IOException ioe) { return; } if (success){ controller.onSourceTranscodingSuccess(inputFile, outputFile); } }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
protected void createOutputDir(File output) throws SVGConverterException { File outputDir; // Output directory object. boolean success = true; // false if the output directory // doesn't exist and it can't be created // true otherwise // Create object from output directory. String parentDir = output.getParent(); if (parentDir != null){ outputDir = new File(output.getParent()); if ( ! outputDir.exists() ) { // Output directory doesn't exist, so create it. success = outputDir.mkdirs(); } else { if ( ! outputDir.isDirectory() ) { // File, which have a same name as the output directory, exists. // Create output directory. success = outputDir.mkdirs(); } } } if (!success) { throw new SVGConverterException(ERROR_UNABLE_TO_CREATE_OUTPUT_DIR); } }
2
            
// in sources/org/apache/batik/apps/rasterizer/Main.java
catch(SVGConverterException e){ error(ERROR_WHILE_CONVERTING_FILES, new Object[] { e.getMessage() }); }
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
1
            
// in sources/org/apache/batik/apps/rasterizer/SVGConverter.java
catch(SVGConverterException e){ boolean proceed = controller.proceedOnSourceTranscodingFailure (inputFile, outputFile, e.getErrorCode()); if (proceed){ return; } else { throw e; } }
0
checked (Domain) SVGGraphics2DIOException
public class SVGGraphics2DIOException extends IOException {
    /** The enclosed exception. */
    private IOException embedded;

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     */
    public SVGGraphics2DIOException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param ex the enclosed exception
     */
    public SVGGraphics2DIOException(IOException ex) {
        this(null, ex);
    }

    /**
     * Constructs a new <code>SVGGraphics2DIOException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public SVGGraphics2DIOException(String s, IOException ex) {
        super(s);
        embedded = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public IOException getException() {
        return embedded;
    }
}
9
            
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try{ OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); } finally { os.close(); } } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try { OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } finally { os.close(); } } catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Setup Base64Encoder stream to byte array. // ByteArrayOutputStream os = new ByteArrayOutputStream(); Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { // // Now, encode the input image to the base 64 stream. // encodeImage(image, b64Encoder); // Close the b64 encoder stream (terminates the b64 streams). b64Encoder.close(); } catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // // Finally, write out url // imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, DATA_PROTOCOL_PNG_PREFIX + os.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void encodeImage(RenderedImage buf, OutputStream os) throws SVGGraphics2DIOException { try{ ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
boolean imagesMatch(Object o1, Object o2) throws SVGGraphics2DIOException { boolean match = false; try { FileInputStream imageStream = new FileInputStream((File) o1); int imageLen = imageStream.available(); byte[] imageBytes = new byte[imageLen]; byte[] candidateBytes = ((ByteArrayOutputStream) o2).toByteArray(); int bytesRead = 0; while (bytesRead != imageLen) { bytesRead += imageStream.read (imageBytes, bytesRead, imageLen-bytesRead); } match = Arrays.equals(imageBytes, candidateBytes); } catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); } return match; }
// in sources/org/apache/batik/svggen/ImageCacher.java
ImageCacheEntry createEntry(int checksum, Object data, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // Create a new file in image directory File imageFile = null; try { // While the files we are generating exist, try to create // another unique id. while (imageFile == null) { String fileId = ctx.idGenerator.generateID(prefix); imageFile = new File(imageDir, fileId + suffix); if (imageFile.exists()) imageFile = null; } // Write data to file OutputStream outputStream = new FileOutputStream(imageFile); ((ByteArrayOutputStream) data).writeTo(outputStream); ((ByteArrayOutputStream) data).close(); } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } // Create new cache entry return new ImageCacheEntry(checksum, imageFile, imageFile.getName()); // <<<<<<<<<< error ?? }
9
            
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (IOException io) { throw new SVGGraphics2DIOException(io); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); }
// in sources/org/apache/batik/svggen/ImageCacher.java
catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (MalformedURLException e) { throw new SVGGraphics2DIOException(ERR_CANNOT_USE_IMAGE_DIR+ e.getMessage(), e); }
38
            
// in sources/org/apache/batik/svggen/ImageHandlerJPEGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try{ OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(1, false); writer.writeImage(buf, os, params); } finally { os.close(); } } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/DefaultErrorHandler.java
public void handleError(SVGGraphics2DIOException ex) throws SVGGraphics2DIOException { throw ex; }
// in sources/org/apache/batik/svggen/ImageHandlerPNGEncoder.java
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try { OutputStream os = new FileOutputStream(imageFile); try { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } finally { os.close(); } } catch (IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Simply write a placeholder imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, image.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = buf.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); } RenderedImage r = image.createDefaultRendering(); if (r == null) { handleEmptyImage(imageElement); } else { handleHREF(r, imageElement, generatorContext); } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Setup Base64Encoder stream to byte array. // ByteArrayOutputStream os = new ByteArrayOutputStream(); Base64EncoderStream b64Encoder = new Base64EncoderStream(os); try { // // Now, encode the input image to the base 64 stream. // encodeImage(image, b64Encoder); // Close the b64 encoder stream (terminates the b64 streams). b64Encoder.close(); } catch (IOException e) { // Should not happen because we are doing in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // // Finally, write out url // imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, DATA_PROTOCOL_PNG_PREFIX + os.toString()); }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void encodeImage(RenderedImage buf, OutputStream os) throws SVGGraphics2DIOException { try{ ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); } catch(IOException e) { // We are doing in-memory processing. This should not happen. throw new SVGGraphics2DIOException(ERR_UNEXPECTED); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(String svgFileName) throws SVGGraphics2DIOException { stream(svgFileName, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(String svgFileName, boolean useCss) throws SVGGraphics2DIOException { try { OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(svgFileName), DEFAULT_XML_ENCODING); stream(writer, useCss); writer.flush(); writer.close(); } catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; } catch (IOException e) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(e)); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer) throws SVGGraphics2DIOException { stream(writer, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer, boolean useCss, boolean escaped) throws SVGGraphics2DIOException { Element svgRoot = getRoot(); stream(svgRoot, writer, useCss, escaped); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Writer writer, boolean useCss) throws SVGGraphics2DIOException { Element svgRoot = getRoot(); stream(svgRoot, writer, useCss, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Element svgRoot, Writer writer) throws SVGGraphics2DIOException { stream(svgRoot, writer, false, false); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void stream(Element svgRoot, Writer writer, boolean useCss, boolean escaped) throws SVGGraphics2DIOException { Node rootParent = svgRoot.getParentNode(); Node nextSibling = svgRoot.getNextSibling(); try { // // Enforce that the default and xlink namespace // declarations appear on the root element // svgRoot.setAttributeNS(XMLNS_NAMESPACE_URI, XMLNS_PREFIX, SVG_NAMESPACE_URI); svgRoot.setAttributeNS(XMLNS_NAMESPACE_URI, XMLNS_PREFIX + ":" + XLINK_PREFIX, XLINK_NAMESPACE_URI); DocumentFragment svgDocument = svgRoot.getOwnerDocument().createDocumentFragment(); svgDocument.appendChild(svgRoot); if (useCss) SVGCSSStyler.style(svgDocument); XmlWriter.writeXml(svgDocument, writer, escaped); writer.flush(); } catch (SVGGraphics2DIOException e) { // this catch prevents from catching an SVGGraphics2DIOException // and wrapping it again in another SVGGraphics2DIOException // as would do the second catch (XmlWriter throws SVGGraphics2DIO // Exception but flush throws IOException) generatorCtx.errorHandler. handleError(e); } catch (IOException io) { generatorCtx.errorHandler. handleError(new SVGGraphics2DIOException(io)); } finally { // Restore the svgRoot to its original tree position if (rootParent != null) { if (nextSibling == null) { rootParent.appendChild(svgRoot); } else { rootParent.insertBefore(svgRoot, nextSibling); } } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = buildBufferedImage(new Dimension(width, height)); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // // Create an buffered image if necessary // BufferedImage buf = null; if (image instanceof BufferedImage && ((BufferedImage)image).getType() == getBufferedImageType()){ buf = (BufferedImage)image; } else { Dimension size = new Dimension(image.getWidth(), image.getHeight()); buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderedImage(image, IDENTITY); g.dispose(); } // // Cache image and set xlink:href // cacheBufferedImage(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension((int)Math.ceil(image.getWidth()), (int)Math.ceil(image.getHeight())); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderableImage(image, IDENTITY); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { out.write (TAG_START, 0, 1); // "<" out.write (element.getTagName()); NamedNodeMap attributes = element.getAttributes(); if (attributes != null){ int nAttr = attributes.getLength(); for(int i=0; i<nAttr; i++){ Attr attr = (Attr)attributes.item(i); out.write(' '); writeXml(attr, out, escaped); } } boolean lastElem = (element.getParentNode().getLastChild()==element); // // Write empty nodes as "<EMPTY />" to make sure version 3 // and 4 web browsers can read empty tag output as HTML. // XML allows "<EMPTY/>" too, of course. // if (!element.hasChildNodes()) { if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write(TAG_END, 0, 2); // "/>" return; } Node child = element.getFirstChild(); out.printIndent (); out.write(TAG_END, 1, 1); // ">" if ((child.getNodeType() != Node.TEXT_NODE) || (element.getLastChild() != child)) { // one text node child.. out.setIndentLevel(out.getIndentLevel()+2); } writeChildrenXml(element, out, escaped); out.write (TAG_START, 0, 2); // "</" out.write (element.getTagName()); if (lastElem) out.setIndentLevel(out.getIndentLevel()-2); out.printIndent (); out.write (TAG_END, 1, 1); // ">" }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeChildrenXml(Element element, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { Node child = element.getFirstChild(); while (child != null) { writeXml(child, out, escaped); child = child.getNextSibling(); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(Document document, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { writeDocumentHeader(out); NodeList childList = document.getChildNodes(); writeXml(childList, out, escaped); }
// in sources/org/apache/batik/svggen/XmlWriter.java
private static void writeXml(NodeList childList, IndentWriter out, boolean escaped) throws IOException, SVGGraphics2DIOException { int length = childList.getLength (); if (length == 0) return; for (int i = 0; i < length; i++) { Node child = childList.item(i); writeXml(child, out, escaped); out.write (EOL); } }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/ImageCacher.java
public String lookup(ByteArrayOutputStream os, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // We determine a checksum value for the byte data, and use it // as hash key for the image. This may not be unique, so we // need to check on actual byte-for-byte equality as well. // The checksum will be sufficient in most cases. int checksum = getChecksum(os.toByteArray()); Integer key = new Integer(checksum); String href = null; Object data = getCacheableData(os); LinkedList list = (LinkedList) imageCache.get(key); if(list == null) { // Key not found: make a new key/value pair list = new LinkedList(); imageCache.put(key, list); } else { // Key found: check if the image is already in the list for(ListIterator i = list.listIterator(0); i.hasNext(); ) { ImageCacheEntry entry = (ImageCacheEntry) i.next(); if(entry.checksum == checksum && imagesMatch(entry.src, data)) { href = entry.href; break; } } } if(href == null) { // Still no hit: add our own ImageCacheEntry newEntry = createEntry(checksum, data, width, height, ctx); list.add(newEntry); href = newEntry.href; } return href; }
// in sources/org/apache/batik/svggen/ImageCacher.java
boolean imagesMatch(Object o1, Object o2) throws SVGGraphics2DIOException { boolean match = false; try { FileInputStream imageStream = new FileInputStream((File) o1); int imageLen = imageStream.available(); byte[] imageBytes = new byte[imageLen]; byte[] candidateBytes = ((ByteArrayOutputStream) o2).toByteArray(); int bytesRead = 0; while (bytesRead != imageLen) { bytesRead += imageStream.read (imageBytes, bytesRead, imageLen-bytesRead); } match = Arrays.equals(imageBytes, candidateBytes); } catch(IOException e) { throw new SVGGraphics2DIOException( ERR_READ+((File) o1).getName()); } return match; }
// in sources/org/apache/batik/svggen/ImageCacher.java
ImageCacheEntry createEntry(int checksum, Object data, int width, int height, SVGGeneratorContext ctx) throws SVGGraphics2DIOException { // Create a new file in image directory File imageFile = null; try { // While the files we are generating exist, try to create // another unique id. while (imageFile == null) { String fileId = ctx.idGenerator.generateID(prefix); imageFile = new File(imageDir, fileId + suffix); if (imageFile.exists()) imageFile = null; } // Write data to file OutputStream outputStream = new FileOutputStream(imageFile); ((ByteArrayOutputStream) data).writeTo(outputStream); ((ByteArrayOutputStream) data).close(); } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } // Create new cache entry return new ImageCacheEntry(checksum, imageFile, imageFile.getName()); // <<<<<<<<<< error ?? }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension(image.getWidth(null), image.getHeight(null)); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension(image.getWidth(), image.getHeight()); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderedImage(image, IDENTITY); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
protected void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { // Create an buffered image where the image will be drawn Dimension size = new Dimension((int)Math.ceil(image.getWidth()), (int)Math.ceil(image.getHeight())); BufferedImage buf = buildBufferedImage(size); Graphics2D g = createGraphics(buf); g.drawRenderableImage(image, IDENTITY); g.dispose(); // Save image into file saveBufferedImageToFile(imageElement, buf, generatorContext); }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
private void saveBufferedImageToFile(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); // Create a new file in image directory File imageFile = null; // While the files we are generating exist, try to create another // id that is unique. while (imageFile == null) { String fileId = generatorContext.idGenerator.generateID(getPrefix()); imageFile = new File(imageDir, fileId + getSuffix()); if (imageFile.exists()) imageFile = null; } // Encode image here encodeImage(buf, imageFile); // Update HREF imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, urlRoot + "/" + imageFile.getName()); }
14
            
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException e) { // this catch prevents from catching an SVGGraphics2DIOException // and wrapping it again in another SVGGraphics2DIOException // as would do the second catch (XmlWriter throws SVGGraphics2DIO // Exception but flush throws IOException) generatorCtx.errorHandler. handleError(e); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
7
            
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch (SVGGraphics2DIOException io) { // this one as already been handled in stream(Writer, boolean) // method => rethrow it in all cases throw io; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
6
runtime (Domain) SVGGraphics2DRuntimeException
public class SVGGraphics2DRuntimeException extends RuntimeException {
    /** The enclosed exception. */
    private Exception embedded;

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     */
    public SVGGraphics2DRuntimeException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param ex the enclosed exception
     */
    public SVGGraphics2DRuntimeException(Exception ex) {
        this(null, ex);
    }

    /**
     * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
     * specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public SVGGraphics2DRuntimeException(String s, Exception ex) {
        super(s);
        embedded = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (msg != null) {
            return msg;
        } else if (embedded != null) {
            return embedded.getMessage();
        } else {
            return null;
        }
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public Exception getException() {
        return embedded;
    }
}
50
            
// in sources/org/apache/batik/svggen/DOMTreeManager.java
public void setTopLevelGroup(Element topLevelGroup){ if(topLevelGroup == null) throw new SVGGraphics2DRuntimeException(ERR_TOP_LEVEL_GROUP_NULL); if(!SVG_G_TAG.equalsIgnoreCase(topLevelGroup.getTagName())) throw new SVGGraphics2DRuntimeException(ERR_TOP_LEVEL_GROUP_NOT_G); recycleTopLevelGroup(false); this.topLevelGroup = topLevelGroup; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setIDGenerator(SVGIDGenerator idGenerator) { if (idGenerator == null) throw new SVGGraphics2DRuntimeException(ERR_ID_GENERATOR_NULL); this.idGenerator = idGenerator; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setDOMFactory(Document domFactory) { if (domFactory == null) throw new SVGGraphics2DRuntimeException(ERR_DOM_FACTORY_NULL); this.domFactory = domFactory; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setExtensionHandler(ExtensionHandler extensionHandler) { if (extensionHandler == null) throw new SVGGraphics2DRuntimeException(ERR_EXTENSION_HANDLER_NULL); this.extensionHandler = extensionHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setImageHandler(ImageHandler imageHandler) { if (imageHandler == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_HANDLER_NULL); this.imageHandler = imageHandler; this.genericImageHandler = new SimpleImageHandler(imageHandler); }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setGenericImageHandler(GenericImageHandler genericImageHandler){ if (genericImageHandler == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_HANDLER_NULL); } this.imageHandler = null; this.genericImageHandler = genericImageHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setStyleHandler(StyleHandler styleHandler) { if (styleHandler == null) throw new SVGGraphics2DRuntimeException(ERR_STYLE_HANDLER_NULL); this.styleHandler = styleHandler; }
// in sources/org/apache/batik/svggen/SVGGeneratorContext.java
public final void setErrorHandler(ErrorHandler errorHandler) { if (errorHandler == null) throw new SVGGraphics2DRuntimeException(ERR_ERROR_HANDLER_NULL); this.errorHandler = errorHandler; }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(Image image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth( null ) ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight( null ) ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
public void handleImage(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) { // // First, set the image width and height // imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) ); imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) ); // // Now, set the href // try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = buf.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/ImageHandlerBase64Encoder.java
public void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null){ throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); } RenderedImage r = image.createDefaultRendering(); if (r == null) { handleEmptyImage(imageElement); } else { handleHREF(r, imageElement, generatorContext); } }
// in sources/org/apache/batik/svggen/SVGLookupOp.java
private String[] convertLookupTables(LookupOp lookupOp){ LookupTable lookupTable = lookupOp.getTable(); int nComponents = lookupTable.getNumComponents(); if((nComponents != 1) && (nComponents != 3) && (nComponents != 4)) throw new SVGGraphics2DRuntimeException(ERR_ILLEGAL_BUFFERED_IMAGE_LOOKUP_OP); StringBuffer[] lookupTableBuf = new StringBuffer[nComponents]; for(int i=0; i<nComponents; i++) lookupTableBuf[i] = new StringBuffer(); if(!(lookupTable instanceof ByteLookupTable)){ int[] src = new int[nComponents]; int[] dest= new int[nComponents]; int offset = lookupTable.getOffset(); // Offsets are used for constrained sources. Therefore, // the lookup values should never be used under offset. // There is no SVG equivalent for this behavior. // These values are mapped to identity. for(int i=0; i<offset; i++){ // Fill in string buffers for(int j=0; j<nComponents; j++){ // lookupTableBuf[j].append(Integer.toString(i)); lookupTableBuf[j].append(doubleString(i/255.0)).append(SPACE); } } for(int i=offset; i<=255; i++){ // Fill in source array Arrays.fill( src, i ); // Get destination values lookupTable.lookupPixel(src, dest); // Fill in string buffers for(int j=0; j<nComponents; j++){ lookupTableBuf[j].append(doubleString( dest[j]/255.0) ).append(SPACE); } } } else{ byte[] src = new byte[nComponents]; byte[] dest = new byte[nComponents]; int offset = lookupTable.getOffset(); // Offsets are used for constrained sources. Therefore, // the lookup values should never be used under offset. // There is no SVG equivalent for this behavior. // These values are mapped to identity. for(int i=0; i<offset; i++){ // Fill in string buffers for(int j=0; j<nComponents; j++){ // lookupTableBuf[j].append(Integer.toString(i)); lookupTableBuf[j].append( doubleString(i/255.0) ).append(SPACE); } } for(int i=0; i<=255; i++){ // Fill in source array Arrays.fill( src, (byte)(0xff & i) ); // Get destination values ((ByteLookupTable)lookupTable).lookupPixel(src, dest); // Fill in string buffers for(int j=0; j<nComponents; j++){ lookupTableBuf[j].append( doubleString( (0xff & dest[j])/255.0) ).append(SPACE); } } } String[] lookupTables = new String[nComponents]; for(int i=0; i<nComponents; i++) lookupTables[i] = lookupTableBuf[i].toString().trim(); /*for(int i=0; i<lookupTables.length; i++){ System.out.println(lookupTables[i]); }*/ return lookupTables; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, int x, int y, ImageObserver observer) { Element imageElement = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform xform = getGenericImageHandler().handleImage( img, imageElement, x, y, img.getWidth(null), img.getHeight(null), getGeneratorContext()); if (xform == null) { domGroupManager.addElement(imageElement); } else { AffineTransform inverseTransform = null; try { inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(imageElement); gc.transform(inverseTransform); } return true; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer){ Element imageElement = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform xform = getGenericImageHandler().handleImage( img, imageElement, x, y, width, height, getGeneratorContext()); if (xform == null) { domGroupManager.addElement(imageElement); } else { AffineTransform inverseTransform = null; try { inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(imageElement); gc.transform(inverseTransform); } return true; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs){ boolean retVal = true; if (xform == null) { retVal = drawImage(img, 0, 0, null); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); } catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); retVal = drawImage(img, 0, 0, null); gc.setTransform(savTransform); } return retVal; }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void drawRenderedImage(RenderedImage img, AffineTransform trans2) { Element image = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform trans1 = getGenericImageHandler().handleImage( img, image, img.getMinX(), img.getMinY(), img.getWidth(), img.getHeight(), getGeneratorContext()); AffineTransform xform; // Concatenate the transformation we receive from the imageHandler // to the user-supplied one. Be aware that both may be null. if (trans2 == null) { xform = trans1; } else { if(trans1 == null) { xform = trans2; } else { xform = new AffineTransform(trans2); xform.concatenate(trans1); } } if(xform == null) { domGroupManager.addElement(image); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); }catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(image); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); domGroupManager.addElement(image); gc.setTransform(savTransform); } }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
public void drawRenderableImage(RenderableImage img, AffineTransform trans2){ Element image = getGenericImageHandler().createElement(getGeneratorContext()); AffineTransform trans1 = getGenericImageHandler().handleImage( img, image, img.getMinX(), img.getMinY(), img.getWidth(), img.getHeight(), getGeneratorContext()); AffineTransform xform; // Concatenate the transformation we receive from the imageHandler // to the user-supplied one. Be aware that both may be null. if (trans2 == null) { xform = trans1; } else { if(trans1 == null) { xform = trans2; } else { xform = new AffineTransform(trans2); xform.concatenate(trans1); } } if (xform == null) { domGroupManager.addElement(image); } else if(xform.getDeterminant() != 0){ AffineTransform inverseTransform = null; try{ inverseTransform = xform.createInverse(); }catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); } gc.transform(xform); domGroupManager.addElement(image); gc.transform(inverseTransform); } else { AffineTransform savTransform = new AffineTransform(gc.getTransform()); gc.transform(xform); domGroupManager.addElement(image); gc.setTransform(savTransform); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(Image image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext) { int imageWidth = image.getWidth(null); int imageHeight = image.getHeight(null); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x, y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(RenderedImage image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext) { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x, y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public AffineTransform handleImage(RenderableImage image, Element imageElement, double x, double y, double width, double height, SVGGeneratorContext generatorContext) { double imageWidth = image.getWidth(); double imageHeight = image.getHeight(); AffineTransform af = null; if(imageWidth == 0 || imageHeight == 0 || width == 0 || height == 0) { // Forget about it handleEmptyImage(imageElement); } else { // First set the href try { handleHREF(image, imageElement, generatorContext); } catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } } // Then create the transformation: // Because we cache image data, the stored image may // need to be scaled. af = handleTransform(imageElement, x,y, imageWidth, imageHeight, width, height, generatorContext); } return af; }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (image == null) throw new SVGGraphics2DRuntimeException(ERR_IMAGE_NULL); int width = image.getWidth(null); int height = image.getHeight(null); if (width==0 || height==0) { handleEmptyImage(imageElement); } else { if (image instanceof RenderedImage) { handleHREF((RenderedImage)image, imageElement, generatorContext); } else { BufferedImage buf = buildBufferedImage(new Dimension(width, height)); Graphics2D g = createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); handleHREF((RenderedImage)buf, imageElement, generatorContext); } } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
protected void cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { ByteArrayOutputStream os; if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); try { os = new ByteArrayOutputStream(); // encode the image in memory encodeImage(buf, os); os.flush(); os.close(); } catch (IOException e) { // should not happen since we do in-memory processing throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e); } // ask the cacher for a reference String ref = imageCacher.lookup(os, buf.getWidth(), buf.getHeight(), generatorContext); // set the URL imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, getRefPrefix() + ref); }
// in sources/org/apache/batik/svggen/XmlWriter.java
public static void writeXml(Node node, Writer writer, boolean escaped) throws SVGGraphics2DIOException { try { IndentWriter out = null; if (writer instanceof IndentWriter) out = (IndentWriter)writer; else out = new IndentWriter(writer); switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: writeXml((Attr)node, out, escaped); break; case Node.COMMENT_NODE: writeXml((Comment)node, out, escaped); break; case Node.TEXT_NODE: writeXml((Text)node, out, escaped); break; case Node.CDATA_SECTION_NODE: writeXml((CDATASection)node, out, escaped); break; case Node.DOCUMENT_NODE: writeXml((Document)node, out, escaped); break; case Node.DOCUMENT_FRAGMENT_NODE: writeDocumentHeader(out); NodeList childList = node.getChildNodes(); writeXml(childList, out, escaped); break; case Node.ELEMENT_NODE: writeXml((Element)node, out, escaped); break; default: throw new SVGGraphics2DRuntimeException (ErrorConstants.INVALID_NODE+node.getClass().getName()); } } catch (IOException io) { throw new SVGGraphics2DIOException(io); } }
// in sources/org/apache/batik/svggen/SVGRescaleOp.java
public SVGFilterDescriptor toSVG(RescaleOp rescaleOp) { // Reuse definition if rescaleOp has already been converted SVGFilterDescriptor filterDesc = (SVGFilterDescriptor)descMap.get(rescaleOp); Document domFactory = generatorContext.domFactory; if (filterDesc == null) { // // First time filter is converted: create its corresponding // SVG filter // Element filterDef = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FILTER_TAG); Element feComponentTransferDef = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_COMPONENT_TRANSFER_TAG); // Append transfer function for each component, setting // the attributes corresponding to the scale and offset. // Because we are using a RescaleOp as a BufferedImageOp, // the scaleFactors must be either: // + 1, in which case the same scale is applied to the // Red, Green and Blue components, // + 3, in which case the scale factors apply to the // Red, Green and Blue components // + 4, in which case the scale factors apply to the // Red, Green, Blue and Alpha components float[] offsets = rescaleOp.getOffsets(null); float[] scaleFactors = rescaleOp.getScaleFactors(null); if(offsets.length != scaleFactors.length) throw new SVGGraphics2DRuntimeException(ERR_SCALE_FACTORS_AND_OFFSETS_MISMATCH); if(offsets.length != 1 && offsets.length != 3 && offsets.length != 4) throw new SVGGraphics2DRuntimeException(ERR_ILLEGAL_BUFFERED_IMAGE_RESCALE_OP); Element feFuncR = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_R_TAG); Element feFuncG = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_G_TAG); Element feFuncB = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_B_TAG); Element feFuncA = null; String type = SVG_LINEAR_VALUE; if(offsets.length == 1){ String slope = doubleString(scaleFactors[0]); String intercept = doubleString(offsets[0]); feFuncR.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncG.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncB.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncR.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncG.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncB.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, slope); feFuncR.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); feFuncG.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); feFuncB.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, intercept); } else if(offsets.length >= 3){ feFuncR.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncG.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncB.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncR.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[0])); feFuncG.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[1])); feFuncB.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[2])); feFuncR.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[0])); feFuncG.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[1])); feFuncB.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[2])); if(offsets.length == 4){ feFuncA = domFactory.createElementNS(SVG_NAMESPACE_URI, SVG_FE_FUNC_A_TAG); feFuncA.setAttributeNS(null, SVG_TYPE_ATTRIBUTE, type); feFuncA.setAttributeNS(null, SVG_SLOPE_ATTRIBUTE, doubleString(scaleFactors[3])); feFuncA.setAttributeNS(null, SVG_INTERCEPT_ATTRIBUTE, doubleString(offsets[3])); } } feComponentTransferDef.appendChild(feFuncR); feComponentTransferDef.appendChild(feFuncG); feComponentTransferDef.appendChild(feFuncB); if(feFuncA != null) feComponentTransferDef.appendChild(feFuncA); filterDef.appendChild(feComponentTransferDef); filterDef. setAttributeNS(null, SVG_ID_ATTRIBUTE, generatorContext.idGenerator. generateID(ID_PREFIX_FE_COMPONENT_TRANSFER)); // // Create a filter descriptor // // Process filter attribute // StringBuffer filterAttrBuf = new StringBuffer(URL_PREFIX); // filterAttrBuf.append(SIGN_POUND); // filterAttrBuf.append(filterDef.getAttributeNS(null, SVG_ID_ATTRIBUTE)); // filterAttrBuf.append(URL_SUFFIX); String filterAttrBuf = URL_PREFIX + SIGN_POUND + filterDef.getAttributeNS(null, SVG_ID_ATTRIBUTE) + URL_SUFFIX; filterDesc = new SVGFilterDescriptor(filterAttrBuf, filterDef); defSet.add(filterDef); descMap.put(rescaleOp, filterDesc); } return filterDesc; }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
private void saveBufferedImageToFile(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) throws SVGGraphics2DIOException { if (generatorContext == null) throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL); // Create a new file in image directory File imageFile = null; // While the files we are generating exist, try to create another // id that is unique. while (imageFile == null) { String fileId = generatorContext.idGenerator.generateID(getPrefix()); imageFile = new File(imageDir, fileId + getSuffix()); if (imageFile.exists()) imageFile = null; } // Encode image here encodeImage(buf, imageFile); // Update HREF imageElement.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, urlRoot + "/" + imageFile.getName()); }
11
            
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e) { // This should never happen since handleImage // always returns invertible transform throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // Should never happen since we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen since we checked // the matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/SVGGraphics2D.java
catch(NoninvertibleTransformException e){ // This should never happen because we checked the // matrix determinant throw new SVGGraphics2DRuntimeException(ERR_UNEXPECTED); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException e) { try { generatorContext.errorHandler.handleError(e); } catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); } }
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (SVGGraphics2DIOException io) { // we need a runtime exception because // java.awt.Graphics2D method doesn't throw exceptions.. throw new SVGGraphics2DRuntimeException(io); }
1
            
// in sources/org/apache/batik/svggen/DefaultErrorHandler.java
public void handleError(SVGGraphics2DRuntimeException ex) throws SVGGraphics2DRuntimeException { System.err.println(ex.getMessage()); }
0 0 0
unknown (Domain) SVGOMException
public class SVGOMException extends SVGException {

    /**
     * Constructs a new <tt>SVGOMException</tt> with the specified parameters.
     *
     * @param code the exception code
     * @param message the error message
     */
    public SVGOMException(short code, String message) {
        super(code, message);
    }
}
2
            
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public SVGMatrix inverse() throws SVGException { try { return new SVGOMMatrix(getAffineTransform().createInverse()); } catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); } }
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
public SVGMatrix rotateFromVector(float x, float y) throws SVGException { if (x == 0 || y == 0) { throw new SVGOMException(SVGException.SVG_INVALID_VALUE_ERR, ""); } AffineTransform tr = (AffineTransform)getAffineTransform().clone(); tr.rotate(Math.atan2(y, x)); return new SVGOMMatrix(tr); }
1
            
// in sources/org/apache/batik/dom/svg/AbstractSVGMatrix.java
catch (NoninvertibleTransformException e) { throw new SVGOMException(SVGException.SVG_MATRIX_NOT_INVERTABLE, e.getMessage()); }
0 0 0 0
unknown (Lib) SecurityException 2
            
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
public GeneratedClassLoader createClassLoader (final ClassLoader parentLoader, Object securityDomain) { if (securityDomain instanceof RhinoClassLoader) { return (RhinoClassLoader)securityDomain; } // FIXX: This should be supported by intersecting perms. // Calling var script = Script(source); script(); is not supported throw new SecurityException("Script() objects are not supported"); }
// in sources/org/apache/batik/util/ApplicationSecurityEnforcer.java
public void enforceSecurity(boolean enforce){ SecurityManager sm = System.getSecurityManager(); if (sm != null && sm != lastSecurityManagerInstalled) { // Throw a Security exception: we do not want to override // an 'alien' SecurityManager with either null or // a new SecurityManager. throw new SecurityException (Messages.getString(EXCEPTION_ALIEN_SECURITY_MANAGER)); } if (enforce) { // We first set the security manager to null to // force reloading of the policy file in case there // has been a change since it was last enforced (this // may happen with dynamically generated policy files). System.setSecurityManager(null); installSecurityManager(); } else { if (sm != null) { System.setSecurityManager(null); lastSecurityManagerInstalled = null; } } }
0 12
            
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadScript(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL) throws SecurityException { if (EventQueue.isDispatchThread()) { userAgent.checkLoadScript(scriptType, scriptPURL, docPURL); } else { final String st = scriptType; final ParsedURL sPURL= scriptPURL; final ParsedURL dPURL= docPURL; class Query implements Runnable { SecurityException se = null; public void run() { try { userAgent.checkLoadScript(st, sPURL, dPURL); } catch (SecurityException se) { this.se = se; } } } Query q = new Query(); invokeAndWait(q); if (q.se != null) { q.se.fillInStackTrace(); throw q.se; } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { if (EventQueue.isDispatchThread()) { userAgent.checkLoadExternalResource(resourceURL, docURL); } else { final ParsedURL rPURL= resourceURL; final ParsedURL dPURL= docURL; class Query implements Runnable { SecurityException se; public void run() { try { userAgent.checkLoadExternalResource(rPURL, dPURL); } catch (SecurityException se) { this.se = se; } } } Query q = new Query(); invokeAndWait(q); if (q.se != null) { q.se.fillInStackTrace(); throw q.se; } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { if (svgUserAgent != null) { svgUserAgent.checkLoadScript(scriptType, scriptURL, docURL); } else { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } } }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { if (svgUserAgent != null) { svgUserAgent.checkLoadExternalResource(resourceURL, docURL); } else { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/swing/svg/SVGUserAgentAdapter.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/bridge/URIResolver.java
public Node getNode(String uri, Element ref) throws MalformedURLException, IOException, SecurityException { String baseURI = getRefererBaseURI(ref); // System.err.println("baseURI: " + baseURI); // System.err.println("URI: " + uri); if (baseURI == null && uri.charAt(0) == '#') { return getNodeByFragment(uri.substring(1), ref); } ParsedURL purl = new ParsedURL(baseURI, uri); // System.err.println("PURL: " + purl); if (documentURI == null) documentURI = document.getURL(); String frag = purl.getRef(); if ((frag != null) && (documentURI != null)) { ParsedURL pDocURL = new ParsedURL(documentURI); // System.out.println("doc: " + pDocURL); // System.out.println("Purl: " + purl); if (pDocURL.sameFile(purl)) { // System.out.println("match"); return document.getElementById(frag); } } // uri is not a reference into this document, so load the // document it does reference after doing a security // check with the UserAgent ParsedURL pDocURL = null; if (documentURI != null) { pDocURL = new ParsedURL(documentURI); } UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); String purlStr = purl.toString(); if (frag != null) { purlStr = purlStr.substring(0, purlStr.length()-(frag.length()+1)); } Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag); return doc; }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public void checkLoadScript(String scriptType, ParsedURL scriptURL, ParsedURL docURL) throws SecurityException { ScriptSecurity s = getScriptSecurity(scriptType, scriptURL, docURL); if (s != null) { s.checkLoadScript(); } }
// in sources/org/apache/batik/bridge/UserAgentAdapter.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { ExternalResourceSecurity s = getExternalResourceSecurity(resourceURL, docURL); if (s != null) { s.checkLoadExternalResource(); } }
// in sources/org/apache/batik/bridge/BridgeContext.java
public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { userAgent.checkLoadExternalResource(resourceURL, docURL); }
30
            
// in sources/org/apache/batik/apps/svgbrowser/NodeTemplates.java
catch (SecurityException e) { e.printStackTrace(); }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (SecurityException e) { EOL = "\n"; }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch(SecurityException se){ // Could not patch the file URI for security // reasons (e.g., when run as an unsigned // JavaWebStart jar): file access is not // allowed. Loading will fail, but there is // nothing more to do at this point. }
// in sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
catch (SecurityException se) { }
// in sources/org/apache/batik/apps/svgbrowser/Main.java
catch(SecurityException se){ // Cannot access files. }
// in sources/org/apache/batik/svggen/font/SVGFont.java
catch (SecurityException e) { temp = PROPERTY_LINE_SEPARATOR_DEFAULT; }
// in sources/org/apache/batik/svggen/XmlWriter.java
catch (SecurityException e) { temp = "\n"; }
// in sources/org/apache/batik/script/ImportInfo.java
catch (SecurityException se) { }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (SecurityException se) { rhinoClassLoader = null; }
// in sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
catch (SecurityException se) { }
// in sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
catch (SecurityException se) { }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (SecurityException se) { this.se = se; }
// in sources/org/apache/batik/swing/svg/JSVGComponent.java
catch (SecurityException se) { this.se = se; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (SecurityException e) { return; // Can't access clipboard. }
// in sources/org/apache/batik/i18n/LocalizableSupport.java
catch (SecurityException se) { }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Security violation notify the user but keep going. ctx.getUserAgent().displayError(ex); }
// in sources/org/apache/batik/bridge/FontFace.java
catch (SecurityException ex) { // Can't load font - Security violation. // We should not throw the error that is for certain, just // move down the font list, but do we display the error or not??? // I'll vote yes just because it is a security exception (other // exceptions like font not available etc I would skip). userAgent.displayError(ex); return null; }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (SecurityException e) { if (userAgent != null) { userAgent.displayError(e); } }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (SecurityException se) { handleSecurityException(se); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (SecurityException se) { }
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/util/Service.java
catch (SecurityException se) { // Ooops! can't get his class loader. }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (SecurityException e) { throw e; }
9
            
// in sources/org/apache/batik/bridge/CursorManager.java
catch (SecurityException ex) { throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/bridge/SVGColorProfileElementBridge.java
catch (SecurityException secEx) { throw new BridgeException(ctx, paintedElement, secEx, ERR_URI_UNSECURE, new Object[] {href}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGImageElementBridge.java
catch (SecurityException secEx ) { reference.release(); throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {purl}); }
// in sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
catch (SecurityException e) { ctx.getUserAgent().displayError(e); // Throw exception because we do not want to continue // processing. In the case of a SecurityException, the // end user would get a lot of exception like this one. throw e; }
// in sources/org/apache/batik/bridge/BridgeContext.java
catch (SecurityException ex) { throw new BridgeException(this, e, ex, ERR_URI_UNSECURE, new Object[] {uri}); }
// in sources/org/apache/batik/bridge/SVGUtilities.java
catch(SecurityException secEx ) { throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE, new Object[] {uriStr}); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
catch (SecurityException e) { throw e; }
7
unknown (Lib) StreamCorruptedException 1
            
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
boolean isMatch(InputStream is) throws StreamCorruptedException { int idx = 0; is.mark(getReadlimit()); try { // Skip to the offset location. while (idx < offset) { int rn = (int)is.skip(offset-idx); if (rn == -1) { return false; } idx += rn; } idx = 0; while (idx < buffer.length) { int rn = is.read(buffer, idx, buffer.length-idx); if (rn == -1) { return false; } idx += rn; } for (int i=0; i<magicNumber.length; i++) { if (magicNumber[i] != buffer[i]) { return false; } } } catch (IOException ioe) { return false; } finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } } return true; }
1
            
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); }
2
            
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
boolean isMatch(InputStream is) throws StreamCorruptedException { int idx = 0; is.mark(getReadlimit()); try { // Skip to the offset location. while (idx < offset) { int rn = (int)is.skip(offset-idx); if (rn == -1) { return false; } idx += rn; } idx = 0; while (idx < buffer.length) { int rn = is.read(buffer, idx, buffer.length-idx); if (rn == -1) { return false; } idx += rn; } for (int i=0; i<magicNumber.length; i++) { if (magicNumber[i] != buffer[i]) { return false; } } } catch (IOException ioe) { return false; } finally { try { // Make sure we always put back what we have read. // If this throws an IOException then the current // stream should be closed an reopened by the registry. is.reset(); } catch (IOException ioe) { throw new StreamCorruptedException(ioe.getMessage()); } } return true; }
// in sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
public boolean isCompatibleStream(InputStream is) throws StreamCorruptedException { for (int i=0; i<magicNumbers.length; i++) { if (magicNumbers[i].isMatch(is)) { return true; } } return false; }
2
            
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch (StreamCorruptedException sce) { // Stream is messed up so setup to reopen it.. is = null; }
// in sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
catch (StreamCorruptedException sce) { break; }
0 0
unknown (Lib) TclException 0 0 0 3
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { // should not happened we just register an object }
1
            
// in sources/org/apache/batik/script/jacl/JaclInterpreter.java
catch (TclException e) { throw new InterpreterException(e, e.getMessage(), -1, -1); }
1
unknown (Lib) ThreadDeath 0 0 0 18
            
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/util/CleanerThread.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath t) { // Keep delivering messages but remember to throw later. td = t; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath t) { // Remember to throw later. td = t; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
16
            
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (JDKRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, evt); throw td; }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (ThreadDeath td) { exception = new Exception(td.getMessage()); fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (ThreadDeath td) { fireEvent(failedDispatcher, ev); throw td; }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (ThreadDeath td) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); throw td; }
// in sources/org/apache/batik/util/CleanerThread.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (ThreadDeath td) { throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (ThreadDeath td) { // Let it kill us... throw td; }
0
checked (Lib) Throwable 0 0 1
            
// in sources/org/apache/batik/ext/awt/image/codec/util/SeekableStream.java
protected void finalize() throws Throwable { super.finalize(); close(); }
22
            
// in sources/org/apache/batik/svggen/DefaultCachedImageHandler.java
catch (Throwable t) { // happen only if Batik extensions are not their }
// in sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java
catch (Throwable t) { // happen only if Batik extensions are not there }
// in sources/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java
catch (Throwable t) { }
// in sources/org/apache/batik/ext/awt/image/rendered/Any2sRGBRed.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (TIFFRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java
catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (PNGRegistryEntry.this, errCode, errParam); }
// in sources/org/apache/batik/dom/events/EventSupport.java
catch (Throwable th) { th.printStackTrace(); }
// in sources/org/apache/batik/swing/svg/GVTTreeBuilder.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/svg/SVGDocumentLoader.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, evt); }
// in sources/org/apache/batik/swing/svg/SVGLoadEventDispatcher.java
catch (Throwable t) { t.printStackTrace(); exception = new Exception(t.getMessage()); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/swing/gvt/JGVTComponent.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/swing/gvt/GVTTreeRenderer.java
catch (Throwable t) { t.printStackTrace(); fireEvent(failedDispatcher, ev); }
// in sources/org/apache/batik/gvt/renderer/MacRenderer.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/bridge/UpdateManager.java
catch (Throwable t) { UpdateManagerEvent ev = new UpdateManagerEvent (this, null, null); fireEvent(updateFailedDispatcher, ev); }
// in sources/org/apache/batik/util/CleanerThread.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch(Throwable t) { err = t; }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { t.printStackTrace(); }
// in sources/org/apache/batik/util/EventDispatcher.java
catch (Throwable t) { if (ll[ll.length-1] != null) dispatchEvent(dispatcher, ll, evt); t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
// in sources/org/apache/batik/util/RunnableQueue.java
catch (Throwable t) { // Might be nice to notify someone directly. // But this is more or less what Swing does. t.printStackTrace(); }
0 0
checked (Domain) TranscoderException
public class TranscoderException extends Exception {

    /** The enclosed exception. */
    protected Exception ex;

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param s the detail message of this exception
     */
    public TranscoderException(String s) {
        this(s, null);
    }

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param ex the enclosed exception
     */
    public TranscoderException(Exception ex) {
        this(null, ex);
    }

    /**
     * Constructs a new transcoder exception with the specified detail message.
     * @param s the detail message of this exception
     * @param ex the original exception
     */
    public TranscoderException(String s, Exception ex) {
        super(s);
        this.ex = ex;
    }

    /**
     * Returns the message of this exception. If an error message has
     * been specified, returns that one. Otherwise, return the error message
     * of enclosed exception or null if any.
     */
    public String getMessage() {
        String msg = super.getMessage();
        if (ex != null) {
            msg += "\nEnclosed Exception:\n";
            msg += ex.getMessage();
        }
        return msg;
    }

    /**
     * Returns the original enclosed exception or null if any.
     */
    public Exception getException() {
        return ex;
    }
}
15
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); TIFFEncodeParam params = new TIFFEncodeParam(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 100 Meters int numPix = (int)(((1000 * 100) / PixSzMM) + 0.5); int denom = 100 * 100; // Centimeters per 100 Meters; long [] rational = {numPix, denom}; TIFFField [] fields = { new TIFFField(TIFFImageDecoder.TIFF_RESOLUTION_UNIT, TIFFField.TIFF_SHORT, 1, new char [] { (char)3 }), new TIFFField(TIFFImageDecoder.TIFF_X_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }), new TIFFField(TIFFImageDecoder.TIFF_Y_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }) }; params.setExtraFields(fields); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); if ("packbits".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS); } else if ("deflate".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE); /* TODO: NPE occurs when used. } else if ("jpeg".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2); */ } else { //nop } } try { int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); OutputStream ostream = output.getOutputStream(); TIFFImageEncoder tiffEncoder = new TIFFImageEncoder(ostream, params); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); tiffEncoder.encode(rimg); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n = -1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img, 1<<n); } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); ImageWriterParams params = new ImageWriterParams(); /* NYI!!!!! PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); }*/ // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. /* NYI!!!!!! if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); }*/ float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); try { OutputStream ostream = output.getOutputStream(); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/tiff"); ImageWriterParams params = new ImageWriterParams(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); //Values set here as defined in TIFFImageWriteParam of JAI Image I/O Tools if ("packbits".equals(method)) { params.setCompressionMethod("PackBits"); } else if ("deflate".equals(method)) { params.setCompressionMethod("Deflate"); } else if ("lzw".equals(method)) { params.setCompressionMethod("LZW"); } else if ("jpeg".equals(method)) { params.setCompressionMethod("JPEG"); } else { //nop } } try { OutputStream ostream = output.getOutputStream(); int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); writer.writeImage(rimg, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n=-1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img,1<<n); } PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); } // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); } float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 1 Meter int numPix = (int)((1000/PixSzMM)+0.5); params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter' try { OutputStream ostream = output.getOutputStream(); PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params); pngEncoder.encode(img); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { if ((document != null) && !(document.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); // impl = SVGDOMImplementation.getDOMImplementation(); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri); ((SVGOMDocument)document).setParsedURL(url); } } if (hints.containsKey(KEY_WIDTH)) width = ((Float)hints.get(KEY_WIDTH)).floatValue(); if (hints.containsKey(KEY_HEIGHT)) height = ((Float)hints.get(KEY_HEIGHT)).floatValue(); SVGOMDocument svgDoc = (SVGOMDocument)document; SVGSVGElement root = svgDoc.getRootElement(); ctx = createBridgeContext(svgDoc); // build the GVT tree builder = new GVTBuilder(); // flag that indicates if the document is dynamic boolean isDynamic = hints.containsKey(KEY_EXECUTE_ONLOAD) && ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue(); GraphicsNode gvtRoot; try { if (isDynamic) ctx.setDynamicState(BridgeContext.DYNAMIC); gvtRoot = builder.build(ctx, svgDoc); // dispatch an 'onload' event if needed if (ctx.isDynamic()) { BaseScriptingEnvironment se; se = new BaseScriptingEnvironment(ctx); se.loadScripts(); se.dispatchSVGLoadEvent(); if (hints.containsKey(KEY_SNAPSHOT_TIME)) { float t = ((Float) hints.get(KEY_SNAPSHOT_TIME)).floatValue(); ctx.getAnimationEngine().setCurrentTime(t); } else if (ctx.isSVG12()) { float t = SVGUtilities.convertSnapshotTime(root, null); ctx.getAnimationEngine().setCurrentTime(t); } } } catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); // compute the preserveAspectRatio matrix AffineTransform Px; // take the AOI into account if any if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); // transform the AOI into the image's coordinate system Px = new AffineTransform(); double sx = width / aoi.getWidth(); double sy = height / aoi.getHeight(); double scale = Math.min(sx,sy); Px.scale(scale, scale); double tx = -aoi.getX() + (width/scale - aoi.getWidth())/2; double ty = -aoi.getY() + (height/scale -aoi.getHeight())/2; Px.translate(tx, ty); // take the AOI transformation matrix into account // we apply first the preserveAspectRatio matrix curAOI = aoi; } else { String ref = new ParsedURL(uri).getRef(); // XXX Update this to use the animated value of 'viewBox' and // 'preserveAspectRatio'. String viewBox = root.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if ((ref != null) && (ref.length() != 0)) { Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else { // no viewBox has been specified, create a scale transform float xscale, yscale; xscale = width/docWidth; yscale = height/docHeight; float scale = Math.min(xscale,yscale); Px = AffineTransform.getScaleInstance(scale, scale); } curAOI = new Rectangle2D.Float(0, 0, width, height); } CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px); curTxf = new AffineTransform(); } else { curTxf = Px; } this.root = gvtRoot; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public static void main(String[] args) throws TranscoderException { if(args.length < 1){ System.out.println("Usage : WMFTranscoder.main <file 1> ... <file n>"); System.exit(1); } WMFTranscoder transcoder = new WMFTranscoder(); int nFiles = args.length; for(int i=0; i<nFiles; i++){ String fileName = args[i]; if(!fileName.toLowerCase().endsWith(WMF_EXTENSION)){ System.err.println(args[i] + " does not have the " + WMF_EXTENSION + " extension. It is ignored"); } else{ System.out.print("Processing : " + args[i] + "..."); String outputFileName = fileName.substring(0, fileName.toLowerCase().indexOf(WMF_EXTENSION)) + SVG_EXTENSION; File inputFile = new File(fileName); File outputFile = new File(outputFileName); try { TranscoderInput input = new TranscoderInput(inputFile.toURL().toString()); TranscoderOutput output = new TranscoderOutput(new FileOutputStream(outputFile)); transcoder.transcode(input, output); }catch(MalformedURLException e){ throw new TranscoderException(e); }catch(IOException e){ throw new TranscoderException(e); } System.out.println(".... Done"); } } System.exit(0); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
protected void writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output) throws TranscoderException { Document doc = output.getDocument(); if (doc != null) return; // XMLFilter XMLFilter xmlFilter = output.getXMLFilter(); if (xmlFilter != null) { handler.fatalError(new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE)); } try { boolean escaped = false; if (hints.containsKey(KEY_ESCAPED)) { escaped = ((Boolean)hints.get(KEY_ESCAPED)).booleanValue(); } // Output stream OutputStream os = output.getOutputStream(); if (os != null) { svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } // Writer Writer wr = output.getWriter(); if (wr != null) { svgGenerator.stream(svgRoot, wr, false, escaped); return; } // URI String uri = output.getURI(); if ( uri != null ){ try{ URL url = new URL(uri); URLConnection urlCnx = url.openConnection(); os = urlCnx.getOutputStream(); svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } } catch(IOException e){ throw new TranscoderException(e); } throw new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); // The outputstream wrapper protects the JPEG encoder from // exceptions due to stream closings. If it gets an exception // it nulls out the stream and just ignores any future calls. ostream = new OutputStreamWrapper(ostream); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("jpeg.badoutput", null)); } try { float quality; if (hints.containsKey(KEY_QUALITY)) { quality = ((Float)hints.get(KEY_QUALITY)).floatValue(); } else { TranscoderException te; te = new TranscoderException (Messages.formatMessage("jpeg.unspecifiedQuality", null)); handler.error(te); quality = 0.75f; } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(quality, true); float PixSzMM = userAgent.getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("png.badoutput", null)); } // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.png.PNGTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.PNGTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write PNG file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.tiff.TIFFTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.TIFFTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write TIFF file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { // Sets up root, curTxf & curAoi super.transcode(document, uri, output); // prepare the image to be painted int w = (int)(width+0.5); int h = (int)(height+0.5); // paint the SVG document using the bridge package // create the appropriate renderer ImageRenderer renderer = createRenderer(); renderer.updateOffScreen(w, h); // curTxf.translate(0.5, 0.5); renderer.setTransform(curTxf); renderer.setTree(this.root); this.root = null; // We're done with it... try { // now we are sure that the aoi is the image size Shape raoi = new Rectangle2D.Float(0, 0, width, height); // Warning: the renderer's AOI must be in user space renderer.repaint(curTxf.createInverse(). createTransformedShape(raoi)); BufferedImage rend = renderer.getOffScreen(); renderer = null; // We're done with it... BufferedImage dest = createImage(w, h); Graphics2D g2d = GraphicsUtil.createGraphics(dest); if (hints.containsKey(KEY_BACKGROUND_COLOR)) { Paint bgcolor = (Paint)hints.get(KEY_BACKGROUND_COLOR); g2d.setComposite(AlphaComposite.SrcOver); g2d.setPaint(bgcolor); g2d.fillRect(0, 0, w, h); } if (rend != null) { // might be null if the svg document is empty g2d.drawRenderedImage(rend, new AffineTransform()); } g2d.dispose(); rend = null; // We're done with it... writeImage(dest, output); } catch (Exception ex) { throw new TranscoderException(ex); } }
10
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(MalformedURLException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
catch(IOException e){ throw new TranscoderException(e); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
catch (IOException ex) { throw new TranscoderException(ex); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
catch (Exception ex) { throw new TranscoderException(ex); }
36
            
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFTranscoderInternalCodecWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); TIFFEncodeParam params = new TIFFEncodeParam(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 100 Meters int numPix = (int)(((1000 * 100) / PixSzMM) + 0.5); int denom = 100 * 100; // Centimeters per 100 Meters; long [] rational = {numPix, denom}; TIFFField [] fields = { new TIFFField(TIFFImageDecoder.TIFF_RESOLUTION_UNIT, TIFFField.TIFF_SHORT, 1, new char [] { (char)3 }), new TIFFField(TIFFImageDecoder.TIFF_X_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }), new TIFFField(TIFFImageDecoder.TIFF_Y_RESOLUTION, TIFFField.TIFF_RATIONAL, 1, new long [][] { rational }) }; params.setExtraFields(fields); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); if ("packbits".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS); } else if ("deflate".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE); /* TODO: NPE occurs when used. } else if ("jpeg".equals(method)) { params.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2); */ } else { //nop } } try { int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); OutputStream ostream = output.getOutputStream(); TIFFImageEncoder tiffEncoder = new TIFFImageEncoder(ostream, params); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); tiffEncoder.encode(rimg); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/PNGTranscoderImageIOWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n = -1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img, 1<<n); } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); ImageWriterParams params = new ImageWriterParams(); /* NYI!!!!! PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); }*/ // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. /* NYI!!!!!! if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); }*/ float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); try { OutputStream ostream = output.getOutputStream(); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/TIFFTranscoderImageIOWriteAdapter.java
public void writeImage(TIFFTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/tiff"); ImageWriterParams params = new ImageWriterParams(); float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); if (hints.containsKey(TIFFTranscoder.KEY_COMPRESSION_METHOD)) { String method = (String)hints.get(TIFFTranscoder.KEY_COMPRESSION_METHOD); //Values set here as defined in TIFFImageWriteParam of JAI Image I/O Tools if ("packbits".equals(method)) { params.setCompressionMethod("PackBits"); } else if ("deflate".equals(method)) { params.setCompressionMethod("Deflate"); } else if ("lzw".equals(method)) { params.setCompressionMethod("LZW"); } else if ("jpeg".equals(method)) { params.setCompressionMethod("JPEG"); } else { //nop } } try { OutputStream ostream = output.getOutputStream(); int w = img.getWidth(); int h = img.getHeight(); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); int bands = sppsm.getNumBands(); int [] off = new int[bands]; for (int i = 0; i < bands; i++) off[i] = i; SampleModel sm = new PixelInterleavedSampleModel (DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off); RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm); writer.writeImage(rimg, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/ext/awt/image/codec/png/PNGTranscoderInternalCodecWriteAdapter.java
public void writeImage(PNGTranscoder transcoder, BufferedImage img, TranscoderOutput output) throws TranscoderException { TranscodingHints hints = transcoder.getTranscodingHints(); int n=-1; if (hints.containsKey(PNGTranscoder.KEY_INDEXED)) { n=((Integer)hints.get(PNGTranscoder.KEY_INDEXED)).intValue(); if (n==1||n==2||n==4||n==8) //PNGEncodeParam.Palette can handle these numbers only. img = IndexImage.getIndexedImage(img,1<<n); } PNGEncodeParam params = PNGEncodeParam.getDefaultEncodeParam(img); if (params instanceof PNGEncodeParam.RGB) { ((PNGEncodeParam.RGB)params).setBackgroundRGB (new int [] { 255, 255, 255 }); } // If they specify GAMMA key with a value of '0' then omit // gamma chunk. If they do not provide a GAMMA then just // generate an sRGB chunk. Otherwise supress the sRGB chunk // and just generate gamma and chroma chunks. if (hints.containsKey(PNGTranscoder.KEY_GAMMA)) { float gamma = ((Float)hints.get(PNGTranscoder.KEY_GAMMA)).floatValue(); if (gamma > 0) { params.setGamma(gamma); } params.setChromaticity(PNGTranscoder.DEFAULT_CHROMA); } else { // We generally want an sRGB chunk and our encoding intent // is perceptual params.setSRGBIntent(PNGEncodeParam.INTENT_PERCEPTUAL); } float PixSzMM = transcoder.getUserAgent().getPixelUnitToMillimeter(); // num Pixs in 1 Meter int numPix = (int)((1000/PixSzMM)+0.5); params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter' try { OutputStream ostream = output.getOutputStream(); PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params); pngEncoder.encode(img); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { super.transcode(document, uri, output); // We do this to hide 'ctx' from the SVGAbstractTranscoder // otherwise it will dispose of the context before we can // print the document. theCtx = ctx; ctx = null; }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Document document = null; String uri = input.getURI(); if (input.getDocument() != null) { document = input.getDocument(); } else { String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME); String namespaceURI = (String)hints.get(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI); String documentElement = (String)hints.get(KEY_DOCUMENT_ELEMENT); DOMImplementation domImpl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); if (parserClassname == null) { parserClassname = XMLResourceDescriptor.getXMLParserClassName(); } if (domImpl == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOM_IMPLEMENTATION")); return; } if (namespaceURI == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT_NAMESPACE_URI")); return; } if (documentElement == null) { handler.fatalError(new TranscoderException( "Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT")); return; } // parse the XML document DocumentFactory f = createDocumentFactory(domImpl, parserClassname); boolean b = ((Boolean)hints.get(KEY_XML_PARSER_VALIDATING)).booleanValue(); f.setValidating(b); try { if (input.getInputStream() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getInputStream()); } else if (input.getReader() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getReader()); } else if (input.getXMLReader() != null) { document = f.createDocument(namespaceURI, documentElement, input.getURI(), input.getXMLReader()); } else if (uri != null) { document = f.createDocument(namespaceURI, documentElement, uri); } } catch (DOMException ex) { handler.fatalError(new TranscoderException(ex)); } catch (IOException ex) { handler.fatalError(new TranscoderException(ex)); } } // call the dedicated transcode method if (document != null) { try { transcode(document, uri, output); } catch(TranscoderException ex) { // at this time, all TranscoderExceptions are fatal errors handler.fatalError(ex); return; } } }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void error(TranscoderException ex) throws TranscoderException { System.err.println("ERROR: "+ex.getMessage()); }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void fatalError(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/DefaultErrorHandler.java
public void warning(TranscoderException ex) throws TranscoderException { System.err.println("WARNING: "+ex.getMessage()); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { super.transcode(input, output); if (ctx != null) ctx.dispose(); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { if ((document != null) && !(document.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); // impl = SVGDOMImplementation.getDOMImplementation(); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri); ((SVGOMDocument)document).setParsedURL(url); } } if (hints.containsKey(KEY_WIDTH)) width = ((Float)hints.get(KEY_WIDTH)).floatValue(); if (hints.containsKey(KEY_HEIGHT)) height = ((Float)hints.get(KEY_HEIGHT)).floatValue(); SVGOMDocument svgDoc = (SVGOMDocument)document; SVGSVGElement root = svgDoc.getRootElement(); ctx = createBridgeContext(svgDoc); // build the GVT tree builder = new GVTBuilder(); // flag that indicates if the document is dynamic boolean isDynamic = hints.containsKey(KEY_EXECUTE_ONLOAD) && ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue(); GraphicsNode gvtRoot; try { if (isDynamic) ctx.setDynamicState(BridgeContext.DYNAMIC); gvtRoot = builder.build(ctx, svgDoc); // dispatch an 'onload' event if needed if (ctx.isDynamic()) { BaseScriptingEnvironment se; se = new BaseScriptingEnvironment(ctx); se.loadScripts(); se.dispatchSVGLoadEvent(); if (hints.containsKey(KEY_SNAPSHOT_TIME)) { float t = ((Float) hints.get(KEY_SNAPSHOT_TIME)).floatValue(); ctx.getAnimationEngine().setCurrentTime(t); } else if (ctx.isSVG12()) { float t = SVGUtilities.convertSnapshotTime(root, null); ctx.getAnimationEngine().setCurrentTime(t); } } } catch (BridgeException ex) { ex.printStackTrace(); throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); // compute the preserveAspectRatio matrix AffineTransform Px; // take the AOI into account if any if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); // transform the AOI into the image's coordinate system Px = new AffineTransform(); double sx = width / aoi.getWidth(); double sy = height / aoi.getHeight(); double scale = Math.min(sx,sy); Px.scale(scale, scale); double tx = -aoi.getX() + (width/scale - aoi.getWidth())/2; double ty = -aoi.getY() + (height/scale -aoi.getHeight())/2; Px.translate(tx, ty); // take the AOI transformation matrix into account // we apply first the preserveAspectRatio matrix curAOI = aoi; } else { String ref = new ParsedURL(uri).getRef(); // XXX Update this to use the animated value of 'viewBox' and // 'preserveAspectRatio'. String viewBox = root.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if ((ref != null) && (ref.length() != 0)) { Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else { // no viewBox has been specified, create a scale transform float xscale, yscale; xscale = width/docWidth; yscale = height/docHeight; float scale = Math.min(xscale,yscale); Px = AffineTransform.getScaleInstance(scale, scale); } curAOI = new Rectangle2D.Float(0, 0, width, height); } CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px); curTxf = new AffineTransform(); } else { curTxf = Px; } this.root = gvtRoot; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { // // Extract the input // DataInputStream is = getCompatibleInput(input); // // Build a RecordStore from the input // WMFRecordStore currentStore = new WMFRecordStore(); try { currentStore.read(is); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); return; } // determines the width and height of output image float wmfwidth; // width in pixels float wmfheight; // height in pixels float conv = 1.0f; // conversion factor if (hints.containsKey(KEY_INPUT_WIDTH)) { wmfwidth = ((Integer)hints.get(KEY_INPUT_WIDTH)).intValue(); wmfheight = ((Integer)hints.get(KEY_INPUT_HEIGHT)).intValue(); } else { wmfwidth = currentStore.getWidthPixels(); wmfheight = currentStore.getHeightPixels(); } float width = wmfwidth; float height = wmfheight; // change the output width and height if required if (hints.containsKey(KEY_WIDTH)) { width = ((Float)hints.get(KEY_WIDTH)).floatValue(); conv = width / wmfwidth; height = height * width / wmfwidth; } // determine the offset values int xOffset = 0; int yOffset = 0; if (hints.containsKey(KEY_XOFFSET)) { xOffset = ((Integer)hints.get(KEY_XOFFSET)).intValue(); } if (hints.containsKey(KEY_YOFFSET)) { yOffset = ((Integer)hints.get(KEY_YOFFSET)).intValue(); } // Set the size and viewBox on the output document float sizeFactor = currentStore.getUnitsToPixels() * conv; int vpX = (int)(currentStore.getVpX() * sizeFactor); int vpY = (int)(currentStore.getVpY() * sizeFactor); int vpW; int vpH; // if we took only a part of the image, we use its dimension for computing if (hints.containsKey(KEY_INPUT_WIDTH)) { vpW = (int)(((Integer)hints.get(KEY_INPUT_WIDTH)).intValue() * conv); vpH = (int)(((Integer)hints.get(KEY_INPUT_HEIGHT)).intValue() * conv); // else we took the whole image dimension } else { vpW = (int)(currentStore.getWidthUnits() * sizeFactor); vpH = (int)(currentStore.getHeightUnits() * sizeFactor); } // Build a painter for the RecordStore WMFPainter painter = new WMFPainter(currentStore, xOffset, yOffset, conv); // Use SVGGraphics2D to generate SVG content Document doc = this.createDocument(output); svgGenerator = new SVGGraphics2D(doc); /** set precision ** otherwise Ellipses aren't working (for example) (because of Decimal format * modifications ins SVGGenerator Context */ svgGenerator.getGeneratorContext().setPrecision(4); painter.paint(svgGenerator); svgGenerator.setSVGCanvasSize(new Dimension(vpW, vpH)); Element svgRoot = svgGenerator.getRoot(); svgRoot.setAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE, String.valueOf( vpX ) + ' ' + vpY + ' ' + vpW + ' ' + vpH ); // Now, write the SVG content to the output writeSVGToOutput(svgGenerator, svgRoot, output); }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
private DataInputStream getCompatibleInput(TranscoderInput input) throws TranscoderException { // Cannot deal with null input if (input == null){ handler.fatalError(new TranscoderException( String.valueOf( ERROR_NULL_INPUT ) )); } // Can deal with InputStream InputStream in = input.getInputStream(); if (in != null){ return new DataInputStream(new BufferedInputStream(in)); } // Can deal with URI String uri = input.getURI(); if (uri != null){ try{ URL url = new URL(uri); in = url.openStream(); return new DataInputStream(new BufferedInputStream(in)); } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } handler.fatalError(new TranscoderException( String.valueOf( ERROR_INCOMPATIBLE_INPUT_TYPE ) )); return null; }
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.java
public static void main(String[] args) throws TranscoderException { if(args.length < 1){ System.out.println("Usage : WMFTranscoder.main <file 1> ... <file n>"); System.exit(1); } WMFTranscoder transcoder = new WMFTranscoder(); int nFiles = args.length; for(int i=0; i<nFiles; i++){ String fileName = args[i]; if(!fileName.toLowerCase().endsWith(WMF_EXTENSION)){ System.err.println(args[i] + " does not have the " + WMF_EXTENSION + " extension. It is ignored"); } else{ System.out.print("Processing : " + args[i] + "..."); String outputFileName = fileName.substring(0, fileName.toLowerCase().indexOf(WMF_EXTENSION)) + SVG_EXTENSION; File inputFile = new File(fileName); File outputFile = new File(outputFileName); try { TranscoderInput input = new TranscoderInput(inputFile.toURL().toString()); TranscoderOutput output = new TranscoderOutput(new FileOutputStream(outputFile)); transcoder.transcode(input, output); }catch(MalformedURLException e){ throw new TranscoderException(e); }catch(IOException e){ throw new TranscoderException(e); } System.out.println(".... Done"); } } System.exit(0); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void error(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void fatalError(TranscoderException ex) throws TranscoderException { throw ex; }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void warning(TranscoderException ex) throws TranscoderException { // Do nothing }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new Error("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new Error("Writer expected"); } prettyPrint(r, w); }
// in sources/org/apache/batik/transcoder/svg2svg/SVGTranscoder.java
protected void prettyPrint(Reader in, Writer out) throws TranscoderException { try { PrettyPrinter pp = new PrettyPrinter(); NewlineValue nlv = (NewlineValue)hints.get(KEY_NEWLINE); if (nlv != null) { pp.setNewline(nlv.getValue()); } Boolean b = (Boolean)hints.get(KEY_FORMAT); if (b != null) { pp.setFormat(b.booleanValue()); } Integer i = (Integer)hints.get(KEY_TABULATION_WIDTH); if (i != null) { pp.setTabulationWidth(i.intValue()); } i = (Integer)hints.get(KEY_DOCUMENT_WIDTH); if (i != null) { pp.setDocumentWidth(i.intValue()); } DoctypeValue dtv = (DoctypeValue)hints.get(KEY_DOCTYPE); if (dtv != null) { pp.setDoctypeOption(dtv.getValue()); } String s = (String)hints.get(KEY_PUBLIC_ID); if (s != null) { pp.setPublicId(s); } s = (String)hints.get(KEY_SYSTEM_ID); if (s != null) { pp.setSystemId(s); } s = (String)hints.get(KEY_XML_DECLARATION); if (s != null) { pp.setXMLDeclaration(s); } pp.print(in, out); out.flush(); } catch (IOException e) { getErrorHandler().fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
public void print(Reader r, Writer w) throws TranscoderException, IOException { try { scanner = new XMLScanner(r); output = new OutputManager(this, w); writer = w; type = scanner.next(); printXMLDecl(); misc1: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc1; } } printDoctype(); misc2: for (;;) { scanner.clearBuffer(); switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc2; } } if (type != LexicalUnits.START_TAG) { throw fatalError("element", null); } printElement(); misc3: for (;;) { switch (type) { case LexicalUnits.S: output.printTopSpaces(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; default: break misc3; } } } catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected TranscoderException fatalError(String key, Object[] params) throws TranscoderException { TranscoderException result = new TranscoderException(key); errorHandler.fatalError(result); return result; }
// in sources/org/apache/batik/transcoder/ToSVGAbstractTranscoder.java
protected void writeSVGToOutput(SVGGraphics2D svgGenerator, Element svgRoot, TranscoderOutput output) throws TranscoderException { Document doc = output.getDocument(); if (doc != null) return; // XMLFilter XMLFilter xmlFilter = output.getXMLFilter(); if (xmlFilter != null) { handler.fatalError(new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE)); } try { boolean escaped = false; if (hints.containsKey(KEY_ESCAPED)) { escaped = ((Boolean)hints.get(KEY_ESCAPED)).booleanValue(); } // Output stream OutputStream os = output.getOutputStream(); if (os != null) { svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } // Writer Writer wr = output.getWriter(); if (wr != null) { svgGenerator.stream(svgRoot, wr, false, escaped); return; } // URI String uri = output.getURI(); if ( uri != null ){ try{ URL url = new URL(uri); URLConnection urlCnx = url.openConnection(); os = urlCnx.getOutputStream(); svgGenerator.stream(svgRoot, new OutputStreamWriter(os), false, escaped); return; } catch (MalformedURLException e){ handler.fatalError(new TranscoderException(e)); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); } } } catch(IOException e){ throw new TranscoderException(e); } throw new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE); }
// in sources/org/apache/batik/transcoder/image/JPEGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); // The outputstream wrapper protects the JPEG encoder from // exceptions due to stream closings. If it gets an exception // it nulls out the stream and just ignores any future calls. ostream = new OutputStreamWrapper(ostream); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("jpeg.badoutput", null)); } try { float quality; if (hints.containsKey(KEY_QUALITY)) { quality = ((Float)hints.get(KEY_QUALITY)).floatValue(); } else { TranscoderException te; te = new TranscoderException (Messages.formatMessage("jpeg.unspecifiedQuality", null)); handler.error(te); quality = 0.75f; } ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/jpeg"); ImageWriterParams params = new ImageWriterParams(); params.setJPEGQuality(quality, true); float PixSzMM = userAgent.getPixelUnitToMillimeter(); int PixSzInch = (int)(25.4 / PixSzMM + 0.5); params.setResolution(PixSzInch); writer.writeImage(img, ostream, params); ostream.flush(); } catch (IOException ex) { throw new TranscoderException(ex); } }
// in sources/org/apache/batik/transcoder/image/PNGTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { OutputStream ostream = output.getOutputStream(); if (ostream == null) { throw new TranscoderException( Messages.formatMessage("png.badoutput", null)); } // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.png.PNGTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.PNGTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write PNG file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/TIFFTranscoder.java
public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { // // This is a trick so that viewers which do not support the alpha // channel will see a white background (and not a black one). // boolean forceTransparentWhite = false; if (hints.containsKey(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)) { forceTransparentWhite = ((Boolean)hints.get (PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE)).booleanValue(); } if (forceTransparentWhite) { SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel)img.getSampleModel(); forceTransparentWhite(img, sppsm); } WriteAdapter adapter = getWriteAdapter( "org.apache.batik.ext.awt.image.codec.tiff.TIFFTranscoderInternalCodecWriteAdapter"); if (adapter == null) { adapter = getWriteAdapter( "org.apache.batik.transcoder.image.TIFFTranscoderImageIOWriteAdapter"); } if (adapter == null) { throw new TranscoderException( "Could not write TIFF file because no WriteAdapter is availble"); } adapter.writeImage(this, img, output); }
// in sources/org/apache/batik/transcoder/image/ImageTranscoder.java
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { // Sets up root, curTxf & curAoi super.transcode(document, uri, output); // prepare the image to be painted int w = (int)(width+0.5); int h = (int)(height+0.5); // paint the SVG document using the bridge package // create the appropriate renderer ImageRenderer renderer = createRenderer(); renderer.updateOffScreen(w, h); // curTxf.translate(0.5, 0.5); renderer.setTransform(curTxf); renderer.setTree(this.root); this.root = null; // We're done with it... try { // now we are sure that the aoi is the image size Shape raoi = new Rectangle2D.Float(0, 0, width, height); // Warning: the renderer's AOI must be in user space renderer.repaint(curTxf.createInverse(). createTransformedShape(raoi)); BufferedImage rend = renderer.getOffScreen(); renderer = null; // We're done with it... BufferedImage dest = createImage(w, h); Graphics2D g2d = GraphicsUtil.createGraphics(dest); if (hints.containsKey(KEY_BACKGROUND_COLOR)) { Paint bgcolor = (Paint)hints.get(KEY_BACKGROUND_COLOR); g2d.setComposite(AlphaComposite.SrcOver); g2d.setPaint(bgcolor); g2d.fillRect(0, 0, w, h); } if (rend != null) { // might be null if the svg document is empty g2d.drawRenderedImage(rend, new AffineTransform()); } g2d.dispose(); rend = null; // We're done with it... writeImage(dest, output); } catch (Exception ex) { throw new TranscoderException(ex); } }
5
            
// in sources/org/apache/batik/transcoder/print/PrintTranscoder.java
catch(TranscoderException e){ drawError(_g, e); return PAGE_EXISTS; }
// in sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
catch(TranscoderException ex) { // at this time, all TranscoderExceptions are fatal errors handler.fatalError(ex); return; }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
3
            
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
// in sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
catch (TranscoderException ex) { throw new RuntimeException( ex.getMessage() ); }
3
unknown (Lib) TransformerException 0 0 6
            
// in sources/org/apache/batik/dom/AbstractDocument.java
protected Result convertSingleNode(XObject xo, short type) throws javax.xml.transform.TransformerException { return new Result(xo.nodelist().item(0), type); }
// in sources/org/apache/batik/dom/AbstractDocument.java
protected Result convertBoolean(XObject xo) throws javax.xml.transform.TransformerException { return new Result(xo.bool()); }
// in sources/org/apache/batik/dom/AbstractDocument.java
protected Result convertNumber(XObject xo) throws javax.xml.transform.TransformerException { return new Result(xo.num()); }
// in sources/org/apache/batik/dom/AbstractDocument.java
protected Result convertNodeIterator(XObject xo, short type) throws javax.xml.transform.TransformerException { return new Result(xo.nodelist(), type); }
5
            
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
5
            
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expr, te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { xpath.getPatternString(), te.getMessage() }); }
// in sources/org/apache/batik/dom/AbstractDocument.java
catch (javax.xml.transform.TransformerException te) { throw createXPathException (XPathException.TYPE_ERR, "xpath.cannot.convert.result", new Object[] { new Integer(type), te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.invalid.expression", new Object[] { expression, te.getMessage() }); }
// in sources/org/apache/batik/bridge/svg12/XPathPatternContentSelector.java
catch (javax.xml.transform.TransformerException te) { AbstractDocument doc = (AbstractDocument) contentElement.getOwnerDocument(); throw doc.createXPathException (XPathException.INVALID_EXPRESSION_ERR, "xpath.error", new Object[] { expression, te.getMessage() }); }
0
unknown (Lib) UnsupportedEncodingException 0 0 0 3
            
// in sources/org/apache/batik/transcoder/wmf/tosvg/WMFUtilities.java
catch (UnsupportedEncodingException e) { // Fall through to use default. }
// in sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
catch (UnsupportedEncodingException uee) { enc = null; }
// in sources/org/apache/batik/bridge/ScriptingEnvironment.java
catch (UnsupportedEncodingException uee) { // Try with no encoding. r = new InputStreamReader(is); }
0 0
unknown (Lib) UnsupportedFlavorException 0 0 0 1
            
// in sources/org/apache/batik/apps/svgbrowser/DOMDocumentTree.java
catch (UnsupportedFlavorException e) { e.printStackTrace(); }
0 0
runtime (Lib) UnsupportedOperationException 67
            
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void set(Object o) { Rectangle r = (Rectangle)o; if (!removeOk) throw new IllegalStateException ("set can only be called directly after next/previous"); if (forward) idx--; if (idx+1<size) { if (rects[idx+1].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx>=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } rects[idx] = r; removeOk = false; }
// in sources/org/apache/batik/ext/awt/geom/RectListManager.java
public void add(Object o) { Rectangle r = (Rectangle)o; if (idx<size) { if (rects[idx].x < r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } if (idx!=0) { if (rects[idx-1].x > r.x) throw new UnsupportedOperationException ("RectListManager entries must be sorted"); } ensureCapacity(size+1); if (idx != size) System.arraycopy(rects, idx, rects, idx+1, size-idx); rects[idx] = r; idx++; removeOk = false; }
// in sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFLZWDecoder.java
public byte[] decode(byte[] data, byte[] uncompData, int h) { if(data[0] == (byte)0x00 && data[1] == (byte)0x01) { throw new UnsupportedOperationException("TIFFLZWDecoder0"); } initializeStringTable(); this.data = data; this.h = h; this.uncompData = uncompData; // Initialize pointers bytePointer = 0; bitPointer = 0; dstIndex = 0; nextData = 0; nextBits = 0; int code, oldCode = 0; byte[] string; while ( ((code = getNextCode()) != 257) && dstIndex != uncompData.length) { if (code == 256) { initializeStringTable(); code = getNextCode(); if (code == 257) { break; } writeString(stringTable[code]); oldCode = code; } else { if (code < tableIndex) { string = stringTable[code]; writeString(string); addStringToTable(stringTable[oldCode], string[0]); oldCode = code; } else { string = stringTable[oldCode]; string = composeString(string, string[0]); writeString(string); addStringToTable(string); oldCode = code; } } } // Horizontal Differencing Predictor if (predictor == 2) { int count; for (int j = 0; j < h; j++) { count = samplesPerPixel * (j * w + 1); for (int i = samplesPerPixel; i < w * samplesPerPixel; i++) { uncompData[count] += uncompData[count - samplesPerPixel]; count++; } } } return uncompData; }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java
public void writeImage(RenderedImage image, OutputStream out, ImageWriterParams params) throws IOException { Iterator iter; iter = ImageIO.getImageWritersByMIMEType(getMIMEType()); javax.imageio.ImageWriter iiowriter = null; try { iiowriter = (javax.imageio.ImageWriter)iter.next(); if (iiowriter != null) { iiowriter.addIIOWriteWarningListener(this); ImageOutputStream imgout = null; try { imgout = ImageIO.createImageOutputStream(out); ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params); ImageTypeSpecifier type; if (iwParam.getDestinationType() != null) { type = iwParam.getDestinationType(); } else { type = ImageTypeSpecifier.createFromRenderedImage(image); } //Handle metadata IIOMetadata meta = iiowriter.getDefaultImageMetadata( type, iwParam); //meta might be null for some JAI codecs as they don't support metadata if (params != null && meta != null) { meta = updateMetadata(meta, params); } //Write image iiowriter.setOutput(imgout); IIOImage iioimg = new IIOImage(image, null, meta); iiowriter.write(null, iioimg, iwParam); } finally { if (imgout != null) { System.err.println("closing"); imgout.close(); } } } else { throw new UnsupportedOperationException("No ImageIO codec for writing " + getMIMEType() + " is available!"); } } finally { if (iiowriter != null) { System.err.println("disposing"); iiowriter.dispose(); } } }
// in sources/org/apache/batik/ext/awt/image/codec/imageio/AbstractImageIORegistryEntry.java
Override public void run() { Filter filt; try{ Iterator<ImageReader> iter = ImageIO.getImageReadersByMIMEType( getMimeTypes().get(0).toString()); if (!iter.hasNext()) { throw new UnsupportedOperationException( "No image reader for " + getFormatName() + " available!"); } ImageReader reader = iter.next(); ImageInputStream imageIn = ImageIO.createImageInputStream(is); reader.setInput(imageIn, true); int imageIndex = 0; dr.setBounds(new Rectangle2D.Double (0, 0, reader.getWidth(imageIndex), reader.getHeight(imageIndex))); CachableRed cr; //Naive approach possibly wasting lots of memory //and ignoring the gamma correction done by PNGRed :-( //Matches the code used by the former JPEGRegistryEntry, though. BufferedImage bi = reader.read(imageIndex); cr = GraphicsUtil.wrap(bi); cr = new Any2sRGBRed(cr); cr = new FormatRed(cr, GraphicsUtil.sRGB_Unpre); WritableRaster wr = (WritableRaster)cr.getData(); ColorModel cm = cr.getColorModel(); BufferedImage image = new BufferedImage (cm, wr, cm.isAlphaPremultiplied(), null); cr = GraphicsUtil.wrap(image); filt = new RedRable(cr); } catch (IOException ioe) { // Something bad happened here... filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); } catch (ThreadDeath td) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); dr.setSource(filt); throw td; } catch (Throwable t) { filt = ImageTagRegistry.getBrokenLinkImage (AbstractImageIORegistryEntry.this, errCode, errParam); } dr.setSource(filt); }
// in sources/org/apache/batik/ext/awt/image/SVGComposite.java
public CompositeContext createContext(ColorModel srcCM, ColorModel dstCM, RenderingHints hints) { if (false) { ColorSpace srcCS = srcCM.getColorSpace(); ColorSpace dstCS = dstCM.getColorSpace(); System.out.println("srcCS: " + srcCS); System.out.println("dstCS: " + dstCS); System.out.println ("lRGB: " + ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)); System.out.println ("sRGB: " + ColorSpace.getInstance(ColorSpace.CS_sRGB)); } // Orig Time no int_pack = 51792 // Simple int_pack = 19600 boolean use_int_pack = (is_INT_PACK(srcCM) && is_INT_PACK(dstCM)); // use_int_pack = false; switch (rule.getRule()) { case CompositeRule.RULE_OVER: if (!dstCM.hasAlpha()) { if (use_int_pack) return new OverCompositeContext_INT_PACK_NA(srcCM, dstCM); else return new OverCompositeContext_NA (srcCM, dstCM); } if (!use_int_pack) return new OverCompositeContext(srcCM, dstCM); if (srcCM.isAlphaPremultiplied()) return new OverCompositeContext_INT_PACK(srcCM, dstCM); else return new OverCompositeContext_INT_PACK_UNPRE(srcCM, dstCM); case CompositeRule.RULE_IN: if (use_int_pack) return new InCompositeContext_INT_PACK(srcCM, dstCM); else return new InCompositeContext (srcCM, dstCM); case CompositeRule.RULE_OUT: if (use_int_pack) return new OutCompositeContext_INT_PACK(srcCM, dstCM); else return new OutCompositeContext (srcCM, dstCM); case CompositeRule.RULE_ATOP: if (use_int_pack) return new AtopCompositeContext_INT_PACK(srcCM, dstCM); else return new AtopCompositeContext(srcCM, dstCM); case CompositeRule.RULE_XOR: if (use_int_pack) return new XorCompositeContext_INT_PACK(srcCM, dstCM); else return new XorCompositeContext (srcCM, dstCM); case CompositeRule.RULE_ARITHMETIC: float [] coeff = rule.getCoefficients(); if (use_int_pack) return new ArithCompositeContext_INT_PACK_LUT (srcCM, dstCM, coeff[0], coeff[1], coeff[2], coeff[3]); else return new ArithCompositeContext (srcCM, dstCM, coeff[0], coeff[1], coeff[2], coeff[3]); case CompositeRule.RULE_MULTIPLY: if (use_int_pack) return new MultiplyCompositeContext_INT_PACK(srcCM, dstCM); else return new MultiplyCompositeContext(srcCM, dstCM); case CompositeRule.RULE_SCREEN: if (use_int_pack) return new ScreenCompositeContext_INT_PACK(srcCM, dstCM); else return new ScreenCompositeContext (srcCM, dstCM); case CompositeRule.RULE_DARKEN: if (use_int_pack) return new DarkenCompositeContext_INT_PACK(srcCM, dstCM); else return new DarkenCompositeContext (srcCM, dstCM); case CompositeRule.RULE_LIGHTEN: if (use_int_pack) return new LightenCompositeContext_INT_PACK(srcCM, dstCM); else return new LightenCompositeContext (srcCM, dstCM); default: throw new UnsupportedOperationException ("Unknown composite rule requested."); } }
// in sources/org/apache/batik/dom/svg/SVGOMUseElement.java
public SVGElementInstance getInstanceRoot() { throw new UnsupportedOperationException ("SVGUseElement.getInstanceRoot is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMUseElement.java
public SVGElementInstance getAnimatedInstanceRoot() { throw new UnsupportedOperationException ("SVGUseElement.getAnimatedInstanceRoot is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMComponentTransferFunctionElement.java
public SVGAnimatedNumberList getTableValues() { // XXX throw new UnsupportedOperationException ("SVGComponentTransferFunctionElement.getTableValues is not implemented"); // return tableValues; }
// in sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
public org.w3c.dom.stylesheets.StyleSheet getSheet() { throw new UnsupportedOperationException ("LinkStyle.getSheet() is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java
public SVGAnimatedNumber getBaseFrequencyX() { throw new UnsupportedOperationException ("SVGFETurbulenceElement.getBaseFrequencyX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFETurbulenceElement.java
public SVGAnimatedNumber getBaseFrequencyY() { throw new UnsupportedOperationException ("SVGFETurbulenceElement.getBaseFrequencyY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public SVGAnimatedInteger getFilterResX() { throw new UnsupportedOperationException ("SVGFilterElement.getFilterResX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public SVGAnimatedInteger getFilterResY() { throw new UnsupportedOperationException ("SVGFilterElement.getFilterResY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFilterElement.java
public void setFilterRes(int filterResX, int filterResY) { throw new UnsupportedOperationException ("SVGFilterElement.setFilterRes is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumberList getKernelMatrix() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelMatrix is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getOrderX() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getOrderX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getOrderY() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getOrderY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getTargetX() { // Default value relative to orderX... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getTargetX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedInteger getTargetY() { // Default value relative to orderY... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getTargetY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getDivisor() { // Default value relative to kernel matrix... throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getDivisor is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getKernelUnitLengthX() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelUnitLengthX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEConvolveMatrixElement.java
public SVGAnimatedNumber getKernelUnitLengthY() { throw new UnsupportedOperationException ("SVGFEConvolveMatrixElement.getKernelUnitLengthY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEColorMatrixElement.java
public SVGAnimatedNumberList getValues() { throw new UnsupportedOperationException ("SVGFEColorMatrixElement.getValues is not implemented"); // XXX // return values; }
// in sources/org/apache/batik/dom/svg/SVGOMPathElement.java
public SVGAnimatedNumber getPathLength() { throw new UnsupportedOperationException ("SVGPathElement.getPathLength is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public boolean getUseCurrentView() { throw new UnsupportedOperationException ("SVGSVGElement.getUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public void setUseCurrentView(boolean useCurrentView) throws DOMException { throw new UnsupportedOperationException ("SVGSVGElement.setUseCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
public SVGViewSpec getCurrentView() { throw new UnsupportedOperationException ("SVGSVGElement.getCurrentView is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getRequiredFeatures(Element elt) { throw new UnsupportedOperationException ("SVGTests.getRequiredFeatures is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getRequiredExtensions(Element elt) { throw new UnsupportedOperationException ("SVGTests.getRequiredExtensions is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static SVGStringList getSystemLanguage(Element elt) { throw new UnsupportedOperationException ("SVGTests.getSystemLanguage is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGTestsSupport.java
public static boolean hasExtension(Element elt, String extension) { throw new UnsupportedOperationException ("SVGTests.hasExtension is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMGradientElement.java
public SVGAnimatedTransformList getGradientTransform() { throw new UnsupportedOperationException ("SVGGradientElement.getGradientTransform is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMViewElement.java
public SVGStringList getViewTarget() { throw new UnsupportedOperationException ("SVGViewElement.getViewTarget is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMViewElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedPathData.java
public SVGPathSegList getAnimatedNormalizedPathSegList() { throw new UnsupportedOperationException ("SVGAnimatedPathData.getAnimatedNormalizedPathSegList is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEGaussianBlurElement.java
public SVGAnimatedNumber getStdDeviationX() { throw new UnsupportedOperationException ("SVGFEGaussianBlurElement.getStdDeviationX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEGaussianBlurElement.java
public SVGAnimatedNumber getStdDeviationY() { throw new UnsupportedOperationException ("SVGFEGaussianBlurElement.getStdDeviationY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
public SVGAnimatedTransformList getPatternTransform() { throw new UnsupportedOperationException ("SVGPatternElement.getPatternTransform is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEMorphologyElement.java
public SVGAnimatedNumber getRadiusX() { throw new UnsupportedOperationException ("SVGFEMorphologyElement.getRadiusX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEMorphologyElement.java
public SVGAnimatedNumber getRadiusY() { throw new UnsupportedOperationException ("SVGFEMorphologyElement.getRadiusY is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleSheet createCSSStyleSheet(String title, String media) { throw new UnsupportedOperationException ("DOMImplementationCSS.createCSSStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleDeclaration createCSSStyleDeclaration() { throw new UnsupportedOperationException ("CSSStyleDeclarationFactory.createCSSStyleDeclaration is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public StyleSheet createStyleSheet(Node n, HashTable attrs) { throw new UnsupportedOperationException ("StyleSheetFactory.createStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGDOMImplementation.java
public CSSStyleSheet getUserAgentStyleSheet() { throw new UnsupportedOperationException ("StyleSheetFactory.getUserAgentStyleSheet is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
protected void updateAnimatedValue(AnimatableValue val) { // XXX TODO throw new UnsupportedOperationException ("Animation of marker orient value is not implemented"); }
// in sources/org/apache/batik/dom/svg/SVGOMAnimatedMarkerOrientValue.java
public AnimatableValue getUnderlyingValue(AnimationTarget target) { // XXX TODO throw new UnsupportedOperationException ("Animation of marker orient value is not implemented"); }
// in sources/org/apache/batik/dom/svg/SVGOMSymbolElement.java
public SVGAnimatedRect getViewBox() { throw new UnsupportedOperationException ("SVGFitToViewBox.getViewBox is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEDiffuseLightingElement.java
public SVGAnimatedNumber getKernelUnitLengthX() { throw new UnsupportedOperationException ("SVGFEDiffuseLightingElement.getKernelUnitLengthX is not implemented"); // XXX }
// in sources/org/apache/batik/dom/svg/SVGOMFEDiffuseLightingElement.java
public SVGAnimatedNumber getKernelUnitLengthY() { throw new UnsupportedOperationException ("SVGFEDiffuseLightingElement.getKernelUnitLengthY is not implemented"); // XXX }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public CSSStyleDeclaration getStyle() { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public CSSValue getPresentationAttribute(String name) { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/extension/StylableExtensionElement.java
public SVGAnimatedString getClassName() { throw new UnsupportedOperationException("Not implemented"); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean addAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean addAll(int index, Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean removeAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public void clear() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/CompositeGraphicsNode.java
public List subList(int fromIndex, int toIndex) { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
private void incrementKeyTarget() { // <!> FIXME TODO: Not implemented. throw new UnsupportedOperationException("Increment not implemented."); }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
private void decrementKeyTarget() { // <!> FIXME TODO: Not implemented. throw new UnsupportedOperationException("Decrement not implemented."); }
// in sources/org/apache/batik/util/DoublyIndexedTable.java
public void remove() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/util/RunnableQueue.java
public void remove() { throw new UnsupportedOperationException(); }
// in sources/org/apache/batik/css/engine/CSSEngine.java
private void throwUnsupportedEx(){ throw new UnsupportedOperationException("you try to use an empty method in Adapter-class" ); }
0 0 4
            
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
// in sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
catch (UnsupportedOperationException ex) { }
0 0
unknown (Lib) WrappedException 2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
public Object run(Context cx) { try { return cx.evaluateReader(globalObject, scriptReader, description, 1, rhinoClassLoader); } catch (IOException ioe) { throw new WrappedException(ioe); } }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
public Object callWithDomain(Object securityDomain, final Context cx, final Callable callable, final Scriptable scope, final Scriptable thisObj, final Object[] args) { AccessControlContext acc; if (securityDomain instanceof AccessControlContext) acc = (AccessControlContext)securityDomain; else { RhinoClassLoader loader = (RhinoClassLoader)securityDomain; acc = loader.rhinoAccessControlContext; } PrivilegedExceptionAction execAction = new PrivilegedExceptionAction() { public Object run() { return callable.call(cx, scope, thisObj, args); } }; try { return AccessController.doPrivileged(execAction, acc); } catch (Exception e) { throw new WrappedException(e); } }
2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (IOException ioe) { throw new WrappedException(ioe); }
// in sources/org/apache/batik/script/rhino/BatikSecurityController.java
catch (Exception e) { throw new WrappedException(e); }
0 2
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
4
            
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
// in sources/org/apache/batik/script/rhino/RhinoInterpreter.java
catch (WrappedException we) { Throwable w = we.getWrappedException(); if (w instanceof Exception) { throw new InterpreterException ((Exception) w, w.getMessage(), -1, -1); } else { throw new InterpreterException(w.getMessage(), -1, -1); } }
4
runtime (Domain) XMLException
public class XMLException extends RuntimeException {

    /**
     * @serial The embedded exception if tunnelling, or null.
     */    
    protected Exception exception;

    /**
     * Creates a new XMLException.
     * @param message The error or warning message.
     */
    public XMLException (String message) {
        super(message);
        exception = null;
    }
    
    /**
     * Creates a new XMLException wrapping an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, and its message will become the default message for
     * the XMLException.
     * @param e The exception to be wrapped in a XMLException.
     */
    public XMLException (Exception e) {
        exception = e;
    }
    
    /**
     * Creates a new XMLException from an existing exception.
     *
     * <p>The existing exception will be embedded in the new
     * one, but the new exception will have its own message.
     * @param message The detail message.
     * @param e The exception to be wrapped in a SAXException.
     */
    public XMLException (String message, Exception e) {
        super(message);
        exception = e;
    }
    
    /**
     * Return a detail message for this exception.
     *
     * <p>If there is a embedded exception, and if the XMLException
     * has no detail message of its own, this method will return
     * the detail message from the embedded exception.
     * @return The error or warning message.
     */
    public String getMessage () {
        String message = super.getMessage();
        
        if (message == null && exception != null) {
            return exception.getMessage();
        } else {
            return message;
        }
    }
    
    /**
     * Return the embedded exception, if any.
     * @return The embedded exception, or null if there is none.
     */
    public Exception getException () {
        return exception;
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the 
     * standard error stream.
     */
    public void printStackTrace() { 
        if (exception == null) {
            super.printStackTrace();
        } else {
            synchronized (System.err) {
                System.err.println(this);
                super.printStackTrace();
            }
        }
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the 
     * specified print stream.
     *
     * @param s <code>PrintStream</code> to use for output
     */
    public void printStackTrace(java.io.PrintStream s) { 
        if (exception == null) {
            super.printStackTrace(s);
        } else {
            synchronized (s) {
                s.println(this);
                super.printStackTrace();
            }
        }
    }

    /**
     * Prints this <code>Exception</code> and its backtrace to the specified
     * print writer.
     *
     * @param s <code>PrintWriter</code> to use for output
     */
    public void printStackTrace(java.io.PrintWriter s) { 
        if (exception == null) {
            super.printStackTrace(s);
        } else {
            synchronized (s) {
                s.println(this);
                super.printStackTrace(s);
            }
        }
    }
}
4
            
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
4
            
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
// in sources/org/apache/batik/xml/XMLScanner.java
catch (IOException e) { throw new XMLException(e); }
41
            
// in sources/org/apache/batik/xml/XMLScanner.java
public int next() throws XMLException { return next(context); }
// in sources/org/apache/batik/xml/XMLScanner.java
public int next(int ctx) throws XMLException { start = position - 1; try { switch (ctx) { case DOCUMENT_START_CONTEXT: type = nextInDocumentStart(); break; case TOP_LEVEL_CONTEXT: type = nextInTopLevel(); break; case PI_CONTEXT: type = nextInPI(); break; case START_TAG_CONTEXT: type = nextInStartTag(); break; case ATTRIBUTE_VALUE_CONTEXT: type = nextInAttributeValue(); break; case CONTENT_CONTEXT: type = nextInContent(); break; case END_TAG_CONTEXT: type = nextInEndTag(); break; case CDATA_SECTION_CONTEXT: type = nextInCDATASection(); break; case XML_DECL_CONTEXT: type = nextInXMLDecl(); break; case DOCTYPE_CONTEXT: type = nextInDoctype(); break; case DTD_DECLARATIONS_CONTEXT: type = nextInDTDDeclarations(); break; case ELEMENT_DECLARATION_CONTEXT: type = nextInElementDeclaration(); break; case ATTLIST_CONTEXT: type = nextInAttList(); break; case NOTATION_CONTEXT: type = nextInNotation(); break; case ENTITY_CONTEXT: type = nextInEntity(); break; case ENTITY_VALUE_CONTEXT: return nextInEntityValue(); case NOTATION_TYPE_CONTEXT: return nextInNotationType(); case ENUMERATION_CONTEXT: return nextInEnumeration(); default: throw new IllegalArgumentException("unexpected ctx:" + ctx ); } } catch (IOException e) { throw new XMLException(e); } end = position - ((current == -1) ? 0 : 1); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDocumentStart() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.S; case '<': switch (nextChar()) { case '?': int c1 = nextChar(); if (c1 == -1 || !XMLUtilities.isXMLNameFirstCharacter((char)c1)) { throw createXMLException("invalid.pi.target"); } context = PI_CONTEXT; int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if (c1 == 'x' && c2 == 'm' && c3 == 'l') { context = XML_DECL_CONTEXT; return LexicalUnits.XML_DECL_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.doctype"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: if (depth == 0) { throw createXMLException("invalid.character"); } else { return nextInContent(); } } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInTopLevel() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'D': context = DOCTYPE_CONTEXT; return readIdentifier("OCTYPE", LexicalUnits.DOCTYPE_START, -1); default: throw createXMLException("invalid.character"); } default: context = START_TAG_CONTEXT; depth++; return readName(LexicalUnits.START_TAG); } case -1: return LexicalUnits.EOF; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInPI() throws IOException, XMLException { if (piEndRead) { piEndRead = false; context = (depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.PI_END; } switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '?': if (nextChar() != '>') { throw createXMLException("pi.end.expected"); } nextChar(); if (inDTD) { context = DTD_DECLARATIONS_CONTEXT; } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } return LexicalUnits.PI_END; default: do { do { nextChar(); } while (current != -1 && current != '?'); nextChar(); } while (current != -1 && current != '>'); nextChar(); piEndRead = true; return LexicalUnits.PI_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInStartTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '/': if (nextChar() != '>') { throw createXMLException("malformed.tag.end"); } nextChar(); context = (--depth == 0) ? TOP_LEVEL_CONTEXT : CONTENT_CONTEXT; return LexicalUnits.EMPTY_ELEMENT_END; case '>': nextChar(); context = CONTENT_CONTEXT; return LexicalUnits.END_CHAR; case '=': nextChar(); return LexicalUnits.EQ; case '"': attrDelimiter = '"'; nextChar(); for (;;) { switch (current) { case '"': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } case '\'': attrDelimiter = '\''; nextChar(); for (;;) { switch (current) { case '\'': nextChar(); return LexicalUnits.STRING; case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '<': throw createXMLException("invalid.character"); case -1: throw createXMLException("unexpected.eof"); } nextChar(); } default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttributeValue() throws IOException, XMLException { if (current == -1) { return LexicalUnits.EOF; } if (current == '&') { return readReference(); } else { loop: for (;;) { switch (current) { case '&': case '<': case -1: break loop; case '"': case '\'': if (current == attrDelimiter) { break loop; } } nextChar(); } switch (current) { case -1: break; case '<': throw createXMLException("invalid.character"); case '&': return LexicalUnits.ATTRIBUTE_FRAGMENT; case '\'': case '"': nextChar(); if (inDTD) { context = ATTLIST_CONTEXT; } else { context = START_TAG_CONTEXT; } } return LexicalUnits.LAST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInContent() throws IOException, XMLException { switch (current) { case -1: return LexicalUnits.EOF; case '&': return readReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case '[': context = CDATA_SECTION_CONTEXT; return readIdentifier("CDATA[", LexicalUnits.CDATA_START, -1); default: throw createXMLException("invalid.character"); } case '/': nextChar(); context = END_TAG_CONTEXT; return readName(LexicalUnits.END_TAG); default: depth++; context = START_TAG_CONTEXT; return readName(LexicalUnits.START_TAG); } default: loop: for (;;) { switch (current) { default: nextChar(); break; case -1: case '&': case '<': break loop; } } return LexicalUnits.CHARACTER_DATA; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEndTag() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': if (--depth < 0) { throw createXMLException("unexpected.end.tag"); } else if (depth == 0) { context = TOP_LEVEL_CONTEXT; } else { context = CONTENT_CONTEXT; } nextChar(); return LexicalUnits.END_CHAR; default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInCDATASection() throws IOException, XMLException { if (cdataEndRead) { cdataEndRead = false; context = CONTENT_CONTEXT; return LexicalUnits.SECTION_END; } while (current != -1) { while (current != ']' && current != -1) { nextChar(); } if (current != -1) { nextChar(); if (current == ']') { nextChar(); if (current == '>') { break; } } } } if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); cdataEndRead = true; return LexicalUnits.CHARACTER_DATA; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInXMLDecl() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case 'v': return readIdentifier("ersion", LexicalUnits.VERSION_IDENTIFIER, -1); case 'e': return readIdentifier("ncoding", LexicalUnits.ENCODING_IDENTIFIER, -1); case 's': return readIdentifier("tandalone", LexicalUnits.STANDALONE_IDENTIFIER, -1); case '=': nextChar(); return LexicalUnits.EQ; case '?': nextChar(); if (current != '>') { throw createXMLException("pi.end.expected"); } nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.PI_END; case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDoctype() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = TOP_LEVEL_CONTEXT; return LexicalUnits.END_CHAR; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); case '[': nextChar(); context = DTD_DECLARATIONS_CONTEXT; inDTD = true; return LexicalUnits.LSQUARE_BRACKET; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInDTDDeclarations() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case ']': nextChar(); context = DOCTYPE_CONTEXT; inDTD = false; return LexicalUnits.RSQUARE_BRACKET; case '%': return readPEReference(); case '<': switch (nextChar()) { case '?': context = PI_CONTEXT; return readPIStart(); case '!': switch (nextChar()) { case '-': return readComment(); case 'E': switch (nextChar()) { case 'L': context = ELEMENT_DECLARATION_CONTEXT; return readIdentifier ("EMENT", LexicalUnits.ELEMENT_DECLARATION_START, -1); case 'N': context = ENTITY_CONTEXT; return readIdentifier("TITY", LexicalUnits.ENTITY_START, -1); default: throw createXMLException("invalid.character"); } case 'A': context = ATTLIST_CONTEXT; return readIdentifier("TTLIST", LexicalUnits.ATTLIST_START, -1); case 'N': context = NOTATION_CONTEXT; return readIdentifier("OTATION", LexicalUnits.NOTATION_START, -1); default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } default: throw createXMLException("invalid.character"); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readString() throws IOException, XMLException { do { nextChar(); } while (current != -1 && current != attrDelimiter); if (current == -1) { throw createXMLException("unexpected.eof"); } nextChar(); return LexicalUnits.STRING; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readComment() throws IOException, XMLException { if (nextChar() != '-') { throw createXMLException("malformed.comment"); } int c = nextChar(); while (c != -1) { while (c != -1 && c != '-') { c = nextChar(); } c = nextChar(); if (c == '-') { break; } } if (c == -1) { throw createXMLException("unexpected.eof"); } c = nextChar(); if (c != '>') { throw createXMLException("malformed.comment"); } nextChar(); return LexicalUnits.COMMENT; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readIdentifier(String s, int type, int ntype) throws IOException, XMLException { int len = s.length(); for (int i = 0; i < len; i++) { nextChar(); if (current != s.charAt(i)) { if (ntype == -1) { throw createXMLException("invalid.character"); } else { while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return ntype; } } } nextChar(); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readName(int type) throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.name"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPIStart() throws IOException, XMLException { int c1 = nextChar(); if (c1 == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("malformed.pi.target"); } int c2 = nextChar(); if (c2 == -1 || !XMLUtilities.isXMLNameCharacter((char)c2)) { return LexicalUnits.PI_START; } int c3 = nextChar(); if (c3 == -1 || !XMLUtilities.isXMLNameCharacter((char)c3)) { return LexicalUnits.PI_START; } int c4 = nextChar(); if (c4 != -1 && XMLUtilities.isXMLNameCharacter((char)c4)) { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.PI_START; } if ((c1 == 'x' || c1 == 'X') && (c2 == 'm' || c2 == 'M') && (c3 == 'l' || c3 == 'L')) { throw createXMLException("xml.reserved"); } return LexicalUnits.PI_START; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInElementDeclaration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'E': return readIdentifier("MPTY", LexicalUnits.EMPTY_IDENTIFIER, LexicalUnits.NAME); case 'A': return readIdentifier("NY", LexicalUnits.ANY_IDENTIFIER, LexicalUnits.NAME); case '?': nextChar(); return LexicalUnits.QUESTION; case '+': nextChar(); return LexicalUnits.PLUS; case '*': nextChar(); return LexicalUnits.STAR; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); return LexicalUnits.RIGHT_BRACE; case '|': nextChar(); return LexicalUnits.PIPE; case ',': nextChar(); return LexicalUnits.COMMA; case '#': return readIdentifier("PCDATA", LexicalUnits.PCDATA_IDENTIFIER, -1); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInAttList() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return type = LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'C': return readIdentifier("DATA", LexicalUnits.CDATA_IDENTIFIER, LexicalUnits.NAME); case 'I': nextChar(); if (current != 'D') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ID_IDENTIFIER; } if (current != 'R') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'F') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREF_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.IDREFS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; case 'N': switch (nextChar()) { default: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'O': context = NOTATION_TYPE_CONTEXT; return readIdentifier("TATION", LexicalUnits.NOTATION_IDENTIFIER, LexicalUnits.NAME); case 'M': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'O') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'K') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKEN_IDENTIFIER; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NMTOKENS_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case 'E': nextChar(); if (current != 'N') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'I') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'T') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return type = LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } switch (current) { case 'Y': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.ENTITY_IDENTIFIER; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; case 'I': nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'E') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } nextChar(); if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } if (current != 'S') { do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } return LexicalUnits.ENTITIES_IDENTIFIER; default: if (current == -1 || !XMLUtilities.isXMLNameCharacter((char)current)) { return LexicalUnits.NAME; } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); return LexicalUnits.NAME; } case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&') { do { nextChar(); } while (current != -1 && current != '"' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '"': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&'); } switch (current) { case '&': context = ATTRIBUTE_VALUE_CONTEXT; return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': nextChar(); return LexicalUnits.STRING; default: throw createXMLException("invalid.character"); } case '#': switch (nextChar()) { case 'R': return readIdentifier("EQUIRED", LexicalUnits.REQUIRED_IDENTIFIER, -1); case 'I': return readIdentifier("MPLIED", LexicalUnits.IMPLIED_IDENTIFIER, -1); case 'F': return readIdentifier("IXED", LexicalUnits.FIXED_IDENTIFIER, -1); default: throw createXMLException("invalid.character"); } case '(': nextChar(); context = ENUMERATION_CONTEXT; return LexicalUnits.LEFT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotation() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': int t = readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("malformed.parameter.entity"); } nextChar(); return t; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; return readString(); case '\'': attrDelimiter = '\''; return readString(); default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntity() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '>': nextChar(); context = DTD_DECLARATIONS_CONTEXT; return LexicalUnits.END_CHAR; case '%': nextChar(); return LexicalUnits.PERCENT; case 'S': return readIdentifier("YSTEM", LexicalUnits.SYSTEM_IDENTIFIER, LexicalUnits.NAME); case 'P': return readIdentifier("UBLIC", LexicalUnits.PUBLIC_IDENTIFIER, LexicalUnits.NAME); case 'N': return readIdentifier("DATA", LexicalUnits.NDATA_IDENTIFIER, LexicalUnits.NAME); case '"': attrDelimiter = '"'; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '"' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '"' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '"': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; case '\'': attrDelimiter = '\''; nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (current != '\'' && current != '&' && current != '%') { do { nextChar(); } while (current != -1 && current != '\'' && current != '&' && current != '%'); } switch (current) { default: throw createXMLException("invalid.character"); case '&': case '%': context = ENTITY_VALUE_CONTEXT; break; case '\'': nextChar(); return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEntityValue() throws IOException, XMLException { switch (current) { case '&': return readReference(); case '%': int t = nextChar(); readName(LexicalUnits.PARAMETER_ENTITY_REFERENCE); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return t; default: while (current != -1 && current != attrDelimiter && current != '&' && current != '%') { nextChar(); } switch (current) { case -1: throw createXMLException("unexpected.eof"); case '\'': case '"': nextChar(); context = ENTITY_CONTEXT; return LexicalUnits.STRING; } return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInNotationType() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case '(': nextChar(); return LexicalUnits.LEFT_BRACE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readName(LexicalUnits.NAME); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int nextInEnumeration() throws IOException, XMLException { switch (current) { case 0x9: case 0xA: case 0xD: case 0x20: do { nextChar(); } while (current != -1 && XMLUtilities.isXMLSpace((char)current)); return LexicalUnits.S; case '|': nextChar(); return LexicalUnits.PIPE; case ')': nextChar(); context = ATTLIST_CONTEXT; return LexicalUnits.RIGHT_BRACE; default: return readNmtoken(); } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readReference() throws IOException, XMLException { nextChar(); if (current == '#') { nextChar(); int i = 0; switch (current) { case 'x': do { i++; nextChar(); } while ((current >= '0' && current <= '9') || (current >= 'a' && current <= 'f') || (current >= 'A' && current <= 'F')); break; default: do { i++; nextChar(); } while (current >= '0' && current <= '9'); break; case -1: throw createXMLException("unexpected.eof"); } if (i == 1 || current != ';') { throw createXMLException("character.reference"); } nextChar(); return LexicalUnits.CHARACTER_REFERENCE; } else { int t = readName(LexicalUnits.ENTITY_REFERENCE); if (current != ';') { throw createXMLException("character.reference"); } nextChar(); return t; } }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readPEReference() throws IOException, XMLException { nextChar(); if (current == -1) { throw createXMLException("unexpected.eof"); } if (!XMLUtilities.isXMLNameFirstCharacter((char)current)) { throw createXMLException("invalid.parameter.entity"); } do { nextChar(); } while (current != -1 && XMLUtilities.isXMLNameCharacter((char)current)); if (current != ';') { throw createXMLException("invalid.parameter.entity"); } nextChar(); return LexicalUnits.PARAMETER_ENTITY_REFERENCE; }
// in sources/org/apache/batik/xml/XMLScanner.java
protected int readNmtoken() throws IOException, XMLException { if (current == -1) { throw createXMLException("unexpected.eof"); } while (XMLUtilities.isXMLNameCharacter((char)current)) { nextChar(); } return LexicalUnits.NMTOKEN; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printXMLDecl() throws TranscoderException, XMLException, IOException { if (xmlDeclaration == null) { if (type == LexicalUnits.XML_DECL_START) { if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space3 = null; if (type == LexicalUnits.S) { space3 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } char[] version = getCurrentValue(); char versionDelim = scanner.getStringDelimiter(); char[] space4 = null; char[] space5 = null; char[] space6 = null; char[] encoding = null; char encodingDelim = 0; char[] space7 = null; char[] space8 = null; char[] space9 = null; char[] standalone = null; char standaloneDelim = 0; char[] space10 = null; type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space6 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } encoding = getCurrentValue(); encodingDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space7 = getCurrentValue(); type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { space8 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { space9 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } standalone = getCurrentValue(); standaloneDelim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space10 = getCurrentValue(); type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printXMLDecl(space1, space2, space3, version, versionDelim, space4, space5, space6, encoding, encodingDelim, space7, space8, space9, standalone, standaloneDelim, space10); type = scanner.next(); } } else { output.printString(xmlDeclaration); output.printNewline(); if (type == LexicalUnits.XML_DECL_START) { // Skip the XML declaraction. if (scanner.next() != LexicalUnits.S) { throw fatalError("space", null); } if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) { throw fatalError("token", new Object[] { "version" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); if (type == LexicalUnits.ENCODING_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } if (type == LexicalUnits.STANDALONE_IDENTIFIER) { type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } type = scanner.next(); } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printPI() throws TranscoderException, XMLException, IOException { char[] target = getCurrentValue(); type = scanner.next(); char[] space = {}; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.PI_DATA) { throw fatalError("pi.data", null); } char[] data = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.PI_END) { throw fatalError("pi.end", null); } output.printPI(target, space, data); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printDoctype() throws TranscoderException, XMLException, IOException { switch (doctypeOption) { default: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] root = getCurrentValue(); char[] space2 = null; String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; char[] space5 = null; type = scanner.next(); if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space4 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space5 = getCurrentValue(); type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); type = scanner.next(); if (type == LexicalUnits.S) { space4 = getCurrentValue(); type = scanner.next(); } } } if (doctypeOption == DOCTYPE_CHANGE) { if (publicId != null) { externalId = "PUBLIC"; string1 = publicId.toCharArray(); string1Delim = '"'; if (systemId != null) { string2 = systemId.toCharArray(); string2Delim = '"'; } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string1Delim = '"'; string2 = null; } } output.printDoctypeStart(space1, root, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); if (type == LexicalUnits.LSQUARE_BRACKET) { output.printCharacter('['); type = scanner.next(); dtd: for (;;) { switch (type) { case LexicalUnits.S: output.printSpaces(getCurrentValue(), true); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.PI_START: printPI(); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: output.printParameterEntityReference(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); break; case LexicalUnits.ELEMENT_DECLARATION_START: scanner.clearBuffer(); printElementDeclaration(); break; case LexicalUnits.ATTLIST_START: scanner.clearBuffer(); printAttlist(); break; case LexicalUnits.NOTATION_START: scanner.clearBuffer(); printNotation(); break; case LexicalUnits.ENTITY_START: scanner.clearBuffer(); printEntityDeclaration(); break; case LexicalUnits.RSQUARE_BRACKET: output.printCharacter(']'); scanner.clearBuffer(); type = scanner.next(); break dtd; default: throw fatalError("xml", null); } } } char[] endSpace = null; if (type == LexicalUnits.S) { endSpace = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } type = scanner.next(); output.printDoctypeEnd(endSpace); } else { if (doctypeOption == DOCTYPE_CHANGE) { String externalId = "PUBLIC"; char[] string1 = SVGConstants.SVG_PUBLIC_ID.toCharArray(); char[] string2 = SVGConstants.SVG_SYSTEM_ID.toCharArray(); if (publicId != null) { string1 = publicId.toCharArray(); if (systemId != null) { string2 = systemId.toCharArray(); } } else if (systemId != null) { externalId = "SYSTEM"; string1 = systemId.toCharArray(); string2 = null; } output.printDoctypeStart(new char[] { ' ' }, new char[] { 's', 'v', 'g' }, new char[] { ' ' }, externalId, new char[] { ' ' }, string1, '"', new char[] { ' ' }, string2, '"', null); output.printDoctypeEnd(null); } } break; case DOCTYPE_REMOVE: if (type == LexicalUnits.DOCTYPE_START) { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); switch (type) { case LexicalUnits.PUBLIC_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } break; case LexicalUnits.SYSTEM_IDENTIFIER: type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } type = scanner.next(); if (type == LexicalUnits.S) { type = scanner.next(); } } } if (type == LexicalUnits.LSQUARE_BRACKET) { do { type = scanner.next(); } while (type != LexicalUnits.RSQUARE_BRACKET); } if (type == LexicalUnits.S) { type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected String printElement() throws TranscoderException, XMLException, IOException { char[] name = getCurrentValue(); String nameStr = new String(name); List attributes = new LinkedList(); char[] space = null; type = scanner.next(); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type == LexicalUnits.NAME) { char[] attName = getCurrentValue(); char[] space1 = null; type = scanner.next(); if (type == LexicalUnits.S) { space1 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.EQ) { throw fatalError("token", new Object[] { "=" }); } type = scanner.next(); char[] space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("string", null); } char valueDelim = scanner.getStringDelimiter(); boolean hasEntityRef = false; StringBuffer sb = new StringBuffer(); sb.append(getCurrentValue()); loop: for (;;) { scanner.clearBuffer(); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: case LexicalUnits.ATTRIBUTE_FRAGMENT: sb.append(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: hasEntityRef = true; sb.append("&#"); sb.append(getCurrentValue()); sb.append(";"); break; case LexicalUnits.ENTITY_REFERENCE: hasEntityRef = true; sb.append("&"); sb.append(getCurrentValue()); sb.append(";"); break; default: break loop; } } attributes.add(new OutputManager.AttributeInfo(space, attName, space1, space2, new String(sb), valueDelim, hasEntityRef)); space = null; } } output.printElementStart(name, attributes, space); switch (type) { default: throw fatalError("xml", null); case LexicalUnits.EMPTY_ELEMENT_END: output.printElementEnd(null, null); break; case LexicalUnits.END_CHAR: output.printCharacter('>'); type = scanner.next(); printContent(allowSpaceAtStart(nameStr)); if (type != LexicalUnits.END_TAG) { throw fatalError("end.tag", null); } name = getCurrentValue(); type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } output.printElementEnd(name, space); if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } } type = scanner.next(); return nameStr; }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException { boolean preceedingSpace = false; content: for (;;) { switch (type) { case LexicalUnits.COMMENT: output.printComment(getCurrentValue()); scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; break; case LexicalUnits.PI_START: printPI(); preceedingSpace = false; break; case LexicalUnits.CHARACTER_DATA: preceedingSpace = output.printCharacterData (getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; break; case LexicalUnits.CDATA_START: type = scanner.next(); if (type != LexicalUnits.CHARACTER_DATA) { throw fatalError("character.data", null); } output.printCDATASection(getCurrentValue()); if (scanner.next() != LexicalUnits.SECTION_END) { throw fatalError("section.end", null); } scanner.clearBuffer(); type = scanner.next(); preceedingSpace = false; spaceAtStart = false; break; case LexicalUnits.START_TAG: String name = printElement(); spaceAtStart = allowSpaceAtStart(name); break; case LexicalUnits.CHARACTER_REFERENCE: output.printCharacterEntityReference(getCurrentValue(), spaceAtStart, preceedingSpace); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; case LexicalUnits.ENTITY_REFERENCE: output.printEntityReference(getCurrentValue(), spaceAtStart); scanner.clearBuffer(); type = scanner.next(); spaceAtStart = false; preceedingSpace = false; break; default: break content; } } }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printNotation() throws TranscoderException, XMLException, IOException { int t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space1 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); t = scanner.next(); String externalId = null; char[] space3 = null; char[] string1 = null; char string1Delim = 0; char[] space4 = null; char[] string2 = null; char string2Delim = 0; switch (t) { default: throw fatalError("notation.definition", null); case LexicalUnits.PUBLIC_IDENTIFIER: externalId = "PUBLIC"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); if (t == LexicalUnits.S) { space4 = getCurrentValue(); t = scanner.next(); if (t == LexicalUnits.STRING) { string2 = getCurrentValue(); string2Delim = scanner.getStringDelimiter(); t = scanner.next(); } } break; case LexicalUnits.SYSTEM_IDENTIFIER: externalId = "SYSTEM"; t = scanner.next(); if (t != LexicalUnits.S) { throw fatalError("space", null); } space3 = getCurrentValue(); t = scanner.next(); if (t != LexicalUnits.STRING) { throw fatalError("string", null); } string1 = getCurrentValue(); string1Delim = scanner.getStringDelimiter(); t = scanner.next(); } char[] space5 = null; if (t == LexicalUnits.S) { space5 = getCurrentValue(); t = scanner.next(); } if (t != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printNotation(space1, name, space2, externalId, space3, string1, string1Delim, space4, string2, string2Delim, space5); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printAttlist() throws TranscoderException, XMLException, IOException { type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } char[] name = getCurrentValue(); type = scanner.next(); output.printAttlistStart(space, name); while (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.NAME) { break; } name = getCurrentValue(); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } char[] space2 = getCurrentValue(); type = scanner.next(); output.printAttName(space, name, space2); switch (type) { case LexicalUnits.CDATA_IDENTIFIER: case LexicalUnits.ID_IDENTIFIER: case LexicalUnits.IDREF_IDENTIFIER: case LexicalUnits.IDREFS_IDENTIFIER: case LexicalUnits.ENTITY_IDENTIFIER: case LexicalUnits.ENTITIES_IDENTIFIER: case LexicalUnits.NMTOKEN_IDENTIFIER: case LexicalUnits.NMTOKENS_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.NOTATION_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.LEFT_BRACE) { throw fatalError("left.brace", null); } type = scanner.next(); List names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: type = scanner.next(); names = new LinkedList(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); loop: for (;;) { switch (type) { default: break loop; case LexicalUnits.PIPE: type = scanner.next(); space = null; if (type == LexicalUnits.S) { space = getCurrentValue(); type = scanner.next(); } if (type != LexicalUnits.NMTOKEN) { throw fatalError("nmtoken", null); } name = getCurrentValue(); type = scanner.next(); space2 = null; if (type == LexicalUnits.S) { space2 = getCurrentValue(); type = scanner.next(); } names.add(new OutputManager.NameInfo(space, name, space2)); } } if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } output.printEnumeration(names); type = scanner.next(); } if (type == LexicalUnits.S) { output.printSpaces(getCurrentValue(), true); type = scanner.next(); } switch (type) { default: throw fatalError("default.decl", null); case LexicalUnits.REQUIRED_IDENTIFIER: case LexicalUnits.IMPLIED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.FIXED_IDENTIFIER: output.printCharacters(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } output.printSpaces(getCurrentValue(), false); type = scanner.next(); if (type != LexicalUnits.STRING && type != LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT) { throw fatalError("space", null); } case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: output.printCharacter(scanner.getStringDelimiter()); output.printCharacters(getCurrentValue()); loop: for (;;) { type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: output.printCharacters(getCurrentValue()); break; case LexicalUnits.CHARACTER_REFERENCE: output.printString("&#"); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; case LexicalUnits.ENTITY_REFERENCE: output.printCharacter('&'); output.printCharacters(getCurrentValue()); output.printCharacter(';'); break; default: break loop; } } output.printCharacter(scanner.getStringDelimiter()); } space = null; } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } output.printAttlistEnd(space); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printEntityDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ENTITY"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); boolean pe = false; switch (type) { default: throw fatalError("xml", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PERCENT: pe = true; writer.write('%'); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { case LexicalUnits.STRING: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: char sd = scanner.getStringDelimiter(); writer.write(sd); loop: for (;;) { switch (type) { case LexicalUnits.STRING: case LexicalUnits.ATTRIBUTE_FRAGMENT: case LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT: case LexicalUnits.LAST_ATTRIBUTE_FRAGMENT: writer.write(getCurrentValue()); break; case LexicalUnits.ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; case LexicalUnits.PARAMETER_ENTITY_REFERENCE: writer.write('&'); writer.write(getCurrentValue()); writer.write(';'); break; default: break loop; } type = scanner.next(); } writer.write(sd); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write(">"); type = scanner.next(); return; case LexicalUnits.PUBLIC_IDENTIFIER: writer.write("PUBLIC"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write("\" \""); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(getCurrentValue()); writer.write('"'); break; case LexicalUnits.SYSTEM_IDENTIFIER: writer.write("SYSTEM"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } type = scanner.next(); if (type != LexicalUnits.STRING) { throw fatalError("string", null); } writer.write(" \""); writer.write(getCurrentValue()); writer.write('"'); } type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); if (!pe && type == LexicalUnits.NDATA_IDENTIFIER) { writer.write("NDATA"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); type = scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printElementDeclaration() throws TranscoderException, XMLException, IOException { writer.write("<!ELEMENT"); type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); type = scanner.next(); switch (type) { default: throw fatalError("name", null); case LexicalUnits.NAME: writer.write(getCurrentValue()); } type = scanner.next(); if (type != LexicalUnits.S) { throw fatalError("space", null); } writer.write(getCurrentValue()); switch (type = scanner.next()) { case LexicalUnits.EMPTY_IDENTIFIER: writer.write("EMPTY"); type = scanner.next(); break; case LexicalUnits.ANY_IDENTIFIER: writer.write("ANY"); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } mixed: switch (type) { case LexicalUnits.PCDATA_IDENTIFIER: writer.write("#PCDATA"); type = scanner.next(); for (;;) { switch (type) { case LexicalUnits.S: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.PIPE: writer.write('|'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.NAME) { throw fatalError("name", null); } writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.RIGHT_BRACE: writer.write(')'); type = scanner.next(); break mixed; } } case LexicalUnits.NAME: case LexicalUnits.LEFT_BRACE: printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); } } } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } if (type != LexicalUnits.END_CHAR) { throw fatalError("end", null); } writer.write('>'); scanner.next(); }
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
protected void printChildren() throws TranscoderException, XMLException, IOException { int op = 0; loop: for (;;) { switch (type) { default: throw new RuntimeException("Invalid XML"); case LexicalUnits.NAME: writer.write(getCurrentValue()); type = scanner.next(); break; case LexicalUnits.LEFT_BRACE: writer.write('('); type = scanner.next(); if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } printChildren(); if (type != LexicalUnits.RIGHT_BRACE) { throw fatalError("right.brace", null); } writer.write(')'); type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.RIGHT_BRACE: break loop; case LexicalUnits.STAR: writer.write('*'); type = scanner.next(); break; case LexicalUnits.QUESTION: writer.write('?'); type = scanner.next(); break; case LexicalUnits.PLUS: writer.write('+'); type = scanner.next(); break; } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } switch (type) { case LexicalUnits.PIPE: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write('|'); op = type; type = scanner.next(); break; case LexicalUnits.COMMA: if (op != 0 && op != type) { throw new RuntimeException("Invalid XML"); } writer.write(','); op = type; type = scanner.next(); } if (type == LexicalUnits.S) { writer.write(getCurrentValue()); type = scanner.next(); } } }
1
            
// in sources/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java
catch (XMLException e) { errorHandler.fatalError(new TranscoderException(e.getMessage())); }
0 0
unknown (Lib) ZipException 0 0 0 1
            
// in sources/org/apache/batik/util/ParsedURLData.java
catch (ZipException ze) { is.reset(); return is; }
0 0

Miscellanous Metrics

nF = Number of Finally 53
nF = Number of Try-Finally (without catch) 32
Number of Methods with Finally (nMF) 52 / 14692 (0.4%)
Number of Finally with a Continue 0
Number of Finally with a Return 0
Number of Finally with a Throw 1
Number of Finally with a Break 1
Number of different exception types thrown 35
Number of Domain exception types thrown 14
Number of different exception types caught 59
Number of Domain exception types caught 10
Number of exception declarations in signatures 2162
Number of different exceptions types declared in method signatures 33
Number of library exceptions types declared in method signatures 23
Number of Domain exceptions types declared in method signatures 10
Number of Catch with a continue 4
Number of Catch with a return 77
Number of Catch with a Break 1
nbIf = Number of If 11948
nbFor = Number of For 1725
Number of Method with an if 4170 / 14692
Number of Methods with a for 1033 / 14692
Number of Method starting with a try 134 / 14692 (0.9%)
Number of Expressions 176085
Number of Expressions in try 10116 (5.7%)