//# 0 errors, 191 messages
//#
/*
    //#IconManager.java:1:1: class: com.dmdirc.ui.IconManager
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.ui;

import com.dmdirc.config.IdentityManager;
import com.dmdirc.interfaces.ConfigChangeListener;
import com.dmdirc.util.URLBuilder;

import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * The icon manager provides a standard way to access icons for use in DMDirc.
 * It allows the user to override the default actions using config settings
 * under the icons domain.
 *
 * @author chris
 */
public final class IconManager implements ConfigChangeListener {
    
    /** Previously created IconManager instance. */
    private static final IconManager ME = new IconManager();
    //#IconManager.java:48: method: com.dmdirc.ui.IconManager.com.dmdirc.ui.IconManager__static_init
    //#output(com.dmdirc.ui.IconManager__static_init): ME
    //#output(com.dmdirc.ui.IconManager__static_init): __Descendant_Table[com/dmdirc/ui/IconManager]
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.configChanged(Ljava/lang/String;Ljava/lang/String;)V
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getIcon(Ljava/lang/String;)Ljavax/swing/Icon;
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getIconURL(Ljava/lang/String;)Ljava/net/URL;
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getImage(Ljava/lang/String;)Ljava/awt/Image;
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getScaledIcon(Ljava/lang/String;II)Ljavax/swing/Icon;
    //#output(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getScaledImage(Ljava/awt/Image;II)Ljava/awt/Image;
    //#output(com.dmdirc.ui.IconManager__static_init): com/dmdirc/interfaces/ConfigChangeListener.__Descendant_Table[com/dmdirc/ui/IconManager]
    //#output(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#1) num objects
    //#output(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#2) num objects
    //#output(com.dmdirc.ui.IconManager__static_init): new IconManager(IconManager__static_init#1) num objects
    //#output(com.dmdirc.ui.IconManager__static_init): ME.__Tag
    //#output(com.dmdirc.ui.IconManager__static_init): ME.icons
    //#output(com.dmdirc.ui.IconManager__static_init): ME.images
    //#new obj(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#1)
    //#new obj(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#2)
    //#new obj(com.dmdirc.ui.IconManager__static_init): new IconManager(IconManager__static_init#1)
    //#post(com.dmdirc.ui.IconManager__static_init): ME == &new IconManager(IconManager__static_init#1)
    //#post(com.dmdirc.ui.IconManager__static_init): __Descendant_Table[com/dmdirc/ui/IconManager] == &__Dispatch_Table
    //#post(com.dmdirc.ui.IconManager__static_init): com/dmdirc/interfaces/ConfigChangeListener.__Descendant_Table[com/dmdirc/ui/IconManager] == &__Dispatch_Table
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.configChanged(Ljava/lang/String;Ljava/lang/String;)V == &configChanged
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getIcon(Ljava/lang/String;)Ljavax/swing/Icon; == &getIcon
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getIconURL(Ljava/lang/String;)Ljava/net/URL; == &getIconURL
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getImage(Ljava/lang/String;)Ljava/awt/Image; == &getImage
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getScaledIcon(Ljava/lang/String;II)Ljavax/swing/Icon; == &getScaledIcon
    //#post(com.dmdirc.ui.IconManager__static_init): __Dispatch_Table.getScaledImage(Ljava/awt/Image;II)Ljava/awt/Image; == &getScaledImage
    //#post(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#1) num objects == 1
    //#post(com.dmdirc.ui.IconManager__static_init): new HashMap(IconManager#2) num objects == 1
    //#post(com.dmdirc.ui.IconManager__static_init): new IconManager(IconManager__static_init#1) num objects == 1
    //#post(com.dmdirc.ui.IconManager__static_init): ME.__Tag == com/dmdirc/ui/IconManager
    //#post(com.dmdirc.ui.IconManager__static_init): ME.icons == &new HashMap(IconManager#1)
    //#post(com.dmdirc.ui.IconManager__static_init): ME.images == &new HashMap(IconManager#2)
    //#unanalyzed(com.dmdirc.ui.IconManager__static_init): Effects-of-calling:java.util.HashMap
    //#unanalyzed(com.dmdirc.ui.IconManager__static_init): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(com.dmdirc.ui.IconManager__static_init): Effects-of-calling:com.dmdirc.config.ConfigManager:addChangeListener
    //#IconManager.java:48: end of method: com.dmdirc.ui.IconManager.com.dmdirc.ui.IconManager__static_init
        
