cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/serialization SVGSerializer.java
Date Sun, 28 Mar 2004 05:29:04 GMT
antonio     2004/03/27 21:29:04

  Modified:    src/blocks/batik/java/org/apache/cocoon/xml/dom
                        SVGBuilder.java
               src/blocks/batik/java/org/apache/cocoon/components/url
                        SourceProtocolHandler.java
                        StreamJDKRegistryEntry.java
               src/blocks/batik/java/org/apache/cocoon/generation
                        FragmentExtractorGenerator.java
               src/blocks/batik/java/org/apache/cocoon/transformation
                        FragmentExtractorTransformer.java
               src/blocks/batik/java/org/apache/cocoon/serialization
                        SVGSerializer.java
  Log:
  Formatting code
  
  Revision  Changes    Path
  1.8       +5 -6      cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/xml/dom/SVGBuilder.java
  
  Index: SVGBuilder.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/xml/dom/SVGBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SVGBuilder.java	5 Mar 2004 13:01:47 -0000	1.7
  +++ SVGBuilder.java	28 Mar 2004 05:29:04 -0000	1.8
  @@ -21,6 +21,7 @@
   
   import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
   import org.apache.batik.dom.svg.SVGDOMImplementation;
  +import org.apache.batik.dom.svg.SVGOMDocument;
   
   import org.apache.cocoon.xml.XMLConsumer;
   
  @@ -105,7 +106,7 @@
       }
   
       /**
  -     * Receive notification of the beginning of a document.
  +     * Receive notification of the end of a document.
        *
        * @exception SAXException If this method was not called appropriately.
        */
  @@ -122,12 +123,11 @@
                       baseURL = new URL("http://localhost/");
                       getLogger().warn("setDocumentLocator was not called, will use http://localhost/
as base URI");
                   }
  -                ((org.apache.batik.dom.svg.SVGOMDocument)super.document).setURLObject(baseURL);
  +                ((SVGOMDocument)super.document).setURLObject(baseURL);
               } catch (MalformedURLException e) {
                   getLogger().warn("Unable to set document base URI to " + baseURL + ", will
default to http://localhost/", e);
  -                ((org.apache.batik.dom.svg.SVGOMDocument)super.document).setURLObject(new
URL("http://localhost/"));
  +                ((SVGOMDocument)super.document).setURLObject(new URL("http://localhost/"));
               }
  -
               notify(super.document);
           } catch (SAXException se) {
               throw se;
  @@ -148,5 +148,4 @@
       public void recycle() {
           locator = null;
       }
  -
   }
  
  
  
  1.3       +24 -28    cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/components/url/SourceProtocolHandler.java
  
  Index: SourceProtocolHandler.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/components/url/SourceProtocolHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SourceProtocolHandler.java	5 Mar 2004 13:01:45 -0000	1.2
  +++ SourceProtocolHandler.java	28 Mar 2004 05:29:04 -0000	1.3
  @@ -37,10 +37,10 @@
    * @version CVS $Id$
    */
   public class SourceProtocolHandler extends AbstractParsedURLProtocolHandler {
  -    
  +
       /** Thread-local source resolver */
       protected static InheritableThreadLocal localResolver = new InheritableThreadLocal();
  -    
  +
       /** Batik's original default handler */        
       protected static ParsedURLProtocolHandler defaultHandler;
   
  @@ -58,23 +58,21 @@
       static {        
           // Keep the default handler, if any
           SourceProtocolHandler.defaultHandler = ParsedURL.getHandler(null);
  -        
  +
           // Set the default handler to our handler
           ParsedURL.registerHandler(new SourceProtocolHandler(null));
  -        
  +
           // Add a new image registry entry to handle image streams
           ImageTagRegistry.getRegistry().register(new StreamJDKRegistryEntry());
  -        
       }
  -    
  +
       /**
        * Set the resolver to be used within the current thread.
        */
       public static void setup(SourceResolver resolver) {
           localResolver.set(resolver);
       }
  -    
  -    
  +
       /**
        * Get the thread-local resolver.
        */
  @@ -85,11 +83,11 @@
       }
   
       //-------------------------------------------------------------------------
  -    
  +
       public SourceProtocolHandler(String protocol) {
           super(protocol);
       }
  -    
  +
       public ParsedURLData parseURL(ParsedURL baseURL, String urlStr) {
           SourceResolver resolver = (SourceResolver)localResolver.get();
           if (resolver == null) {
  @@ -113,58 +111,56 @@
        * Reimplementation of some methods of ParsedURLData since we cannot use <code>java.net.URL</code>.
        */
       static class SourceParsedURLData extends ParsedURLData {
  -        
           public String url;
  -        
  +
           private Source source;
           private SourceResolver resolver;
   
           public SourceParsedURLData(String urlStr, SourceResolver resolver) {
  -            
               this.url = urlStr;
               this.resolver = resolver;
               
               // ParsedURLData has some public members which seems to be required to
               // have a value. This sucks.
               int pidx=0, idx;
  -    
  +
               idx = urlStr.indexOf(':');
               if (idx != -1) {
                   // May have a protocol spec...
                   this.protocol = urlStr.substring(pidx, idx);
  -                if (this.protocol.indexOf('/') == -1)
  +                if (this.protocol.indexOf('/') == -1) {
                       pidx = idx+1;
  -                else {
  +                } else {
                       // Got a slash in protocol probably means 
                       // no protocol given, (host and port?)
                       this.protocol = null;
                       pidx = 0;
                   }
               }
  -    
  +
               idx = urlStr.indexOf(',',pidx);
               if (idx != -1) {
                   this.host = urlStr.substring(pidx, idx);
                   pidx = idx+1;
               }
  -            if (pidx != urlStr.length()) 
  +            if (pidx != urlStr.length()) { 
                   this.path = urlStr.substring(pidx);
  -            
  -            
  +            }
  +
               // Now do the real job
  -            
  +
               // Setup source
               try {
                   this.source = resolver.resolveURI(this.url);
               } catch(Exception e) {
                   throw new CascadingRuntimeException("Cannot resolve " + this.url, e);
               }
  -                
  +
               // Get Mime-type
  -            
  +
               // First try the source itself
               this.contentType = this.source.getMimeType();
  -            
  +
               if (this.contentType == null) {
                   // Guess it from the URL extension
                   if (url.endsWith(".gif")) {
  @@ -176,7 +172,7 @@
                   }
               }
           }
  -        
  +
           public boolean complete() {
               return (this.url != null);
           }
  @@ -187,7 +183,7 @@
               portStr += ",";
               return portStr;
           }
  -                
  +
           public String toString() {
               return this.url;
           }
  @@ -198,7 +194,7 @@
            */
           protected InputStream openStreamInternal (String userAgent, Iterator mimeTypes,
Iterator encodingTypes)
               throws IOException {
  -                
  +
               try {
                   return source.getInputStream();
               } catch(Exception e) {
  
  
  
  1.4       +14 -12    cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/components/url/StreamJDKRegistryEntry.java
  
  Index: StreamJDKRegistryEntry.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/components/url/StreamJDKRegistryEntry.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StreamJDKRegistryEntry.java	5 Mar 2004 13:01:45 -0000	1.3
  +++ StreamJDKRegistryEntry.java	28 Mar 2004 05:29:04 -0000	1.4
  @@ -36,7 +36,6 @@
   import org.apache.batik.ext.awt.image.spi.URLRegistryEntry;
   import org.apache.batik.util.ParsedURL;
   
  -
   /**
    * This Image tag registy entry is setup to wrap the core JDK Image stream tools.  
    * 
  @@ -72,8 +71,9 @@
        */
       public boolean isCompatibleURL(ParsedURL purl) {
           String contentType = purl.getContentType();
  -        if (contentType == null)
  +        if (contentType == null) {
               return false;
  +        }
   
           Iterator iter = this.getMimeTypes().iterator();
           while (iter.hasNext()) {
  @@ -116,13 +116,14 @@
   
           Toolkit tk = Toolkit.getDefaultToolkit();
           final Image img = tk.createImage(buffer);
  -        if (img == null)
  +        if (img == null) {
               return null;
  +        }
   
           RenderedImage ri = loadImage(img);
  -        if (ri == null)
  +        if (ri == null) {
               return null;
  -
  +        }
           return new RedRable(GraphicsUtil.wrap(ri));
       }
   
  @@ -134,10 +135,11 @@
       public RenderedImage loadImage(Image img) {
           // In some cases the image will be a
           // BufferedImage (subclass of RenderedImage).
  -        if (img instanceof RenderedImage)
  +        if (img instanceof RenderedImage) {
               return (RenderedImage)img;
  +        }
   
  -                    // Setup the mediaTracker.
  +        // Setup the mediaTracker.
           int myID;
           synchronized (mediaTracker) {
               myID = id++;
  @@ -161,12 +163,12 @@
           mediaTracker.removeImage(img, myID);
   
           if ((img.getWidth(null)  == -1)||
  -            (img.getHeight(null) == -1))
  +            (img.getHeight(null) == -1)) {
               return null;
  +        }
   
  -                    // Build the image to .
  -        BufferedImage bi = null;
  -        bi = new BufferedImage(img.getWidth(null),
  +        // Build the image to .
  +        BufferedImage bi = new BufferedImage(img.getWidth(null),
                                  img.getHeight(null),
                                  BufferedImage.TYPE_INT_ARGB);
           Graphics2D g2d = bi.createGraphics();
  
  
  
  1.6       +7 -3      cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/generation/FragmentExtractorGenerator.java
  
  Index: FragmentExtractorGenerator.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/generation/FragmentExtractorGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FragmentExtractorGenerator.java	5 Mar 2004 13:01:46 -0000	1.5
  +++ FragmentExtractorGenerator.java	28 Mar 2004 05:29:04 -0000	1.6
  @@ -15,6 +15,8 @@
    */
   package org.apache.cocoon.generation;
   
  +import java.io.Serializable;
  +
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.ProcessingException;
  @@ -51,7 +53,7 @@
        *
        * @return The generated key hashes the src
        */
  -    public java.io.Serializable getKey() {
  +    public Serializable getKey() {
           return this.source;
       }
   
  @@ -86,7 +88,9 @@
               deserializer.deserialize(fragment);
   
           } catch (ServiceException ce) {
  -            getLogger().error("Could not lookup for component.", ce);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Could not lookup for component.", ce);
  +            }
               throw new SAXException("Could not lookup for component.", ce);
           } finally {
               this.manager.release(store);
  
  
  
  1.11      +3 -2      cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/transformation/FragmentExtractorTransformer.java
  
  Index: FragmentExtractorTransformer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/transformation/FragmentExtractorTransformer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FragmentExtractorTransformer.java	5 Mar 2004 13:01:46 -0000	1.10
  +++ FragmentExtractorTransformer.java	28 Mar 2004 05:29:04 -0000	1.11
  @@ -16,6 +16,7 @@
   package org.apache.cocoon.transformation;
   
   import java.io.IOException;
  +import java.io.Serializable;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -152,7 +153,7 @@
        *
        * @return "1"
        */
  -    public java.io.Serializable getKey() {
  +    public Serializable getKey() {
           return "1";
       }
   
  
  
  
  1.16      +3 -2      cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/serialization/SVGSerializer.java
  
  Index: SVGSerializer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/batik/java/org/apache/cocoon/serialization/SVGSerializer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SVGSerializer.java	5 Mar 2004 13:01:46 -0000	1.15
  +++ SVGSerializer.java	28 Mar 2004 05:29:04 -0000	1.16
  @@ -17,6 +17,7 @@
   
   import java.awt.Color;
   import java.io.OutputStream;
  +import java.io.Serializable;
   
   import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.avalon.framework.configuration.Configurable;
  @@ -238,7 +239,7 @@
        * @return The generated key or <code>0</code> if the component
        *              is currently not cacheable.
        */
  -    public java.io.Serializable getKey() {
  +    public Serializable getKey() {
           return "1";
       }
   
  
  
  

Mime
View raw message