//# 0 errors, 151 messages
//#
/*
    //#DefaultsComponent.java:1:1: class: com.dmdirc.updater.components.DefaultsComponent
    //#DefaultsComponent.java:1:1: method: com.dmdirc.updater.components.DefaultsComponent.com.dmdirc.updater.components.DefaultsComponent__static_init
 * 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.updater.components;

import com.dmdirc.config.ConfigManager;
import com.dmdirc.config.IdentityManager;
import com.dmdirc.updater.UpdateComponent;
import com.dmdirc.updater.Version;
import com.dmdirc.util.resourcemanager.ZipResourceManager;

import java.io.File;
import java.io.IOException;

/**
 * Represents the default identities.
 * 
 * @author chris
 */
public class DefaultsComponent implements UpdateComponent {
    //#DefaultsComponent.java:39: method: void com.dmdirc.updater.components.DefaultsComponent.com.dmdirc.updater.components.DefaultsComponent()
    //#DefaultsComponent.java:39: end of method: void com.dmdirc.updater.components.DefaultsComponent.com.dmdirc.updater.components.DefaultsComponent()

    /** {@inheritDoc} */
    @Override
    public String getName() {
        return "defaultsettings";
    //#DefaultsComponent.java:44: method: String com.dmdirc.updater.components.DefaultsComponent.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"defaultsettings"
    //#DefaultsComponent.java:44: end of method: String com.dmdirc.updater.components.DefaultsComponent.getName()
    }
    
    /** {@inheritDoc} */
    @Override
    public String getFriendlyName() {
        return "Default settings";
    //#DefaultsComponent.java:50: method: String com.dmdirc.updater.components.DefaultsComponent.getFriendlyName()
    //#output(String getFriendlyName()): return_value
    //#post(String getFriendlyName()): return_value == &"Default settings"
    //#DefaultsComponent.java:50: end of method: String com.dmdirc.updater.components.DefaultsComponent.getFriendlyName()
    }    

    /** {@inheritDoc} */
    @Override
    public String getFriendlyVersion() {
        return String.valueOf(getVersion());
    //#DefaultsComponent.java:56: method: String com.dmdirc.updater.components.DefaultsComponent.getFriendlyVersion()
    //#input(String getFriendlyVersion()): __Descendant_Table[com/dmdirc/updater/components/DefaultsComponent]
    //#input(String getFriendlyVersion()): __Descendant_Table[others]
    //#input(String getFriendlyVersion()): __Dispatch_Table.getVersion()Lcom/dmdirc/updater/Version;
    //#input(String getFriendlyVersion()): this
    //#input(String getFriendlyVersion()): this.__Tag
    //#output(String getFriendlyVersion()): java.lang.String:valueOf(...)._tainted
    //#output(String getFriendlyVersion()): return_value
    //#new obj(String getFriendlyVersion()): java.lang.String:valueOf(...)
    //#pre[2] (String getFriendlyVersion()): this.__Tag == com/dmdirc/updater/components/DefaultsComponent
    //#post(String getFriendlyVersion()): java.lang.String:valueOf(...)._tainted == 0
    //#post(String getFriendlyVersion()): return_value == &java.lang.String:valueOf(...)
    //#unanalyzed(String getFriendlyVersion()): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(String getFriendlyVersion()): Effects-of-calling:com.dmdirc.config.ConfigManager:hasOptionString
    //#unanalyzed(String getFriendlyVersion()): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(String getFriendlyVersion()): Effects-of-calling:java.lang.String:matches
    //#unanalyzed(String getFriendlyVersion()): Effects-of-calling:java.lang.Integer:parseInt
    //#DefaultsComponent.java:56: end of method: String com.dmdirc.updater.components.DefaultsComponent.getFriendlyVersion()
    }