    /** A map of existing icons. */
    private final Map<String, Icon> icons;
    
    /** A map of existing images. */
    private final Map<String, Image> images;
    
    /** Creates a new instance of IconManager. */
    private IconManager() {        
    //#IconManager.java:57: method: void com.dmdirc.ui.IconManager.com.dmdirc.ui.IconManager()
    //#input(void com.dmdirc.ui.IconManager()): this
    //#output(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#1) num objects
    //#output(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#2) num objects
    //#output(void com.dmdirc.ui.IconManager()): this.icons
    //#output(void com.dmdirc.ui.IconManager()): this.images
    //#new obj(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#1)
    //#new obj(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#2)
    //#presumption(void com.dmdirc.ui.IconManager()): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@61 != null
    //#post(void com.dmdirc.ui.IconManager()): this.icons == &new HashMap(IconManager#1)
    //#post(void com.dmdirc.ui.IconManager()): this.images == &new HashMap(IconManager#2)
    //#post(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#1) num objects == 1
    //#post(void com.dmdirc.ui.IconManager()): new HashMap(IconManager#2) num objects == 1
        icons = new HashMap<String, Icon>();
        images = new HashMap<String, Image>();
        
        IdentityManager.getGlobalConfig().addChangeListener("icon", this);
    //#IconManager.java:61: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: void com.dmdirc.ui.IconManager()
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#IconManager.java:61: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.config.ConfigManager:addChangeListener(String, ConfigChangeListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: void com.dmdirc.ui.IconManager()
    //#    unanalyzed callee: void com.dmdirc.config.ConfigManager:addChangeListener(String, ConfigChangeListener)
    }
    //#IconManager.java:62: end of method: void com.dmdirc.ui.IconManager.com.dmdirc.ui.IconManager()
    
    /**
     * Returns an instance of IconManager.
     *
     * @return Instance of IconManager
     */
    public static IconManager getIconManager() {
        return ME;
    //#IconManager.java:70: method: IconManager com.dmdirc.ui.IconManager.getIconManager()
    //#input(IconManager getIconManager()): ME
    //#output(IconManager getIconManager()): return_value
    //#post(IconManager getIconManager()): return_value == &new IconManager(IconManager__static_init#1)
    //#IconManager.java:70: end of method: IconManager com.dmdirc.ui.IconManager.getIconManager()
    }
    
    /**
     * Retrieves the icon with the specified type. Returns null if the icon
     * wasn't found.
     *
     * @param type The name of the icon type to retrieve
     *
     * @return The icon that should be used for the specified type
     */
    public Icon getIcon(final String type) {
        final URL iconURL = getIconURL(type);
    //#IconManager.java:82: method: Icon com.dmdirc.ui.IconManager.getIcon(String)
    //#input(Icon getIcon(String)): "', and unable to load default"._tainted
    //#input(Icon getIcon(String)): ".png"._tainted
    //#input(Icon getIcon(String)): "Unable to load icon type '"._tainted
    //#input(Icon getIcon(String)): "com.dmdirc.res."._tainted
    //#input(Icon getIcon(String)): "dmdirc:..com.dmdirc.res."._tainted
    //#input(Icon getIcon(String)): this
    //#input(Icon getIcon(String)): this.icons
    //#input(Icon getIcon(String)): type
    //#input(Icon getIcon(String)): type._tainted
    //#output(Icon getIcon(String)): return_value
    //#pre[2] (Icon getIcon(String)): this.icons != null
    //#presumption(Icon getIcon(String)): java.awt.Toolkit:getDefaultToolkit(...)@83 != null
    //#presumption(Icon getIcon(String)): java.awt.Toolkit:getImage(...)@83 != null
    //#post(Icon getIcon(String)): init'ed(return_value)
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.Thread:currentThread
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.Thread:getContextClassLoader
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.ClassLoader:getResource
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:com.dmdirc.config.ConfigManager:hasOptionString
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:com.dmdirc.util.URLBuilder:buildURL
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.lang.IllegalArgumentException
    //#unanalyzed(Icon getIcon(String)): Effects-of-calling:java.awt.Image:getScaledInstance
    //#test_vector(Icon getIcon(String)): java.util.Map:containsKey(...)@85: {1}, {0}
        final Image iconImage = Toolkit.getDefaultToolkit().getImage(iconURL);
        final Image scaledIconImage = getScaledImage(iconImage, 16, 16);
        if (!icons.containsKey(type)) {
            icons.put(type, new ImageIcon(scaledIconImage));
        }
        return icons.get(type);
    //#IconManager.java:88: end of method: Icon com.dmdirc.ui.IconManager.getIcon(String)
    }

