Author: euluis
Date: 2010-04-20 14:31:17-0700
New Revision: 18317
Modified:
trunk/src/argouml-app/src/org/argouml/application/helpers/ResourceLoader.java
Log:
issue 5618: ResourceLoader.lookupIconResource(xxx) return null in headless environments.
Modified: trunk/src/argouml-app/src/org/argouml/application/helpers/ResourceLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/application/helpers/ResourceLoader.java?view=diff&pathrev=18317&r1=18316&r2=18317
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/application/helpers/ResourceLoader.java (original)
+++ trunk/src/argouml-app/src/org/argouml/application/helpers/ResourceLoader.java 2010-04-20 14:31:17-0700
@@ -8,6 +8,7 @@
*
* Contributors:
* tfmorris
+ * Luis Sergio Oliveira (euluis)
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,6 +39,7 @@
package org.argouml.application.helpers;
+import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -92,7 +94,8 @@
* A description for the ImageIcon.
* @param loader
* The class loader that should be used for loading the resource.
- * @return ImageIcon for the given name, null if no image could be found.
+ * @return ImageIcon for the given name, null if no image could be found or
+ * if java is running in a headless environment.
*/
public static ImageIcon lookupIconResource(String resource, String desc,
ClassLoader loader) {
@@ -104,7 +107,7 @@
ImageIcon res = null;
java.net.URL imgURL = lookupIconUrl(resource, loader);
- if (imgURL != null) {
+ if (imgURL != null && !GraphicsEnvironment.isHeadless()) {
res = new ImageIcon(imgURL, desc);
synchronized (resourceCache) {
resourceCache.put(resource, res);
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2590841
To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.