    /** {@inheritDoc} */
    @Override    
    public Version getVersion() {
        final ConfigManager globalConfig = IdentityManager.getGlobalConfig();
    //#DefaultsComponent.java:62: method: Version com.dmdirc.updater.components.DefaultsComponent.getVersion()
    //#DefaultsComponent.java:62: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.updater.components.DefaultsComponent
    //#    method: Version getVersion()
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#output(Version getVersion()): new Version(getVersion#1) num objects
    //#output(Version getVersion()): new Version(getVersion#1).__Tag
    //#output(Version getVersion()): new Version(getVersion#1).intVersion
    //#output(Version getVersion()): new Version(getVersion#1).strVersion
    //#output(Version getVersion()): new Version(getVersion#2) num objects
    //#output(Version getVersion()): new Version(getVersion#2).__Tag
    //#output(Version getVersion()): new Version(getVersion#2).intVersion
    //#output(Version getVersion()): new Version(getVersion#2).strVersion
    //#output(Version getVersion()): return_value
    //#new obj(Version getVersion()): new Version(getVersion#1)
    //#new obj(Version getVersion()): new Version(getVersion#2)
    //#presumption(Version getVersion()): com.dmdirc.config.ConfigManager:getOption(...)@65 != null
    //#presumption(Version getVersion()): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@62 != null
    //#post(Version getVersion()): return_value in Addr_Set{&new Version(getVersion#2),&new Version(getVersion#1)}
    //#post(Version getVersion()): new Version(getVersion#1) num objects <= 1
    //#post(Version getVersion()): new Version(getVersion#1).__Tag == com/dmdirc/updater/Version
    //#post(Version getVersion()): init'ed(new Version(getVersion#1).intVersion)
    //#post(Version getVersion()): init'ed(new Version(getVersion#1).strVersion)
    //#post(Version getVersion()): new Version(getVersion#2) num objects <= 1
    //#post(Version getVersion()): new Version(getVersion#2).__Tag == com/dmdirc/updater/Version
    //#post(Version getVersion()): new Version(getVersion#2).intVersion == -1
    //#post(Version getVersion()): new Version(getVersion#2).strVersion == null
    //#unanalyzed(Version getVersion()): Effects-of-calling:java.lang.String:matches
    //#unanalyzed(Version getVersion()): Effects-of-calling:java.lang.Integer:parseInt
    //#test_vector(Version getVersion()): com.dmdirc.config.ConfigManager:hasOptionString(...)@64: {0}, {1}
        
        if (globalConfig.hasOptionString("identity", "defaultsversion")) {
    //#DefaultsComponent.java:64: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.config.ConfigManager:hasOptionString(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.updater.components.DefaultsComponent
    //#    method: Version getVersion()
    //#    unanalyzed callee: bool com.dmdirc.config.ConfigManager:hasOptionString(String, String)
            return new Version(globalConfig.getOption("identity", "defaultsversion"));
    //#DefaultsComponent.java:65: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.config.ConfigManager:getOption(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.updater.components.DefaultsComponent
    //#    method: Version getVersion()
    //#    unanalyzed callee: String com.dmdirc.config.ConfigManager:getOption(String, String)
        } else {
            return new Version(-1);
    //#DefaultsComponent.java:67: end of method: Version com.dmdirc.updater.components.DefaultsComponent.getVersion()
        }
    }

