xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r730757 - /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
Date Fri, 02 Jan 2009 15:32:30 GMT
Author: jeremias
Date: Fri Jan  2 07:32:30 2009
New Revision: 730757

URL: http://svn.apache.org/viewvc?rev=730757&view=rev
Log:
Bugzilla #45938:
Improved error message if an unsupported image format is used.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java?rev=730757&r1=730756&r2=730757&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
Fri Jan  2 07:32:30 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
  */
 
 /* $Id$ */
- 
+
 package org.apache.xmlgraphics.image.loader;
 
 import java.io.IOException;
@@ -46,15 +46,15 @@
 
     /** Holds all registered interface implementations for the image package */
     private ImageImplRegistry registry = ImageImplRegistry.getDefaultInstance();
-    
+
     /** Provides session-independent information */
     private ImageContext imageContext;
 
     /** The image cache for this instance */
     private ImageCache cache = new ImageCache();
-    
+
     private PipelineFactory pipelineFactory = new PipelineFactory(this);
-    
+
     /**
      * Main constructor.
      * @param context the session-independent context information
@@ -62,7 +62,7 @@
     public ImageManager(ImageContext context) {
         this.imageContext = context;
     }
-    
+
     /**
      * Returns the ImageImplRegistry in use by the ImageManager.
      * @return the ImageImplRegistry
@@ -70,7 +70,7 @@
     public ImageImplRegistry getRegistry() {
         return this.registry;
     }
-    
+
     /**
      * Returns the ImageContext in use by the ImageManager.
      * @return the ImageContext
@@ -78,7 +78,7 @@
     public ImageContext getImageContext() {
         return this.imageContext;
     }
-    
+
     /**
      * Returns the ImageCache in use by the ImageManager.
      * @return the ImageCache
@@ -86,7 +86,7 @@
     public ImageCache getCache() {
         return this.cache;
     }
-    
+
     /**
      * Returns the PipelineFactory in use by the ImageManager.
      * @return the PipelineFactory
@@ -94,11 +94,11 @@
     public PipelineFactory getPipelineFactory() {
         return this.pipelineFactory;
     }
-    
+
     /**
      * Returns an ImageInfo object containing its intrinsic size for a given URI. The ImageInfo
      * is retrieved from an image cache if it has been requested before.
-     * @param uri the URI of the image 
+     * @param uri the URI of the image
      * @param session the session context through which to resolve the URI if the image is
not in
      *                the cache
      * @return the ImageInfo object created from the image
@@ -139,7 +139,7 @@
         session.returnSource(uri, src);
         return info;
     }
-    
+
     /**
      * Preloads an image, i.e. the format of the image is identified and some basic information
      * (MIME type, intrinsic size and possibly other values) are loaded and returned as an
@@ -167,7 +167,8 @@
                 return info;
             }
         }
-        throw new ImageException("No ImagePreloader found for " + uri);
+        throw new ImageException("The file format is not supported. No ImagePreloader found
for "
+                + uri);
     }
 
     /**
@@ -178,7 +179,7 @@
      * Optionally, it is possible to pass in Map of hints. These hints may be used by ImageLoaders
      * and ImageConverters to act on the image. See {@link ImageProcessingHints} for common
hints
      * used by the bundled implementations. You can, of course, define your own hints.
-     * @param info the ImageInfo instance for the image (obtained by 
+     * @param info the ImageInfo instance for the image (obtained by
      *                  {@link #getImageInfo(String, ImageSessionContext)})
      * @param flavor the requested image flavor.
      * @param hints a Map of hints to any of the background components or null
@@ -194,7 +195,7 @@
         if (hints == null) {
             hints = Collections.EMPTY_MAP;
         }
-        
+
         Image img = null;
         ImageProviderPipeline pipeline = getPipelineFactory().newImageConverterPipeline(
                 info, flavor);
@@ -209,7 +210,7 @@
         ImageUtil.closeQuietly(session.getSource(info.getOriginalURI()));
         return img;
     }
-    
+
     /**
      * Loads an image. The caller can indicate what kind of image flavors are requested.
When this
      * method is called the code looks for a suitable ImageLoader and, if necessary, builds
@@ -219,7 +220,7 @@
      * Optionally, it is possible to pass in Map of hints. These hints may be used by ImageLoaders
      * and ImageConverters to act on the image. See {@link ImageProcessingHints} for common
hints
      * used by the bundled implementations. You can, of course, define your own hints.
-     * @param info the ImageInfo instance for the image (obtained by 
+     * @param info the ImageInfo instance for the image (obtained by
      *                  {@link #getImageInfo(String, ImageSessionContext)})
      * @param flavors the requested image flavors (in preferred order).
      * @param hints a Map of hints to any of the background components or null
@@ -240,7 +241,7 @@
         ImageProviderPipeline[] candidates = getPipelineFactory().determineCandidatePipelines(
                 info, flavors);
         ImageProviderPipeline pipeline = choosePipeline(candidates);
-        
+
         if (pipeline != null) {
             img = pipeline.execute(info, hints, session);
         }
@@ -257,7 +258,7 @@
      * Loads an image with no hints. See
      * {@link #getImage(ImageInfo, ImageFlavor, Map, ImageSessionContext)} for more
      * information.
-     * @param info the ImageInfo instance for the image (obtained by 
+     * @param info the ImageInfo instance for the image (obtained by
      *                  {@link #getImageInfo(String, ImageSessionContext)})
      * @param flavor the requested image flavor.
      * @param session the session context
@@ -275,7 +276,7 @@
      * Loads an image with no hints. See
      * {@link #getImage(ImageInfo, ImageFlavor[], Map, ImageSessionContext)} for more
      * information.
-     * @param info the ImageInfo instance for the image (obtained by 
+     * @param info the ImageInfo instance for the image (obtained by
      *                  {@link #getImageInfo(String, ImageSessionContext)})
      * @param flavors the requested image flavors (in preferred order).
      * @param session the session context
@@ -288,7 +289,7 @@
             throws ImageException, IOException {
         return getImage(info, flavors, ImageUtil.getDefaultHints(session), session);
     }
-    
+
     /**
      * Converts an image. The caller can indicate what kind of image flavors are requested.
When
      * this method is called the code looks for a suitable combination of ImageConverters
so it
@@ -312,7 +313,7 @@
             hints = Collections.EMPTY_MAP;
         }
         ImageInfo info = image.getInfo();
-        
+
         Image img = null;
         int count = flavors.length;
         for (int i = 0; i < count; i++) {
@@ -324,13 +325,13 @@
         ImageProviderPipeline[] candidates = getPipelineFactory().determineCandidatePipelines(
                 image, flavors);
         ImageProviderPipeline pipeline = choosePipeline(candidates);
-        
+
         if (pipeline != null) {
             img = pipeline.execute(info, image, hints, null);
         }
         if (img == null) {
             throw new ImageException(
-                    "Cannot convert image " + image 
+                    "Cannot convert image " + image
                     + " (no suitable converter combination available)");
         }
         return img;
@@ -351,7 +352,7 @@
                 throws ImageException, IOException {
         return convertImage(image, flavors, null);
     }
-    
+
     /**
      * Chooses the best {@link ImageProviderPipeline} from a set of candidates.
      * @param candidates the candidates
@@ -376,5 +377,5 @@
         }
         return pipeline;
     }
-    
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message