    /**
     * Retrieves the icon with the specified type. Returns null if the icon
     * wasn't found.
     *
     * @param type The name of the icon type to retrieve
     * @param width width of the image
     * @param height height of the image
     * 
     * @return The icon that should be used for the specified type
     *
     * @since 0.6.3m1
     */
    public Icon getScaledIcon(final String type, final int width, final int height) {
        return new ImageIcon(getScaledImage(new ImageIcon(getIconURL(type)).
    //#IconManager.java:104: method: Icon com.dmdirc.ui.IconManager.getScaledIcon(String, int, int)
    //#input(Icon getScaledIcon(String, int, int)): "', and unable to load default"._tainted
    //#input(Icon getScaledIcon(String, int, int)): ".png"._tainted
    //#input(Icon getScaledIcon(String, int, int)): "Unable to load icon type '"._tainted
    //#input(Icon getScaledIcon(String, int, int)): "com.dmdirc.res."._tainted
    //#input(Icon getScaledIcon(String, int, int)): "dmdirc:..com.dmdirc.res."._tainted
    //#input(Icon getScaledIcon(String, int, int)): height
    //#input(Icon getScaledIcon(String, int, int)): this
    //#input(Icon getScaledIcon(String, int, int)): type
    //#input(Icon getScaledIcon(String, int, int)): type._tainted
    //#input(Icon getScaledIcon(String, int, int)): width
    //#output(Icon getScaledIcon(String, int, int)): new ImageIcon(getScaledIcon#1) num objects
    //#output(Icon getScaledIcon(String, int, int)): return_value
    //#new obj(Icon getScaledIcon(String, int, int)): new ImageIcon(getScaledIcon#1)
    //#presumption(Icon getScaledIcon(String, int, int)): javax.swing.ImageIcon:getImage(...)@104 != null
    //#post(Icon getScaledIcon(String, int, int)): return_value == &new ImageIcon(getScaledIcon#1)
    //#post(Icon getScaledIcon(String, int, int)): new ImageIcon(getScaledIcon#1) num objects == 1
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.Thread:currentThread
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.Thread:getContextClassLoader
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.ClassLoader:getResource
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:com.dmdirc.config.ConfigManager:hasOptionString
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:com.dmdirc.util.URLBuilder:buildURL
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.lang.IllegalArgumentException
    //#unanalyzed(Icon getScaledIcon(String, int, int)): Effects-of-calling:java.awt.Image:getScaledInstance
    //#IconManager.java:104: end of method: Icon com.dmdirc.ui.IconManager.getScaledIcon(String, int, int)
                getImage(), width, height));
    }
    