    /**
     * {@inheritDoc}
     * 
     * @throws java.io.IOException On i/o exception when reading zip file
     */
    @Override
    public boolean doInstall(final String path) throws IOException {
        final ZipResourceManager ziprm = ZipResourceManager.getInstance(path);
    //#DefaultsComponent.java:78: method: bool com.dmdirc.updater.components.DefaultsComponent.doInstall(String)
    //#input(bool doInstall(String)): "."._tainted
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/FileResourceManager.__Dispatch_Table.getResourceBytes(Ljava/lang/String;)[B
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/FileResourceManager.__Dispatch_Table.getResourcesStartingWithAsBytes(Ljava/lang/String;)Ljava/util/Map;
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/FileResourceManager.com.dmdirc.logger.ErrorLevel.LOW
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Descendant_Table[com/dmdirc/util/resourcemanager/FileResourceManager]
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Descendant_Table[com/dmdirc/util/resourcemanager/ResourceManager]
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Descendant_Table[com/dmdirc/util/resourcemanager/ZipResourceManager]
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Descendant_Table[others]
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Dispatch_Table.getResourceBytes(Ljava/lang/String;)[B
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ResourceManager.__Dispatch_Table.getResourcesStartingWithAsBytes(Ljava/lang/String;)Ljava/util/Map;
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ZipResourceManager.__Class_Obj.__Lock
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ZipResourceManager.__Dispatch_Table.getResourceBytes(Ljava/lang/String;)[B
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ZipResourceManager.__Dispatch_Table.getResourcesStartingWithAsBytes(Ljava/lang/String;)Ljava/util/Map;
    //#input(bool doInstall(String)): com/dmdirc/util/resourcemanager/ZipResourceManager.com.dmdirc.logger.ErrorLevel.LOW
    //#input(bool doInstall(String)): path
    //#output(bool doInstall(String)): return_value
    //#post(bool doInstall(String)): return_value == 0
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipFile
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipFile:entries
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Enumeration:hasMoreElements
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Enumeration:nextElement
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipEntry:getName
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.List:add
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileOutputStream
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileOutputStream:write
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileOutputStream:flush
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileOutputStream:close
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:extractResources
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:getResourcesStartingWithAsBytes
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:exists
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:isDirectory
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:length
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileInputStream
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileInputStream:read
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.FileInputStream:close
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:listFiles
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Arrays:asList
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:isFile
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:getFileListing
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.HashMap
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:getPath
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Map:entrySet
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.Map$Entry:getKey
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:extractResource
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:getResourceBytes
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.String:lastIndexOf
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.File:mkdirs
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipFile:getEntry
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipEntry:isDirectory
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipEntry:getSize
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.util.zip.ZipFile:getInputStream
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.BufferedInputStream
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.BufferedInputStream:read
    //#unanalyzed(bool doInstall(String)): Effects-of-calling:java.io.BufferedInputStream:close
        
        ziprm.extractResources("", IdentityManager.getDirectory());
    //#DefaultsComponent.java:80: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.config.IdentityManager:getDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.updater.components.DefaultsComponent
    //#    method: bool doInstall(String)
    //#    unanalyzed callee: String com.dmdirc.config.IdentityManager:getDirectory()
        
        IdentityManager.loadUser();
    //#DefaultsComponent.java:82: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.config.IdentityManager:loadUser()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.updater.components.DefaultsComponent
    //#    method: bool doInstall(String)
    //#    unanalyzed callee: void com.dmdirc.config.IdentityManager:loadUser()
        
        new File(path).delete();
        
        return false;
    //#DefaultsComponent.java:86: end of method: bool com.dmdirc.updater.components.DefaultsComponent.doInstall(String)
    }

}
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Descendant_Table[com/dmdirc/updater/components/DefaultsComponent]
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.doInstall(Ljava/lang/String;)Z
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getFriendlyName()Ljava/lang/String;
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getFriendlyVersion()Ljava/lang/String;
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getVersion()Lcom/dmdirc/updater/Version;
    //#output(com.dmdirc.updater.components.DefaultsComponent__static_init): com/dmdirc/updater/UpdateComponent.__Descendant_Table[com/dmdirc/updater/components/DefaultsComponent]
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Descendant_Table[com/dmdirc/updater/components/DefaultsComponent] == &__Dispatch_Table
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): com/dmdirc/updater/UpdateComponent.__Descendant_Table[com/dmdirc/updater/components/DefaultsComponent] == &__Dispatch_Table
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.doInstall(Ljava/lang/String;)Z == &doInstall
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getFriendlyName()Ljava/lang/String; == &getFriendlyName
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getFriendlyVersion()Ljava/lang/String; == &getFriendlyVersion
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(com.dmdirc.updater.components.DefaultsComponent__static_init): __Dispatch_Table.getVersion()Lcom/dmdirc/updater/Version; == &getVersion
    //#DefaultsComponent.java:: end of method: com.dmdirc.updater.components.DefaultsComponent.com.dmdirc.updater.components.DefaultsComponent__static_init
    //#DefaultsComponent.java:: end of class: com.dmdirc.updater.components.DefaultsComponent