    /**
     * Retrieves the image with the specified type. Returns null if the icon
     * wasn't found.
     *
     * @param type The name of the icon type to retrieve
     *
     * @return The image that should be used for the specified type
     */
    public Image getImage(final String type) {
        if (!images.containsKey(type)) {
    //#IconManager.java:117: method: Image com.dmdirc.ui.IconManager.getImage(String)
    //#input(Image getImage(String)): "', and unable to load default"._tainted
    //#input(Image getImage(String)): ".png"._tainted
    //#input(Image getImage(String)): "Unable to load icon type '"._tainted
    //#input(Image getImage(String)): "com.dmdirc.res."._tainted
    //#input(Image getImage(String)): "dmdirc:..com.dmdirc.res."._tainted
    //#input(Image getImage(String)): this
    //#input(Image getImage(String)): this.images
    //#input(Image getImage(String)): type
    //#input(Image getImage(String)): type._tainted
    //#output(Image getImage(String)): return_value
    //#pre[2] (Image getImage(String)): this.images != null
    //#presumption(Image getImage(String)): java.awt.Toolkit:getDefaultToolkit(...)@118 != null
    //#post(Image getImage(String)): init'ed(return_value)
    //#unanalyzed(Image getImage(String)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.Thread:currentThread
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.Thread:getContextClassLoader
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.ClassLoader:getResource
    //#unanalyzed(Image getImage(String)): Effects-of-calling:com.dmdirc.config.ConfigManager:hasOptionString
    //#unanalyzed(Image getImage(String)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(Image getImage(String)): Effects-of-calling:com.dmdirc.util.URLBuilder:buildURL
    //#unanalyzed(Image getImage(String)): Effects-of-calling:java.lang.IllegalArgumentException
    //#test_vector(Image getImage(String)): java.util.Map:containsKey(...)@117: {1}, {0}
            images.put(type, Toolkit.getDefaultToolkit().createImage(getIconURL(type)));
        }
        return images.get(type);
    //#IconManager.java:120: end of method: Image com.dmdirc.ui.IconManager.getImage(String)
    }
    
    /**
     * Returns a scaled image.
     *
     * @param image Image to scale
     * @param width Width of resulting image
     * @param height Height of resulting image
     *
     * @return Scaled Image
     */
    private Image getScaledImage(final Image image,
            final int width, final int height) {
        return image.getScaledInstance(width , height, Image.SCALE_SMOOTH);
    //#IconManager.java:134: method: Image com.dmdirc.ui.IconManager.getScaledImage(Image, int, int)
    //#input(Image getScaledImage(Image, int, int)): height
    //#input(Image getScaledImage(Image, int, int)): image
    //#input(Image getScaledImage(Image, int, int)): width
    //#output(Image getScaledImage(Image, int, int)): return_value
    //#pre[2] (Image getScaledImage(Image, int, int)): image != null
    //#post(Image getScaledImage(Image, int, int)): init'ed(return_value)
    //#IconManager.java:134: end of method: Image com.dmdirc.ui.IconManager.getScaledImage(Image, int, int)
    }
    
    /**
     * Retrieves the URL of a specified icon type.
     *
     * @param type The name of the icon type to retrieve
     *
     * @return The URL that should be used to retrieve the specified icon
     */
    private URL getIconURL(final String type) {
        final ClassLoader cldr = Thread.currentThread().getContextClassLoader();
    //#IconManager.java:145: method: URL com.dmdirc.ui.IconManager.getIconURL(String)
    //#input(URL getIconURL(String)): "', and unable to load default"._tainted
    //#input(URL getIconURL(String)): ".png"._tainted
    //#input(URL getIconURL(String)): "Unable to load icon type '"._tainted
    //#input(URL getIconURL(String)): "com.dmdirc.res."._tainted
    //#input(URL getIconURL(String)): "dmdirc:..com.dmdirc.res."._tainted
    //#input(URL getIconURL(String)): type
    //#input(URL getIconURL(String)): type._tainted
    //#output(URL getIconURL(String)): return_value
    //#presumption(URL getIconURL(String)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@149 != null
    //#presumption(URL getIconURL(String)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@149 != null
    //#presumption(URL getIconURL(String)): java.lang.ClassLoader:getResource(...)@161 != null
    //#presumption(URL getIconURL(String)): java.lang.Thread:currentThread(...)@145 != null
    //#presumption(URL getIconURL(String)): java.lang.Thread:getContextClassLoader(...)@145 != null
    //#post(URL getIconURL(String)): return_value != null
    //#test_vector(URL getIconURL(String)): com.dmdirc.config.ConfigManager:hasOptionString(...)@149: {0}, {1}
    //#test_vector(URL getIconURL(String)): com.dmdirc.util.URLBuilder:buildURL(...)@154: Inverse{null}, Addr_Set{null}
    //#test_vector(URL getIconURL(String)): java.lang.ClassLoader:getResource(...)@146: Addr_Set{null}, Inverse{null}
        final URL defaultURL = cldr.getResource("com/dmdirc/res/" + type + ".png");
        
        //Get the path for the url
        final String path = IdentityManager.getGlobalConfig().hasOptionString("icon", type)
    //#IconManager.java:149: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: URL getIconURL(String)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#IconManager.java:149: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.config.ConfigManager:hasOptionString(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: URL getIconURL(String)
    //#    unanalyzed callee: bool com.dmdirc.config.ConfigManager:hasOptionString(String, String)
    //#IconManager.java:149: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.config.ConfigManager:getOption(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: URL getIconURL(String)
    //#    unanalyzed callee: String com.dmdirc.config.ConfigManager:getOption(String, String)
                ? IdentityManager.getGlobalConfig().getOption("icon", type)
                : "dmdirc://com/dmdirc/res/" + type + ".png";
        
        //Get the url for the speficied path
        URL imageURL = URLBuilder.buildURL(path);
    //#IconManager.java:154: Warning: method not available - call not analyzed
    //#    call on URL com.dmdirc.util.URLBuilder:buildURL(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.IconManager
    //#    method: URL getIconURL(String)
    //#    unanalyzed callee: URL com.dmdirc.util.URLBuilder:buildURL(String)
        
        if (imageURL == null && defaultURL != null) {
           imageURL = defaultURL;
        }

        if (imageURL == null && defaultURL == null) {
    //#IconManager.java:160: Warning: test always goes same way
    //#    Test predetermined because defaultURL == null
    //#    severity: LOW
    //#    class: com.dmdirc.ui.IconManager
    //#    method: URL getIconURL(String)
    //#    from bb: bb_8
    //#    live edge: bb_8-->bb_9
    //#    tested vn: java.lang.ClassLoader:getResource(...)@146 == null
    //#    tested vn values: {1}
            imageURL = cldr.getResource("com/dmdirc/res/icon.png");
            
            if (imageURL == null) {
                throw new IllegalArgumentException("Unable to load icon type '"
                        + type + "', and unable to load default");
            }
        }
        
        return imageURL;
    //#IconManager.java:169: end of method: URL com.dmdirc.ui.IconManager.getIconURL(String)
    }

    /** {@inheritDoc} */
    @Override
    public void configChanged(final String domain, final String key) {
        if ("icon".equals(domain)) {
    //#IconManager.java:175: method: void com.dmdirc.ui.IconManager.configChanged(String, String)
    //#input(void configChanged(String, String)): domain
    //#input(void configChanged(String, String)): key
    //#input(void configChanged(String, String)): this
    //#input(void configChanged(String, String)): this.icons
    //#input(void configChanged(String, String)): this.images
    //#pre[4] (void configChanged(String, String)): (soft) this.icons != null
    //#pre[5] (void configChanged(String, String)): (soft) this.images != null
    //#test_vector(void configChanged(String, String)): java.lang.String:equals(...)@175: {0}, {1}
    //#test_vector(void configChanged(String, String)): java.util.Map:containsKey(...)@176: {0}, {1}
    //#test_vector(void configChanged(String, String)): java.util.Map:containsKey(...)@179: {0}, {1}
            if (images.containsKey(key)) {
                images.remove(key);
            }
            if (icons.containsKey(key)) {
                icons.remove(key);
            }
        }
    }
    //#IconManager.java:183: end of method: void com.dmdirc.ui.IconManager.configChanged(String, String)
    
}
    //#IconManager.java:: end of class: com.dmdirc.ui.IconManager
