id
int32
0
12.9k
code
sequencelengths
2
264k
10,600
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "CustomData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "ExecutableFile", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "UninstallData", "{", "private", "List", "<", "String", ">", "installedFilesList", ";", "private", "List", "<", "String", ">", "uninstallableFilesList", ";", "private", "List", "<", "ExecutableFile", ">", "executablesList", ";", "private", "String", "uninstallerJarFilename", ";", "private", "String", "uninstallerPath", ";", "private", "final", "List", "<", "CustomData", ">", "listeners", "=", "new", "ArrayList", "<", "CustomData", ">", "(", ")", ";", "private", "final", "List", "<", "CustomData", ">", "jars", "=", "new", "ArrayList", "<", "CustomData", ">", "(", ")", ";", "private", "final", "List", "<", "String", ">", "nativeLibs", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "Object", ">", "additionalData", ";", "private", "ArrayList", "<", "String", ">", "unInstallScripts", ";", "public", "UninstallData", "(", ")", "{", "installedFilesList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "uninstallableFilesList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "executablesList", "=", "new", "ArrayList", "<", "ExecutableFile", ">", "(", ")", ";", "additionalData", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "unInstallScripts", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "}", "public", "final", "static", "String", "ROOTSCRIPT", "=", "\"rootscript\"", ";", "public", "synchronized", "void", "addFile", "(", "String", "path", ",", "boolean", "uninstall", ")", "{", "if", "(", "path", "!=", "null", ")", "{", "installedFilesList", ".", "add", "(", "path", ")", ";", "if", "(", "uninstall", ")", "{", "uninstallableFilesList", ".", "add", "(", "path", ")", ";", "}", "}", "}", "public", "List", "<", "String", ">", "getInstalledFilesList", "(", ")", "{", "return", "installedFilesList", ";", "}", "public", "List", "<", "String", ">", "getUninstalableFilesList", "(", ")", "{", "return", "uninstallableFilesList", ";", "}", "public", "synchronized", "void", "addExecutable", "(", "ExecutableFile", "file", ")", "{", "executablesList", ".", "add", "(", "file", ")", ";", "}", "public", "List", "<", "ExecutableFile", ">", "getExecutablesList", "(", ")", "{", "return", "executablesList", ";", "}", "public", "synchronized", "String", "getUninstallerJarFilename", "(", ")", "{", "return", "uninstallerJarFilename", ";", "}", "public", "synchronized", "void", "setUninstallerJarFilename", "(", "String", "name", ")", "{", "uninstallerJarFilename", "=", "name", ";", "}", "public", "String", "getUninstallerPath", "(", ")", "{", "return", "uninstallerPath", ";", "}", "public", "void", "setUninstallerPath", "(", "String", "path", ")", "{", "uninstallerPath", "=", "path", ";", "}", "public", "void", "addUninstallerListener", "(", "CustomData", "listener", ")", "{", "listeners", ".", "add", "(", "listener", ")", ";", "}", "public", "List", "<", "CustomData", ">", "getUninstallerListeners", "(", ")", "{", "return", "listeners", ";", "}", "public", "void", "addJar", "(", "CustomData", "jar", ")", "{", "jars", ".", "add", "(", "jar", ")", ";", "}", "public", "List", "<", "CustomData", ">", "getJars", "(", ")", "{", "return", "jars", ";", "}", "public", "void", "addNativeLibrary", "(", "String", "path", ")", "{", "nativeLibs", ".", "add", "(", "path", ")", ";", "}", "public", "List", "<", "String", ">", "getNativeLibraries", "(", ")", "{", "return", "nativeLibs", ";", "}", "public", "Map", "<", "String", ",", "Object", ">", "getAdditionalData", "(", ")", "{", "return", "additionalData", ";", "}", "public", "void", "addAdditionalData", "(", "String", "name", ",", "Object", "value", ")", "{", "additionalData", ".", "put", "(", "name", ",", "value", ")", ";", "}", "public", "void", "addUninstallScript", "(", "String", "aRootUninstallScript", ")", "{", "unInstallScripts", ".", "add", "(", "aRootUninstallScript", "==", "null", "?", "\"\"", ":", "aRootUninstallScript", ")", ";", "}", "public", "ArrayList", "<", "String", ">", "getUninstallScripts", "(", ")", "{", "return", "unInstallScripts", ";", "}", "}", "</s>" ]
10,601
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ";", "import", "java", ".", "awt", ".", "Color", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "GUIPrefs", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Messages", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platform", ";", "public", "class", "GUIInstallData", "extends", "InstallData", "implements", "Serializable", "{", "private", "static", "final", "long", "serialVersionUID", "=", "4048793450990024505L", ";", "public", "GUIPrefs", "guiPrefs", ";", "public", "Color", "buttonsHColor", "=", "new", "Color", "(", "230", ",", "230", ",", "230", ")", ";", "private", "List", "<", "IzPanel", ">", "panels", "=", "new", "ArrayList", "<", "IzPanel", ">", "(", ")", ";", "public", "GUIInstallData", "(", "Variables", "variables", ",", "Platform", "platform", ")", "{", "super", "(", "variables", ",", "platform", ")", ";", "}", "public", "void", "configureGuiButtons", "(", ")", "{", "Messages", "messages", "=", "getMessages", "(", ")", ";", "UIManager", ".", "put", "(", "\"\"", ",", "messages", ".", "get", "(", "\"\"", ")", ")", ";", "UIManager", ".", "put", "(", "\"\"", ",", "messages", ".", "get", "(", "\"installer.no\"", ")", ")", ";", "UIManager", ".", "put", "(", "\"\"", ",", "messages", ".", "get", "(", "\"\"", ")", ")", ";", "}", "public", "List", "<", "IzPanel", ">", "getPanels", "(", ")", "{", "return", "panels", ";", "}", "}", "</s>" ]
10,602
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "AutomatedInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "OsVersion", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platform", ";", "public", "class", "InstallData", "extends", "AutomatedInstallData", "{", "public", "InstallData", "(", "Variables", "variables", ",", "Platform", "platform", ")", "{", "super", "(", "variables", ",", "platform", ")", ";", "}", "@", "Override", "public", "void", "setInstallPath", "(", "String", "path", ")", "{", "super", ".", "setInstallPath", "(", "path", ")", ";", "setInstallDriveFromPath", "(", "path", ",", "INSTALL_DRIVE", ")", ";", "}", "@", "Override", "public", "void", "setDefaultInstallPath", "(", "String", "path", ")", "{", "super", ".", "setDefaultInstallPath", "(", "path", ")", ";", "setInstallDriveFromPath", "(", "path", ",", "DEFAULT_INSTALL_DRIVE", ")", ";", "}", "@", "Override", "public", "String", "getDefaultInstallPath", "(", ")", "{", "return", "getVariable", "(", "DEFAULT_INSTALL_PATH", ")", ";", "}", "private", "void", "setInstallDriveFromPath", "(", "String", "path", ",", "String", "variable", ")", "{", "if", "(", "OsVersion", ".", "IS_WINDOWS", ")", "{", "String", "[", "]", "parts", "=", "path", ".", "trim", "(", ")", ".", "split", "(", "\":\"", ",", "2", ")", ";", "if", "(", "parts", ".", "length", ">", "0", "&&", "parts", "[", "0", "]", ".", "length", "(", ")", "==", "1", ")", "{", "setVariable", "(", "variable", ",", "parts", "[", "0", "]", "+", "\":\"", ")", ";", "}", "}", "}", "}", "</s>" ]
10,603
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "public", "interface", "Cancellable", "{", "boolean", "isCancelled", "(", ")", ";", "}", "</s>" ]
10,604
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "BufferedInputStream", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceInterruptedException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceNotFoundException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "public", "abstract", "class", "AbstractPackResources", "implements", "PackResources", "{", "private", "final", "Resources", "resources", ";", "private", "final", "InstallData", "installData", ";", "public", "AbstractPackResources", "(", "Resources", "resources", ",", "InstallData", "installData", ")", "{", "this", ".", "installData", "=", "installData", ";", "this", ".", "resources", "=", "resources", ";", "}", "@", "Override", "public", "InputStream", "getPackStream", "(", "String", "name", ")", "{", "InputStream", "result", ";", "String", "webDirURL", "=", "installData", ".", "getInfo", "(", ")", ".", "getWebDirURL", "(", ")", ";", "if", "(", "webDirURL", "==", "null", ")", "{", "result", "=", "getLocalPackStream", "(", "name", ")", ";", "}", "else", "{", "result", "=", "getWebPackStream", "(", "name", ",", "webDirURL", ")", ";", "}", "String", "className", "=", "installData", ".", "getInfo", "(", ")", ".", "getPackDecoderClassName", "(", ")", ";", "if", "(", "className", "!=", "null", ")", "{", "result", "=", "getDecodingInputStream", "(", "result", ",", "className", ")", ";", "}", "return", "result", ";", "}", "@", "Override", "public", "InputStream", "getInputStream", "(", "String", "name", ")", "{", "return", "resources", ".", "getInputStream", "(", "name", ")", ";", "}", "protected", "InputStream", "getDecodingInputStream", "(", "InputStream", "in", ",", "String", "className", ")", "{", "Object", "result", ";", "try", "{", "Class", "decoder", "=", "Class", ".", "forName", "(", "className", ")", ";", "Class", "[", "]", "paramsClasses", "=", "{", "java", ".", "io", ".", "InputStream", ".", "class", "}", ";", "Constructor", "constructor", "=", "decoder", ".", "getDeclaredConstructor", "(", "paramsClasses", ")", ";", "InputStream", "buffer", "=", "new", "BufferedInputStream", "(", "in", ")", ";", "Object", "[", "]", "params", "=", "{", "buffer", "}", ";", "result", "=", "constructor", ".", "newInstance", "(", "params", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "ResourceException", "(", "\"\"", ",", "exception", ")", ";", "}", "if", "(", "!", "InputStream", ".", "class", ".", "isInstance", "(", "result", ")", ")", "{", "throw", "new", "ResourceException", "(", "\"\"", "+", "className", "+", "\"\"", "+", "InputStream", ".", "class", ".", "getName", "(", ")", ")", ";", "}", "return", "(", "InputStream", ")", "result", ";", "}", "protected", "InputStream", "getLocalPackStream", "(", "String", "name", ")", "{", "return", "resources", ".", "getInputStream", "(", "\"packs/pack-\"", "+", "name", ")", ";", "}", "protected", "abstract", "InputStream", "getWebPackStream", "(", "String", "name", ",", "String", "webDirURL", ")", ";", "protected", "InstallData", "getInstallData", "(", ")", "{", "return", "installData", ";", "}", "}", "</s>" ]
10,605
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "InterruptedIOException", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Blockable", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueueMove", ";", "public", "abstract", "class", "FileUnpacker", "{", "private", "final", "Cancellable", "cancellable", ";", "private", "File", "target", ";", "private", "File", "tmpTarget", ";", "private", "FileQueue", "queue", ";", "private", "boolean", "queued", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileUnpacker", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "FileUnpacker", "(", "Cancellable", "cancellable", ",", "FileQueue", "queue", ")", "{", "this", ".", "cancellable", "=", "cancellable", ";", "this", ".", "queue", "=", "queue", ";", "}", "public", "abstract", "void", "unpack", "(", "PackFile", "file", ",", "ObjectInputStream", "packInputStream", ",", "File", "target", ")", "throws", "IOException", ",", "InstallerException", ";", "public", "boolean", "isQueued", "(", ")", "{", "return", "queued", ";", "}", "protected", "void", "copy", "(", "PackFile", "file", ",", "InputStream", "in", ",", "File", "target", ")", "throws", "IOException", "{", "OutputStream", "out", "=", "getTarget", "(", "file", ",", "target", ")", ";", "try", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "5120", "]", ";", "long", "bytesCopied", "=", "0", ";", "while", "(", "bytesCopied", "<", "file", ".", "length", "(", ")", ")", "{", "if", "(", "cancellable", ".", "isCancelled", "(", ")", ")", "{", "throw", "new", "InterruptedIOException", "(", "\"\"", ")", ";", "}", "bytesCopied", "=", "copy", "(", "file", ",", "buffer", ",", "in", ",", "out", ",", "bytesCopied", ")", ";", "}", "}", "finally", "{", "FileUtils", ".", "close", "(", "out", ")", ";", "}", "postCopy", "(", "file", ")", ";", "}", "protected", "void", "postCopy", "(", "PackFile", "file", ")", "throws", "IOException", "{", "setLastModified", "(", "file", ")", ";", "if", "(", "isBlockable", "(", "file", ")", ")", "{", "queue", "(", ")", ";", "}", "}", "protected", "long", "copy", "(", "PackFile", "file", ",", "byte", "[", "]", "buffer", ",", "InputStream", "in", ",", "OutputStream", "out", ",", "long", "bytesCopied", ")", "throws", "IOException", "{", "int", "maxBytes", "=", "(", "int", ")", "Math", ".", "min", "(", "file", ".", "length", "(", ")", "-", "bytesCopied", ",", "buffer", ".", "length", ")", ";", "int", "read", "=", "read", "(", "buffer", ",", "in", ",", "maxBytes", ")", ";", "if", "(", "read", "==", "-", "1", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "out", ".", "write", "(", "buffer", ",", "0", ",", "read", ")", ";", "bytesCopied", "+=", "read", ";", "return", "bytesCopied", ";", "}", "protected", "int", "read", "(", "byte", "[", "]", "buffer", ",", "InputStream", "in", ",", "int", "maxBytes", ")", "throws", "IOException", "{", "return", "in", ".", "read", "(", "buffer", ",", "0", ",", "maxBytes", ")", ";", "}", "protected", "OutputStream", "getTarget", "(", "PackFile", "file", ",", "File", "target", ")", "throws", "IOException", "{", "this", ".", "target", "=", "target", ";", "OutputStream", "result", ";", "if", "(", "isBlockable", "(", "file", ")", ")", "{", "tmpTarget", "=", "File", ".", "createTempFile", "(", "\"__FQ__\"", ",", "null", ",", "target", ".", "getParentFile", "(", ")", ")", ";", "result", "=", "new", "FileOutputStream", "(", "tmpTarget", ")", ";", "}", "else", "{", "result", "=", "new", "FileOutputStream", "(", "target", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "setLastModified", "(", "PackFile", "file", ")", "{", "if", "(", "file", ".", "lastModified", "(", ")", ">=", "0", ")", "{", "File", "f", "=", "(", "tmpTarget", "!=", "null", ")", "?", "tmpTarget", ":", "target", ";", "if", "(", "!", "f", ".", "setLastModified", "(", "file", ".", "lastModified", "(", ")", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "target", ")", ";", "}", "}", "}", "private", "boolean", "isBlockable", "(", "PackFile", "file", ")", "{", "return", "queue", "!=", "null", "&&", "(", "file", ".", "blockable", "(", ")", "!=", "Blockable", ".", "BLOCKABLE_NONE", ")", ";", "}", "private", "void", "queue", "(", ")", "throws", "IOException", "{", "FileQueueMove", "move", "=", "new", "FileQueueMove", "(", "tmpTarget", ",", "target", ")", ";", "move", ".", "setForceInUse", "(", "true", ")", ";", "move", ".", "setOverwrite", "(", "true", ")", ";", "queue", ".", "add", "(", "move", ")", ";", "logger", ".", "fine", "(", "tmpTarget", ".", "getAbsolutePath", "(", ")", "+", "\"", "->", "\"", "+", "target", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "tmpTarget", ".", "deleteOnExit", "(", ")", ";", "queued", "=", "true", ";", "}", "}", "</s>" ]
10,606
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "util", ".", "jar", ".", "JarOutputStream", ";", "import", "java", ".", "util", ".", "jar", ".", "Pack200", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "class", "Pack200FileUnpacker", "extends", "FileUnpacker", "{", "private", "final", "PackResources", "resources", ";", "private", "final", "Pack200", ".", "Unpacker", "unpacker", ";", "public", "Pack200FileUnpacker", "(", "Cancellable", "cancellable", ",", "PackResources", "resources", ",", "Pack200", ".", "Unpacker", "unpacker", ",", "FileQueue", "queue", ")", "{", "super", "(", "cancellable", ",", "queue", ")", ";", "this", ".", "resources", "=", "resources", ";", "this", ".", "unpacker", "=", "unpacker", ";", "}", "@", "Override", "public", "void", "unpack", "(", "PackFile", "file", ",", "ObjectInputStream", "packInputStream", ",", "File", "target", ")", "throws", "IOException", ",", "InstallerException", "{", "int", "key", "=", "packInputStream", ".", "readInt", "(", ")", ";", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "JarOutputStream", "jarOut", "=", "null", ";", "try", "{", "in", "=", "resources", ".", "getInputStream", "(", "\"\"", "+", "key", ")", ";", "out", "=", "getTarget", "(", "file", ",", "target", ")", ";", "jarOut", "=", "new", "JarOutputStream", "(", "out", ")", ";", "unpacker", ".", "unpack", "(", "in", ",", "jarOut", ")", ";", "jarOut", ".", "close", "(", ")", ";", "}", "finally", "{", "FileUtils", ".", "close", "(", "in", ")", ";", "FileUtils", ".", "close", "(", "out", ")", ";", "FileUtils", ".", "close", "(", "jarOut", ")", ";", "}", "postCopy", "(", "file", ")", ";", "}", "}", "</s>" ]
10,607
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "BufferedInputStream", ";", "import", "java", ".", "io", ".", "BufferedOutputStream", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "ParsableFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "public", "class", "ScriptParser", "{", "private", "final", "VariableSubstitutor", "replacer", ";", "private", "final", "PlatformModelMatcher", "matcher", ";", "public", "ScriptParser", "(", "VariableSubstitutor", "replacer", ",", "PlatformModelMatcher", "matcher", ")", "{", "this", ".", "replacer", "=", "replacer", ";", "this", ".", "matcher", "=", "matcher", ";", "}", "public", "void", "parse", "(", "ParsableFile", "parsable", ")", "throws", "Exception", "{", "if", "(", "!", "matcher", ".", "matchesCurrentPlatform", "(", "parsable", ".", "getOsConstraints", "(", ")", ")", ")", "{", "return", ";", "}", "File", "file", "=", "new", "File", "(", "parsable", ".", "getPath", "(", ")", ")", ";", "File", "parsedFile", ";", "try", "{", "parsedFile", "=", "File", ".", "createTempFile", "(", "\"izpp\"", ",", "null", ",", "file", ".", "getParentFile", "(", ")", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "parsable", ".", "getPath", "(", ")", "+", "\"\"", "+", "file", ".", "getParentFile", "(", ")", ",", "exception", ")", ";", "}", "FileInputStream", "inFile", "=", "new", "FileInputStream", "(", "file", ")", ";", "BufferedInputStream", "in", "=", "new", "BufferedInputStream", "(", "inFile", ",", "5120", ")", ";", "FileOutputStream", "outFile", "=", "new", "FileOutputStream", "(", "parsedFile", ")", ";", "BufferedOutputStream", "out", "=", "new", "BufferedOutputStream", "(", "outFile", ",", "5120", ")", ";", "replacer", ".", "substitute", "(", "in", ",", "out", ",", "parsable", ".", "getType", "(", ")", ",", "parsable", ".", "getEncoding", "(", ")", ")", ";", "in", ".", "close", "(", ")", ";", "out", ".", "close", "(", ")", ";", "if", "(", "!", "file", ".", "delete", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "file", ")", ";", "}", "if", "(", "!", "parsedFile", ".", "renameTo", "(", "file", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "parsedFile", "+", "\"", "to", "\"", "+", "file", ")", ";", "}", "}", "}", "</s>" ]
10,608
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "public", "class", "DefaultFileUnpacker", "extends", "FileUnpacker", "{", "public", "DefaultFileUnpacker", "(", "Cancellable", "cancellable", ",", "FileQueue", "queue", ")", "{", "super", "(", "cancellable", ",", "queue", ")", ";", "}", "@", "Override", "public", "void", "unpack", "(", "PackFile", "file", ",", "ObjectInputStream", "packInputStream", ",", "File", "target", ")", "throws", "IOException", ",", "InstallerException", "{", "copy", "(", "file", ",", "packInputStream", ",", "target", ")", ";", "}", "}", "</s>" ]
10,609
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platform", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "public", "class", "FileQueueFactory", "{", "private", "final", "boolean", "supportsQueue", ";", "private", "final", "Librarian", "librarian", ";", "public", "FileQueueFactory", "(", "Platform", "platform", ",", "Librarian", "librarian", ")", "{", "supportsQueue", "=", "platform", ".", "isA", "(", "Platform", ".", "Name", ".", "WINDOWS", ")", ";", "this", ".", "librarian", "=", "librarian", ";", "}", "public", "boolean", "isSupported", "(", ")", "{", "return", "supportsQueue", ";", "}", "public", "FileQueue", "create", "(", ")", "{", "return", "supportsQueue", "?", "new", "FileQueue", "(", "librarian", ")", ":", "null", ";", "}", "}", "</s>" ]
10,610
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "InterruptedIOException", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceInterruptedException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceNotFoundException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "web", ".", "WebRepositoryAccessor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "IoHelper", ";", "public", "class", "GUIPackResources", "extends", "AbstractPackResources", "{", "private", "static", "final", "String", "tempSubPath", "=", "\"\"", ";", "public", "GUIPackResources", "(", "Resources", "resources", ",", "InstallData", "installData", ")", "{", "super", "(", "resources", ",", "installData", ")", ";", "}", "protected", "InputStream", "getWebPackStream", "(", "String", "name", ",", "String", "webDirURL", ")", "{", "InputStream", "result", ";", "InstallData", "installData", "=", "getInstallData", "(", ")", ";", "String", "baseName", "=", "installData", ".", "getInfo", "(", ")", ".", "getInstallerBase", "(", ")", ";", "String", "packURL", "=", "webDirURL", "+", "\"/\"", "+", "baseName", "+", "\".pack-\"", "+", "name", "+", "\".jar\"", ";", "String", "tempFolder", "=", "IoHelper", ".", "translatePath", "(", "installData", ".", "getInfo", "(", ")", ".", "getUninstallerPath", "(", ")", "+", "GUIPackResources", ".", "tempSubPath", ",", "installData", ".", "getVariables", "(", ")", ")", ";", "String", "tempFile", ";", "try", "{", "tempFile", "=", "WebRepositoryAccessor", ".", "getCachedUrl", "(", "packURL", ",", "tempFolder", ")", ";", "}", "catch", "(", "InterruptedIOException", "exception", ")", "{", "throw", "new", "ResourceInterruptedException", "(", "\"\"", "+", "webDirURL", "+", "\"", "interrupted\"", ",", "exception", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "ResourceException", "(", "\"\"", "+", "webDirURL", ",", "exception", ")", ";", "}", "try", "{", "URL", "url", "=", "new", "URL", "(", "\"jar:\"", "+", "tempFile", "+", "\"\"", "+", "name", ")", ";", "result", "=", "url", ".", "openStream", "(", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "ResourceException", "(", "\"\"", ",", "exception", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,611
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "event", ".", "InstallerListeners", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "public", "class", "Unpacker", "extends", "UnpackerBase", "{", "public", "Unpacker", "(", "InstallData", "installData", ",", "PackResources", "resources", ",", "RulesEngine", "rules", ",", "VariableSubstitutor", "variableSubstitutor", ",", "UninstallData", "uninstallData", ",", "FileQueueFactory", "factory", ",", "Housekeeper", "housekeeper", ",", "InstallerListeners", "listeners", ",", "Prompt", "prompt", ",", "PlatformModelMatcher", "matcher", ")", "{", "super", "(", "installData", ",", "resources", ",", "rules", ",", "variableSubstitutor", ",", "uninstallData", ",", "factory", ",", "housekeeper", ",", "listeners", ",", "prompt", ",", "matcher", ")", ";", "}", "}", "</s>" ]
10,612
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "ProgressListener", ";", "public", "interface", "IUnpacker", "extends", "Runnable", "{", "public", "boolean", "getResult", "(", ")", ";", "void", "setProgressListener", "(", "ProgressListener", "listener", ")", ";", "boolean", "interrupt", "(", "long", "wait", ")", ";", "void", "setDisableInterrupt", "(", "boolean", "disable", ")", ";", "boolean", "isInterruptDisabled", "(", ")", ";", "}", "</s>" ]
10,613
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "static", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ".", "Option", ";", "import", "static", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ".", "Options", ";", "import", "static", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ".", "Type", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "java", ".", "io", ".", "ObjectOutputStream", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "net", ".", "URISyntaxException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "TreeSet", ";", "import", "java", ".", "util", ".", "jar", ".", "Pack200", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "OverrideType", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Pack", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "InstallerListener", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "ProgressListener", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceInterruptedException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Messages", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "handler", ".", "ProgressHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "handler", ".", "PromptUIHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "ExecutableFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "ParsableFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "data", ".", "UpdateCheck", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "event", ".", "InstallerListeners", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "util", ".", "PackHelper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "FileExecutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "IoHelper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "DirectoryScanner", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "GlobPatternMapper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "types", ".", "FileSet", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "public", "abstract", "class", "UnpackerBase", "implements", "IUnpacker", "{", "private", "final", "InstallData", "installData", ";", "private", "final", "UninstallData", "uninstallData", ";", "private", "final", "PackResources", "resources", ";", "private", "final", "RulesEngine", "rules", ";", "private", "final", "VariableSubstitutor", "variableSubstitutor", ";", "private", "final", "FileQueueFactory", "queueFactory", ";", "private", "final", "Housekeeper", "housekeeper", ";", "private", "final", "InstallerListeners", "listeners", ";", "private", "ProgressListener", "listener", ";", "private", "File", "absoluteInstallSource", ";", "private", "Pack200", ".", "Unpacker", "unpacker", ";", "private", "final", "Prompt", "prompt", ";", "private", "final", "PlatformModelMatcher", "matcher", ";", "private", "boolean", "result", "=", "true", ";", "private", "final", "Cancellable", "cancellable", ";", "private", "enum", "State", "{", "READY", ",", "UNPACKING", ",", "INTERRUPT", ",", "INTERRUPTED", "}", "private", "State", "state", "=", "State", ".", "READY", ";", "private", "boolean", "disableInterrupt", "=", "false", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "UnpackerBase", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "UnpackerBase", "(", "InstallData", "installData", ",", "PackResources", "resources", ",", "RulesEngine", "rules", ",", "VariableSubstitutor", "variableSubstitutor", ",", "UninstallData", "uninstallData", ",", "FileQueueFactory", "factory", ",", "Housekeeper", "housekeeper", ",", "InstallerListeners", "listeners", ",", "Prompt", "prompt", ",", "PlatformModelMatcher", "matcher", ")", "{", "this", ".", "installData", "=", "installData", ";", "this", ".", "resources", "=", "resources", ";", "this", ".", "rules", "=", "rules", ";", "this", ".", "variableSubstitutor", "=", "variableSubstitutor", ";", "this", ".", "uninstallData", "=", "uninstallData", ";", "this", ".", "queueFactory", "=", "factory", ";", "this", ".", "housekeeper", "=", "housekeeper", ";", "this", ".", "listeners", "=", "listeners", ";", "this", ".", "prompt", "=", "prompt", ";", "this", ".", "matcher", "=", "matcher", ";", "cancellable", "=", "new", "Cancellable", "(", ")", "{", "@", "Override", "public", "boolean", "isCancelled", "(", ")", "{", "return", "isInterrupted", "(", ")", ";", "}", "}", ";", "}", "@", "Override", "public", "void", "setProgressListener", "(", "ProgressListener", "listener", ")", "{", "this", ".", "listener", "=", "listener", ";", "}", "public", "void", "run", "(", ")", "{", "unpack", "(", ")", ";", "}", "public", "void", "unpack", "(", ")", "{", "state", "=", "State", ".", "UNPACKING", ";", "try", "{", "List", "<", "ParsableFile", ">", "parsables", "=", "new", "ArrayList", "<", "ParsableFile", ">", "(", ")", ";", "List", "<", "ExecutableFile", ">", "executables", "=", "new", "ArrayList", "<", "ExecutableFile", ">", "(", ")", ";", "List", "<", "UpdateCheck", ">", "updateChecks", "=", "new", "ArrayList", "<", "UpdateCheck", ">", "(", ")", ";", "FileQueue", "queue", "=", "queueFactory", ".", "isSupported", "(", ")", "?", "queueFactory", ".", "create", "(", ")", ":", "null", ";", "List", "<", "Pack", ">", "packs", "=", "installData", ".", "getSelectedPacks", "(", ")", ";", "preUnpack", "(", "packs", ")", ";", "unpack", "(", "packs", ",", "queue", ",", "parsables", ",", "executables", ",", "updateChecks", ")", ";", "postUnpack", "(", "packs", ",", "queue", ",", "parsables", ",", "executables", ",", "updateChecks", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "setResult", "(", "false", ")", ";", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "listener", ".", "stopAction", "(", ")", ";", "if", "(", "exception", "instanceof", "ResourceInterruptedException", ")", "{", "prompt", ".", "message", "(", "Type", ".", "INFORMATION", ",", "\"\"", ")", ";", "}", "else", "{", "String", "message", "=", "exception", ".", "getMessage", "(", ")", ";", "if", "(", "message", "==", "null", "||", "\"\"", ".", "equals", "(", "message", ")", ")", "{", "message", "=", "\"\"", "+", "exception", ".", "toString", "(", ")", ";", "}", "prompt", ".", "message", "(", "Type", ".", "ERROR", ",", "message", ")", ";", "}", "housekeeper", ".", "shutDown", "(", "4", ")", ";", "}", "finally", "{", "cleanup", "(", ")", ";", "}", "}", "public", "boolean", "getResult", "(", ")", "{", "return", "result", ";", "}", "@", "Override", "public", "boolean", "interrupt", "(", "long", "timeout", ")", "{", "boolean", "result", ";", "if", "(", "isInterruptDisabled", "(", ")", ")", "{", "result", "=", "false", ";", "}", "else", "{", "synchronized", "(", "this", ")", "{", "if", "(", "state", "!=", "State", ".", "READY", "&&", "state", "!=", "State", ".", "INTERRUPTED", ")", "{", "state", "=", "State", ".", "INTERRUPT", ";", "try", "{", "wait", "(", "timeout", ")", ";", "}", "catch", "(", "InterruptedException", "ignore", ")", "{", "}", "result", "=", "state", "==", "State", ".", "INTERRUPTED", ";", "}", "else", "{", "result", "=", "true", ";", "}", "}", "}", "return", "result", ";", "}", "@", "Override", "public", "synchronized", "void", "setDisableInterrupt", "(", "boolean", "disable", ")", "{", "if", "(", "state", "==", "State", ".", "INTERRUPT", "||", "state", "==", "State", ".", "INTERRUPTED", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "disableInterrupt", "=", "disable", ";", "}", "public", "synchronized", "boolean", "isInterruptDisabled", "(", ")", "{", "return", "disableInterrupt", ";", "}", "protected", "void", "preUnpack", "(", "List", "<", "Pack", ">", "packs", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "listener", ".", "startAction", "(", "\"Unpacking\"", ",", "packs", ".", "size", "(", ")", ")", ";", "listeners", ".", "beforePacks", "(", "packs", ",", "listener", ")", ";", "}", "protected", "void", "unpack", "(", "List", "<", "Pack", ">", "packs", ",", "FileQueue", "queue", ",", "List", "<", "ParsableFile", ">", "parsables", ",", "List", "<", "ExecutableFile", ">", "executables", ",", "List", "<", "UpdateCheck", ">", "updateChecks", ")", "{", "int", "count", "=", "packs", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "Pack", "pack", "=", "packs", ".", "get", "(", "i", ")", ";", "if", "(", "shouldUnpack", "(", "pack", ")", ")", "{", "listeners", ".", "beforePack", "(", "pack", ",", "i", ",", "listener", ")", ";", "unpack", "(", "pack", ",", "i", ",", "queue", ",", "parsables", ",", "executables", ",", "updateChecks", ")", ";", "checkInterrupt", "(", ")", ";", "listeners", ".", "afterPack", "(", "pack", ",", "i", ",", "listener", ")", ";", "}", "}", "}", "protected", "void", "unpack", "(", "Pack", "pack", ",", "int", "packNo", ",", "FileQueue", "queue", ",", "List", "<", "ParsableFile", ">", "parsables", ",", "List", "<", "ExecutableFile", ">", "executables", ",", "List", "<", "UpdateCheck", ">", "updateChecks", ")", "{", "InputStream", "in", "=", "null", ";", "ObjectInputStream", "packInputStream", "=", "null", ";", "try", "{", "in", "=", "resources", ".", "getPackStream", "(", "pack", ".", "getName", "(", ")", ")", ";", "packInputStream", "=", "new", "ObjectInputStream", "(", "in", ")", ";", "int", "fileCount", "=", "packInputStream", ".", "readInt", "(", ")", ";", "String", "stepName", "=", "getStepName", "(", "pack", ")", ";", "listener", ".", "nextStep", "(", "stepName", ",", "packNo", "+", "1", ",", "fileCount", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fileCount", ";", "++", "i", ")", "{", "PackFile", "file", "=", "(", "PackFile", ")", "packInputStream", ".", "readObject", "(", ")", ";", "if", "(", "shouldUnpack", "(", "file", ")", ")", "{", "unpack", "(", "file", ",", "packInputStream", ",", "i", ",", "pack", ",", "queue", ")", ";", "}", "else", "{", "skip", "(", "file", ",", "pack", ",", "packInputStream", ")", ";", "}", "}", "readParsableFiles", "(", "packInputStream", ",", "parsables", ")", ";", "readExecutableFiles", "(", "packInputStream", ",", "executables", ")", ";", "readUpdateChecks", "(", "packInputStream", ",", "updateChecks", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", "+", "pack", ".", "getName", "(", ")", ",", "exception", ")", ";", "}", "finally", "{", "FileUtils", ".", "close", "(", "packInputStream", ")", ";", "FileUtils", ".", "close", "(", "in", ")", ";", "}", "}", "private", "boolean", "shouldUnpack", "(", "PackFile", "file", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "file", ".", "hasCondition", "(", ")", ")", "{", "result", "=", "isConditionTrue", "(", "file", ".", "getCondition", "(", ")", ")", ";", "}", "if", "(", "result", "&&", "file", ".", "osConstraints", "(", ")", "!=", "null", "&&", "!", "file", ".", "osConstraints", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "matcher", ".", "matchesCurrentPlatform", "(", "file", ".", "osConstraints", "(", ")", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "unpack", "(", "PackFile", "file", ",", "ObjectInputStream", "packInputStream", ",", "int", "fileNo", ",", "Pack", "pack", ",", "FileQueue", "queue", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "fine", "(", "\"Unpack", "\"", "+", "file", ".", "getTargetPath", "(", ")", ")", ";", "}", "Variables", "variables", "=", "getInstallData", "(", ")", ".", "getVariables", "(", ")", ";", "String", "path", "=", "IoHelper", ".", "translatePath", "(", "file", ".", "getTargetPath", "(", ")", ",", "variables", ")", ";", "File", "target", "=", "new", "File", "(", "path", ")", ";", "File", "dir", "=", "target", ";", "if", "(", "!", "file", ".", "isDirectory", "(", ")", ")", "{", "dir", "=", "target", ".", "getParentFile", "(", ")", ";", "}", "createDirectory", "(", "dir", ",", "file", ",", "pack", ")", ";", "getUninstallData", "(", ")", ".", "addFile", "(", "path", ",", "pack", ".", "isUninstall", "(", ")", ")", ";", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "return", ";", "}", "listeners", ".", "beforeFile", "(", "target", ",", "file", ",", "pack", ")", ";", "listener", ".", "progress", "(", "fileNo", ",", "path", ")", ";", "if", "(", "target", ".", "exists", "(", ")", "&&", "(", "file", ".", "override", "(", ")", "!=", "OverrideType", ".", "OVERRIDE_TRUE", ")", "&&", "!", "isOverwriteFile", "(", "file", ",", "target", ")", ")", "{", "if", "(", "!", "file", ".", "isBackReference", "(", ")", "&&", "!", "pack", ".", "isLoose", "(", ")", ")", "{", "if", "(", "file", ".", "isPack200Jar", "(", ")", ")", "{", "skip", "(", "packInputStream", ",", "Integer", ".", "SIZE", "/", "8", ")", ";", "}", "else", "{", "skip", "(", "packInputStream", ",", "file", ".", "length", "(", ")", ")", ";", "}", "}", "}", "else", "{", "handleOverrideRename", "(", "file", ",", "target", ")", ";", "extract", "(", "file", ",", "target", ",", "packInputStream", ",", "pack", ",", "queue", ")", ";", "}", "}", "protected", "void", "extract", "(", "PackFile", "file", ",", "File", "target", ",", "ObjectInputStream", "packInputStream", ",", "Pack", "pack", ",", "FileQueue", "queue", ")", "throws", "IOException", "{", "ObjectInputStream", "packStream", "=", "packInputStream", ";", "InputStream", "in", "=", "null", ";", "try", "{", "FileUnpacker", "unpacker", ";", "if", "(", "!", "pack", ".", "isLoose", "(", ")", "&&", "file", ".", "isBackReference", "(", ")", ")", "{", "in", "=", "resources", ".", "getPackStream", "(", "file", ".", "previousPackId", ")", ";", "packStream", "=", "new", "ObjectInputStream", "(", "in", ")", ";", "skip", "(", "in", ",", "file", ".", "offsetInPreviousPack", "-", "4", ")", ";", "}", "unpacker", "=", "createFileUnpacker", "(", "file", ",", "pack", ",", "queue", ",", "cancellable", ")", ";", "unpacker", ".", "unpack", "(", "file", ",", "packStream", ",", "target", ")", ";", "checkInterrupt", "(", ")", ";", "if", "(", "!", "unpacker", ".", "isQueued", "(", ")", ")", "{", "listeners", ".", "afterFile", "(", "target", ",", "file", ",", "pack", ")", ";", "}", "}", "finally", "{", "FileUtils", ".", "close", "(", "in", ")", ";", "if", "(", "packStream", "!=", "packInputStream", ")", "{", "FileUtils", ".", "close", "(", "packStream", ")", ";", "}", "}", "}", "protected", "void", "skip", "(", "PackFile", "file", ",", "Pack", "pack", ",", "ObjectInputStream", "packInputStream", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "logger", ".", "fine", "(", "\"Skip", "\"", "+", "file", ".", "getTargetPath", "(", ")", ")", ";", "}", "if", "(", "!", "pack", ".", "isLoose", "(", ")", "&&", "!", "file", ".", "isBackReference", "(", ")", ")", "{", "skip", "(", "packInputStream", ",", "file", ".", "length", "(", ")", ")", ";", "}", "}", "protected", "FileUnpacker", "createFileUnpacker", "(", "PackFile", "file", ",", "Pack", "pack", ",", "FileQueue", "queue", ",", "Cancellable", "cancellable", ")", "throws", "IOException", ",", "InstallerException", "{", "FileUnpacker", "unpacker", ";", "if", "(", "pack", ".", "isLoose", "(", ")", ")", "{", "unpacker", "=", "new", "LooseFileUnpacker", "(", "getAbsoluteInstallSource", "(", ")", ",", "cancellable", ",", "queue", ",", "prompt", ")", ";", "}", "else", "if", "(", "file", ".", "isPack200Jar", "(", ")", ")", "{", "unpacker", "=", "new", "Pack200FileUnpacker", "(", "cancellable", ",", "resources", ",", "getPack200Unpacker", "(", ")", ",", "queue", ")", ";", "}", "else", "{", "unpacker", "=", "new", "DefaultFileUnpacker", "(", "cancellable", ",", "queue", ")", ";", "}", "return", "unpacker", ";", "}", "protected", "void", "postUnpack", "(", "List", "<", "Pack", ">", "packs", ",", "FileQueue", "queue", ",", "List", "<", "ParsableFile", ">", "parsables", ",", "List", "<", "ExecutableFile", ">", "executables", ",", "List", "<", "UpdateCheck", ">", "updateChecks", ")", "throws", "IOException", "{", "InstallData", "installData", "=", "getInstallData", "(", ")", ";", "if", "(", "queue", "!=", "null", "&&", "!", "queue", ".", "isEmpty", "(", ")", ")", "{", "queue", ".", "execute", "(", ")", ";", "installData", ".", "setRebootNecessary", "(", "queue", ".", "isRebootNecessary", "(", ")", ")", ";", "}", "checkInterrupt", "(", ")", ";", "parseFiles", "(", "parsables", ")", ";", "checkInterrupt", "(", ")", ";", "executeFiles", "(", "executables", ")", ";", "checkInterrupt", "(", ")", ";", "performUpdateChecks", "(", "updateChecks", ")", ";", "checkInterrupt", "(", ")", ";", "listeners", ".", "afterPacks", "(", "packs", ",", "listener", ")", ";", "checkInterrupt", "(", ")", ";", "writeInstallationInformation", "(", ")", ";", "listener", ".", "stopAction", "(", ")", ";", "}", "protected", "void", "cleanup", "(", ")", "{", "state", "=", "State", ".", "READY", ";", "}", "protected", "InstallData", "getInstallData", "(", ")", "{", "return", "installData", ";", "}", "protected", "UninstallData", "getUninstallData", "(", ")", "{", "return", "uninstallData", ";", "}", "protected", "PackResources", "getResources", "(", ")", "{", "return", "resources", ";", "}", "protected", "VariableSubstitutor", "getVariableSubstitutor", "(", ")", "{", "return", "variableSubstitutor", ";", "}", "protected", "ProgressListener", "getProgressListener", "(", ")", "{", "return", "listener", ";", "}", "protected", "Prompt", "getPrompt", "(", ")", "{", "return", "prompt", ";", "}", "protected", "boolean", "shouldUnpack", "(", "Pack", "pack", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "pack", ".", "hasCondition", "(", ")", ")", "{", "result", "=", "rules", ".", "isConditionTrue", "(", "pack", ".", "getCondition", "(", ")", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "setResult", "(", "boolean", "result", ")", "{", "this", ".", "result", "=", "result", ";", "}", "protected", "boolean", "isConditionTrue", "(", "String", "id", ")", "{", "return", "rules", ".", "isConditionTrue", "(", "id", ")", ";", "}", "protected", "String", "getStepName", "(", "Pack", "pack", ")", "{", "return", "pack", ".", "isHidden", "(", ")", "?", "\"\"", ":", "PackHelper", ".", "getPackName", "(", "pack", ",", "installData", ".", "getMessages", "(", ")", ")", ";", "}", "protected", "void", "createDirectory", "(", "File", "dir", ",", "PackFile", "file", ",", "Pack", "pack", ")", "{", "if", "(", "!", "dir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "listeners", ".", "isFileListener", "(", ")", ")", "{", "if", "(", "!", "dir", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "IzPackException", "(", "\"\"", "+", "dir", ".", "getPath", "(", ")", ")", ";", "}", "}", "else", "{", "File", "parent", "=", "dir", ".", "getParentFile", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "createDirectory", "(", "parent", ",", "file", ",", "pack", ")", ";", "}", "listeners", ".", "beforeDir", "(", "dir", ",", "file", ",", "pack", ")", ";", "if", "(", "!", "dir", ".", "mkdir", "(", ")", ")", "{", "throw", "new", "IzPackException", "(", "\"\"", "+", "dir", ".", "getPath", "(", ")", ")", ";", "}", "listeners", ".", "afterDir", "(", "dir", ",", "file", ",", "pack", ")", ";", "}", "}", "}", "private", "void", "parseFiles", "(", "List", "<", "ParsableFile", ">", "files", ")", "{", "if", "(", "!", "files", ".", "isEmpty", "(", ")", ")", "{", "ScriptParser", "parser", "=", "new", "ScriptParser", "(", "getVariableSubstitutor", "(", ")", ",", "matcher", ")", ";", "for", "(", "ParsableFile", "file", ":", "files", ")", "{", "try", "{", "parser", ".", "parse", "(", "file", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", "+", "file", ".", "getPath", "(", ")", ",", "exception", ")", ";", "}", "checkInterrupt", "(", ")", ";", "}", "}", "}", "private", "void", "executeFiles", "(", "List", "<", "ExecutableFile", ">", "executables", ")", "{", "if", "(", "!", "executables", ".", "isEmpty", "(", ")", ")", "{", "FileExecutor", "executor", "=", "new", "FileExecutor", "(", "executables", ")", ";", "PromptUIHandler", "handler", "=", "new", "ProgressHandler", "(", "listener", ",", "prompt", ")", ";", "if", "(", "executor", ".", "executeFiles", "(", "ExecutableFile", ".", "POSTINSTALL", ",", "matcher", ",", "handler", ")", "!=", "0", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", ")", ";", "}", "}", "}", "protected", "synchronized", "boolean", "isInterrupted", "(", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "state", "==", "State", ".", "INTERRUPT", ")", "{", "setResult", "(", "false", ")", ";", "state", "=", "State", ".", "INTERRUPTED", ";", "result", "=", "true", ";", "notifyAll", "(", ")", ";", "}", "else", "{", "if", "(", "state", "==", "State", ".", "INTERRUPTED", ")", "{", "result", "=", "true", ";", "}", "}", "return", "result", ";", "}", "protected", "void", "checkInterrupt", "(", ")", "{", "if", "(", "isInterrupted", "(", ")", ")", "{", "throw", "new", "ResourceInterruptedException", "(", "\"\"", ")", ";", "}", "}", "protected", "void", "performUpdateChecks", "(", "List", "<", "UpdateCheck", ">", "checks", ")", "{", "if", "(", "checks", "!=", "null", "&&", "!", "checks", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "File", "absoluteInstallPath", "=", "new", "File", "(", "installData", ".", "getInstallPath", "(", ")", ")", ".", "getAbsoluteFile", "(", ")", ";", "FileSet", "fileset", "=", "new", "FileSet", "(", ")", ";", "List", "<", "File", ">", "filesToDelete", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "List", "<", "File", ">", "dirsToDelete", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "try", "{", "fileset", ".", "setDir", "(", "absoluteInstallPath", ")", ";", "for", "(", "UpdateCheck", "check", ":", "checks", ")", "{", "if", "(", "check", ".", "includesList", "!=", "null", ")", "{", "for", "(", "String", "include", ":", "check", ".", "includesList", ")", "{", "fileset", ".", "createInclude", "(", ")", ".", "setName", "(", "variableSubstitutor", ".", "substitute", "(", "include", ")", ")", ";", "}", "}", "if", "(", "check", ".", "excludesList", "!=", "null", ")", "{", "for", "(", "String", "exclude", ":", "check", ".", "excludesList", ")", "{", "fileset", ".", "createExclude", "(", ")", ".", "setName", "(", "variableSubstitutor", ".", "substitute", "(", "exclude", ")", ")", ";", "}", "}", "}", "DirectoryScanner", "scanner", "=", "fileset", ".", "getDirectoryScanner", "(", ")", ";", "scanner", ".", "scan", "(", ")", ";", "String", "[", "]", "srcFiles", "=", "scanner", ".", "getIncludedFiles", "(", ")", ";", "String", "[", "]", "srcDirs", "=", "scanner", ".", "getIncludedDirectories", "(", ")", ";", "Set", "<", "File", ">", "installedFiles", "=", "new", "TreeSet", "<", "File", ">", "(", ")", ";", "for", "(", "String", "name", ":", "uninstallData", ".", "getInstalledFilesList", "(", ")", ")", "{", "File", "file", "=", "new", "File", "(", "name", ")", ";", "if", "(", "!", "file", ".", "isAbsolute", "(", ")", ")", "{", "file", "=", "new", "File", "(", "absoluteInstallPath", ",", "name", ")", ";", "}", "installedFiles", ".", "add", "(", "file", ")", ";", "}", "for", "(", "String", "srcFile", ":", "srcFiles", ")", "{", "File", "newFile", "=", "new", "File", "(", "scanner", ".", "getBasedir", "(", ")", ",", "srcFile", ")", ";", "if", "(", "!", "installedFiles", ".", "contains", "(", "newFile", ")", ")", "{", "filesToDelete", ".", "add", "(", "newFile", ")", ";", "}", "}", "for", "(", "String", "srcDir", ":", "srcDirs", ")", "{", "if", "(", "!", "srcDir", ".", "isEmpty", "(", ")", ")", "{", "File", "newDir", "=", "new", "File", "(", "scanner", ".", "getBasedir", "(", ")", ",", "srcDir", ")", ";", "if", "(", "!", "installedFiles", ".", "contains", "(", "newDir", ")", ")", "{", "dirsToDelete", ".", "add", "(", "newDir", ")", ";", "}", "}", "}", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "for", "(", "File", "f", ":", "filesToDelete", ")", "{", "if", "(", "!", "f", ".", "delete", "(", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "f", ")", ";", "}", "else", "{", "logger", ".", "fine", "(", "\"\"", "+", "f", ")", ";", "}", "}", "Collections", ".", "sort", "(", "dirsToDelete", ")", ";", "Collections", ".", "reverse", "(", "dirsToDelete", ")", ";", "for", "(", "File", "d", ":", "dirsToDelete", ")", "{", "if", "(", "!", "d", ".", "exists", "(", ")", ")", "{", "break", ";", "}", "File", "[", "]", "files", "=", "d", ".", "listFiles", "(", ")", ";", "if", "(", "files", "!=", "null", "&&", "files", ".", "length", "!=", "0", ")", "{", "break", ";", "}", "if", "(", "!", "d", ".", "delete", "(", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "d", ")", ";", "}", "else", "{", "logger", ".", "fine", "(", "\"\"", "+", "d", ")", ";", "}", "}", "}", "}", "protected", "void", "writeInstallationInformation", "(", ")", "throws", "IOException", "{", "if", "(", "!", "installData", ".", "getInfo", "(", ")", ".", "isWriteInstallationInformation", "(", ")", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "return", ";", "}", "logger", ".", "fine", "(", "\"\"", ")", ";", "String", "installDir", "=", "installData", ".", "getInstallPath", "(", ")", ";", "List", "<", "Pack", ">", "installedPacks", "=", "new", "ArrayList", "<", "Pack", ">", "(", "installData", ".", "getSelectedPacks", "(", ")", ")", ";", "File", "installationInfo", "=", "new", "File", "(", "installDir", "+", "File", ".", "separator", "+", "InstallData", ".", "INSTALLATION_INFORMATION", ")", ";", "if", "(", "!", "installationInfo", ".", "exists", "(", ")", ")", "{", "logger", ".", "fine", "(", "\"\"", "+", "installationInfo", ".", "getAbsolutePath", "(", ")", ")", ";", "File", "dir", "=", "new", "File", "(", "installData", ".", "getInstallPath", "(", ")", ")", ";", "if", "(", "!", "dir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "dir", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", "+", "dir", ")", ";", "}", "}", "if", "(", "!", "installationInfo", ".", "createNewFile", "(", ")", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", "+", "installationInfo", ")", ";", "}", "}", "else", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "FileInputStream", "fin", "=", "new", "FileInputStream", "(", "installationInfo", ")", ";", "ObjectInputStream", "oin", "=", "new", "ObjectInputStream", "(", "fin", ")", ";", "List", "<", "Pack", ">", "packs", ";", "try", "{", "packs", "=", "(", "List", "<", "Pack", ">", ")", "oin", ".", "readObject", "(", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", ",", "exception", ")", ";", "}", "for", "(", "Pack", "pack", ":", "packs", ")", "{", "installedPacks", ".", "add", "(", "pack", ")", ";", "}", "FileUtils", ".", "close", "(", "oin", ")", ";", "FileUtils", ".", "close", "(", "fin", ")", ";", "}", "FileOutputStream", "fout", "=", "new", "FileOutputStream", "(", "installationInfo", ")", ";", "ObjectOutputStream", "oout", "=", "new", "ObjectOutputStream", "(", "fout", ")", ";", "oout", ".", "writeObject", "(", "installedPacks", ")", ";", "oout", ".", "writeObject", "(", "installData", ".", "getVariables", "(", ")", ".", "getProperties", "(", ")", ")", ";", "logger", ".", "fine", "(", "\"\"", ")", ";", "FileUtils", ".", "close", "(", "oout", ")", ";", "FileUtils", ".", "close", "(", "fout", ")", ";", "}", "protected", "File", "getAbsoluteInstallSource", "(", ")", "throws", "IOException", ",", "InstallerException", "{", "if", "(", "absoluteInstallSource", "==", "null", ")", "{", "URI", "uri", ";", "try", "{", "uri", "=", "getClass", "(", ")", ".", "getProtectionDomain", "(", ")", ".", "getCodeSource", "(", ")", ".", "getLocation", "(", ")", ".", "toURI", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "exception", ")", "{", "throw", "new", "InstallerException", "(", "exception", ")", ";", "}", "if", "(", "!", "\"file\"", ".", "equals", "(", "uri", ".", "getScheme", "(", ")", ")", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", "+", "uri", ")", ";", "}", "absoluteInstallSource", "=", "new", "File", "(", "uri", ".", "getSchemeSpecificPart", "(", ")", ")", ".", "getAbsoluteFile", "(", ")", ";", "if", "(", "absoluteInstallSource", ".", "getName", "(", ")", ".", "endsWith", "(", "\".jar\"", ")", ")", "{", "absoluteInstallSource", "=", "absoluteInstallSource", ".", "getParentFile", "(", ")", ";", "}", "}", "return", "absoluteInstallSource", ";", "}", "protected", "void", "skip", "(", "InputStream", "stream", ",", "long", "bytes", ")", "throws", "IOException", "{", "long", "skipped", "=", "stream", ".", "skip", "(", "bytes", ")", ";", "if", "(", "skipped", "!=", "bytes", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "bytes", "+", "\"\"", "+", "skipped", ")", ";", "}", "}", "protected", "boolean", "isOverwriteFile", "(", "PackFile", "pf", ",", "File", "file", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "pf", ".", "override", "(", ")", "!=", "OverrideType", ".", "OVERRIDE_FALSE", ")", "{", "if", "(", "pf", ".", "override", "(", ")", "==", "OverrideType", ".", "OVERRIDE_TRUE", ")", "{", "result", "=", "true", ";", "}", "else", "if", "(", "pf", ".", "override", "(", ")", "==", "OverrideType", ".", "OVERRIDE_UPDATE", ")", "{", "result", "=", "(", "file", ".", "lastModified", "(", ")", "<", "pf", ".", "lastModified", "(", ")", ")", ";", "}", "else", "{", "Option", "defChoice", "=", "null", ";", "if", "(", "pf", ".", "override", "(", ")", "==", "OverrideType", ".", "OVERRIDE_ASK_FALSE", ")", "{", "defChoice", "=", "Option", ".", "NO", ";", "}", "else", "if", "(", "pf", ".", "override", "(", ")", "==", "OverrideType", ".", "OVERRIDE_ASK_TRUE", ")", "{", "defChoice", "=", "Option", ".", "YES", ";", "}", "Messages", "messages", "=", "installData", ".", "getMessages", "(", ")", ";", "Option", "answer", "=", "prompt", ".", "confirm", "(", "Type", ".", "QUESTION", ",", "messages", ".", "get", "(", "\"\"", ")", "+", "\"", "-", "\"", "+", "file", ".", "getName", "(", ")", ",", "messages", ".", "get", "(", "\"\"", ")", "+", "file", ".", "getAbsolutePath", "(", ")", ",", "Options", ".", "YES_NO", ",", "defChoice", ")", ";", "result", "=", "(", "answer", "==", "Option", ".", "YES", ")", ";", "}", "}", "return", "result", ";", "}", "protected", "void", "handleOverrideRename", "(", "PackFile", "pf", ",", "File", "file", ")", "{", "if", "(", "file", ".", "exists", "(", ")", "&&", "pf", ".", "overrideRenameTo", "(", ")", "!=", "null", ")", "{", "GlobPatternMapper", "mapper", "=", "new", "GlobPatternMapper", "(", ")", ";", "mapper", ".", "setFrom", "(", "\"*\"", ")", ";", "mapper", ".", "setTo", "(", "pf", ".", "overrideRenameTo", "(", ")", ")", ";", "mapper", ".", "setCaseSensitive", "(", "true", ")", ";", "String", "[", "]", "newFileNameArr", "=", "mapper", ".", "mapFileName", "(", "file", ".", "getName", "(", ")", ")", ";", "if", "(", "newFileNameArr", "!=", "null", ")", "{", "String", "newFileName", "=", "newFileNameArr", "[", "0", "]", ";", "File", "newPathFile", "=", "new", "File", "(", "file", ".", "getParent", "(", ")", ",", "newFileName", ")", ";", "if", "(", "newPathFile", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "newPathFile", ".", "delete", "(", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "newPathFile", ")", ";", "}", "}", "if", "(", "!", "file", ".", "renameTo", "(", "newPathFile", ")", ")", "{", "throw", "new", "InstallerException", "(", "\"The", "file", "\"", "+", "file", "+", "\"\"", "+", "newPathFile", ")", ";", "}", "}", "else", "{", "throw", "new", "InstallerException", "(", "\"File", "name", "\"", "+", "file", ".", "getName", "(", ")", "+", "\"\"", "+", "pf", ".", "overrideRenameTo", "(", ")", "+", "\"\\\"\"", ")", ";", "}", "}", "}", "protected", "void", "readParsableFiles", "(", "ObjectInputStream", "stream", ",", "List", "<", "ParsableFile", ">", "parsables", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "count", "=", "stream", ".", "readInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "ParsableFile", "file", "=", "(", "ParsableFile", ")", "stream", ".", "readObject", "(", ")", ";", "if", "(", "!", "file", ".", "hasCondition", "(", ")", "||", "isConditionTrue", "(", "file", ".", "getCondition", "(", ")", ")", ")", "{", "String", "path", "=", "IoHelper", ".", "translatePath", "(", "file", ".", "getPath", "(", ")", ",", "installData", ".", "getVariables", "(", ")", ")", ";", "file", ".", "setPath", "(", "path", ")", ";", "parsables", ".", "add", "(", "file", ")", ";", "}", "}", "}", "protected", "void", "readExecutableFiles", "(", "ObjectInputStream", "stream", ",", "List", "<", "ExecutableFile", ">", "executables", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "count", "=", "stream", ".", "readInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "ExecutableFile", "file", "=", "(", "ExecutableFile", ")", "stream", ".", "readObject", "(", ")", ";", "if", "(", "!", "file", ".", "hasCondition", "(", ")", "||", "isConditionTrue", "(", "file", ".", "getCondition", "(", ")", ")", ")", "{", "Variables", "variables", "=", "installData", ".", "getVariables", "(", ")", ";", "file", ".", "path", "=", "IoHelper", ".", "translatePath", "(", "file", ".", "path", ",", "variables", ")", ";", "if", "(", "null", "!=", "file", ".", "argList", "&&", "!", "file", ".", "argList", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "file", ".", "argList", ".", "size", "(", ")", ";", "j", "++", ")", "{", "String", "arg", "=", "file", ".", "argList", ".", "get", "(", "j", ")", ";", "arg", "=", "IoHelper", ".", "translatePath", "(", "arg", ",", "variables", ")", ";", "file", ".", "argList", ".", "set", "(", "j", ",", "arg", ")", ";", "}", "}", "executables", ".", "add", "(", "file", ")", ";", "if", "(", "file", ".", "executionStage", "==", "ExecutableFile", ".", "UNINSTALL", ")", "{", "uninstallData", ".", "addExecutable", "(", "file", ")", ";", "}", "}", "}", "}", "protected", "void", "readUpdateChecks", "(", "ObjectInputStream", "stream", ",", "List", "<", "UpdateCheck", ">", "updateChecks", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "count", "=", "stream", ".", "readInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "UpdateCheck", "check", "=", "(", "UpdateCheck", ")", "stream", ".", "readObject", "(", ")", ";", "updateChecks", ".", "add", "(", "check", ")", ";", "}", "}", "private", "Pack200", ".", "Unpacker", "getPack200Unpacker", "(", ")", "{", "if", "(", "unpacker", "==", "null", ")", "{", "unpacker", "=", "Pack200", ".", "newUnpacker", "(", ")", ";", "}", "return", "unpacker", ";", "}", "}", "</s>" ]
10,614
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceInterruptedException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceNotFoundException", ";", "public", "interface", "PackResources", "{", "InputStream", "getPackStream", "(", "String", "name", ")", ";", "InputStream", "getInputStream", "(", "String", "name", ")", ";", "}", "</s>" ]
10,615
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Pack", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ".", "FileQueue", ";", "public", "class", "LooseFileUnpacker", "extends", "FileUnpacker", "{", "private", "final", "File", "sourceDir", ";", "private", "final", "Prompt", "prompt", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "LooseFileUnpacker", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "LooseFileUnpacker", "(", "File", "sourceDir", ",", "Cancellable", "cancellable", ",", "FileQueue", "queue", ",", "Prompt", "prompt", ")", "{", "super", "(", "cancellable", ",", "queue", ")", ";", "this", ".", "sourceDir", "=", "sourceDir", ";", "this", ".", "prompt", "=", "prompt", ";", "}", "@", "Override", "public", "void", "unpack", "(", "PackFile", "file", ",", "ObjectInputStream", "packInputStream", ",", "File", "target", ")", "throws", "IOException", ",", "InstallerException", "{", "File", "resolvedFile", "=", "new", "File", "(", "sourceDir", ",", "file", ".", "getRelativeSourcePath", "(", ")", ")", ";", "if", "(", "!", "resolvedFile", ".", "exists", "(", ")", ")", "{", "final", "File", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ";", "resolvedFile", "=", "new", "File", "(", "userDir", ",", "file", ".", "getRelativeSourcePath", "(", ")", ")", ";", "}", "if", "(", "resolvedFile", ".", "exists", "(", ")", ")", "{", "InputStream", "stream", "=", "new", "FileInputStream", "(", "resolvedFile", ")", ";", "file", "=", "new", "PackFile", "(", "resolvedFile", ".", "getParentFile", "(", ")", ",", "resolvedFile", ",", "file", ".", "getTargetPath", "(", ")", ",", "file", ".", "osConstraints", "(", ")", ",", "file", ".", "override", "(", ")", ",", "file", ".", "overrideRenameTo", "(", ")", ",", "file", ".", "blockable", "(", ")", ",", "file", ".", "getAdditionals", "(", ")", ")", ";", "copy", "(", "file", ",", "stream", ",", "target", ")", ";", "}", "else", "{", "logger", ".", "warning", "(", "\"\"", "+", "file", ".", "getRelativeSourcePath", "(", ")", ")", ";", "if", "(", "prompt", ".", "confirm", "(", "Prompt", ".", "Type", ".", "WARNING", ",", "\"\"", ",", "\"\"", "+", "file", ".", "getRelativeSourcePath", "(", ")", ",", "Prompt", ".", "Options", ".", "OK_CANCEL", ")", "==", "Prompt", ".", "Option", ".", "OK", ")", "{", "throw", "new", "InstallerException", "(", "\"\"", ")", ";", "}", "}", "}", "}", "</s>" ]
10,616
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "public", "class", "ConsolePackResources", "extends", "AbstractPackResources", "{", "public", "ConsolePackResources", "(", "Resources", "resources", ",", "InstallData", "installData", ")", "{", "super", "(", "resources", ",", "installData", ")", ";", "}", "@", "Override", "protected", "InputStream", "getWebPackStream", "(", "String", "name", ",", "String", "webDirURL", ")", "{", "throw", "new", "ResourceException", "(", "\"\"", "+", "name", "+", "\"", "from", "URL:", "\"", "+", "webDirURL", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
10,617
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "class", "ConsoleInstallAction", "extends", "AbstractInstallAction", "{", "private", "final", "Console", "console", ";", "public", "ConsoleInstallAction", "(", "Console", "console", ",", "InstallData", "installData", ",", "UninstallDataWriter", "writer", ")", "{", "super", "(", "installData", ",", "writer", ")", ";", "this", ".", "console", "=", "console", ";", "}", "@", "Override", "public", "boolean", "run", "(", "ConsolePanelView", "panel", ")", "{", "PanelConsole", "view", "=", "panel", ".", "getView", "(", ")", ";", "return", "view", ".", "runConsole", "(", "getInstallData", "(", ")", ",", "console", ")", ";", "}", "}", "</s>" ]
10,618
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "class", "GeneratePropertiesAction", "extends", "ConsoleAction", "{", "private", "final", "PrintWriter", "writer", ";", "public", "GeneratePropertiesAction", "(", "InstallData", "installData", ",", "String", "path", ")", "throws", "FileNotFoundException", "{", "super", "(", "installData", ")", ";", "writer", "=", "new", "PrintWriter", "(", "new", "FileOutputStream", "(", "path", ")", ",", "true", ")", ";", "}", "@", "Override", "public", "boolean", "isInstall", "(", ")", "{", "return", "false", ";", "}", "@", "Override", "public", "boolean", "run", "(", "ConsolePanelView", "panel", ")", "{", "return", "panel", ".", "getView", "(", ")", ".", "runGeneratePropertiesFile", "(", "getInstallData", "(", ")", ",", "writer", ")", ";", "}", "@", "Override", "public", "boolean", "complete", "(", ")", "{", "FileUtils", ".", "close", "(", "writer", ")", ";", "return", "true", ";", "}", "}", "</s>" ]
10,619
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "panel", ".", "AbstractPanels", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "panel", ".", "Panels", ";", "public", "class", "ConsolePanels", "extends", "AbstractPanels", "<", "ConsolePanelView", ",", "PanelConsole", ">", "{", "private", "ConsoleAction", "action", ";", "public", "ConsolePanels", "(", "List", "<", "ConsolePanelView", ">", "panels", ",", "Variables", "variables", ")", "{", "super", "(", "panels", ",", "variables", ")", ";", "}", "public", "void", "setAction", "(", "ConsoleAction", "action", ")", "{", "this", ".", "action", "=", "action", ";", "}", "@", "Override", "protected", "boolean", "switchPanel", "(", "ConsolePanelView", "newPanel", ",", "ConsolePanelView", "oldPanel", ")", "{", "boolean", "result", "=", "false", ";", "newPanel", ".", "executePreActivationActions", "(", ")", ";", "if", "(", "action", "!=", "null", ")", "{", "do", "{", "result", "=", "action", ".", "run", "(", "newPanel", ")", ";", "if", "(", "!", "result", ")", "{", "break", ";", "}", "}", "while", "(", "!", "newPanel", ".", "isValid", "(", ")", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,620
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "abstract", "class", "ConsoleAction", "{", "private", "final", "InstallData", "installData", ";", "public", "ConsoleAction", "(", "InstallData", "installData", ")", "{", "this", ".", "installData", "=", "installData", ";", "}", "public", "abstract", "boolean", "run", "(", "ConsolePanelView", "panel", ")", ";", "public", "abstract", "boolean", "complete", "(", ")", ";", "public", "boolean", "isInstall", "(", ")", "{", "return", "true", ";", "}", "protected", "InstallData", "getInstallData", "(", ")", "{", "return", "installData", ";", "}", "}", "</s>" ]
10,621
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "class", "PropertyInstallAction", "extends", "AbstractInstallAction", "{", "private", "final", "Properties", "properties", ";", "public", "PropertyInstallAction", "(", "InstallData", "installData", ",", "UninstallDataWriter", "writer", ",", "Properties", "properties", ")", "{", "super", "(", "installData", ",", "writer", ")", ";", "this", ".", "properties", "=", "properties", ";", "}", "@", "Override", "public", "boolean", "run", "(", "ConsolePanelView", "panel", ")", "{", "return", "panel", ".", "getView", "(", ")", ".", "runConsoleFromProperties", "(", "getInstallData", "(", ")", ",", "properties", ")", ";", "}", "}", "</s>" ]
10,622
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "public", "abstract", "class", "AbstractPanelConsole", "implements", "PanelConsole", "{", "@", "Override", "public", "boolean", "runGeneratePropertiesFile", "(", "InstallData", "installData", ",", "PrintWriter", "printWriter", ")", "{", "return", "true", ";", "}", "@", "Override", "public", "boolean", "runConsole", "(", "InstallData", "installData", ")", "{", "return", "runConsole", "(", "installData", ",", "new", "Console", "(", ")", ")", ";", "}", "protected", "boolean", "promptEndPanel", "(", "InstallData", "installData", ",", "Console", "console", ")", "{", "boolean", "result", ";", "int", "value", "=", "console", ".", "prompt", "(", "\"\"", ",", "1", ",", "3", ",", "2", ")", ";", "result", "=", "value", "==", "1", "||", "value", "!=", "2", "&&", "runConsole", "(", "installData", ",", "console", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,623
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "public", "abstract", "class", "AbstractInstallAction", "extends", "ConsoleAction", "{", "private", "final", "UninstallDataWriter", "writer", ";", "public", "AbstractInstallAction", "(", "InstallData", "installData", ",", "UninstallDataWriter", "writer", ")", "{", "super", "(", "installData", ")", ";", "this", ".", "writer", "=", "writer", ";", "}", "@", "Override", "public", "boolean", "complete", "(", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "writer", ".", "isUninstallRequired", "(", ")", ")", "{", "result", "=", "writer", ".", "write", "(", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,624
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "AbstractUIHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "handler", ".", "ConsolePrompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "handler", ".", "PromptUIHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "panel", ".", "PanelView", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "public", "class", "ConsolePanelView", "extends", "PanelView", "<", "PanelConsole", ">", "{", "private", "final", "Console", "console", ";", "private", "final", "ConsolePrompt", "prompt", ";", "public", "ConsolePanelView", "(", "Panel", "panel", ",", "ObjectFactory", "factory", ",", "InstallData", "installData", ",", "Console", "console", ")", "{", "super", "(", "panel", ",", "PanelConsole", ".", "class", ",", "factory", ",", "installData", ")", ";", "this", ".", "console", "=", "console", ";", "this", ".", "prompt", "=", "new", "ConsolePrompt", "(", "console", ")", ";", "}", "public", "Class", "<", "PanelConsole", ">", "getViewClass", "(", ")", "{", "Panel", "panel", "=", "getPanel", "(", ")", ";", "Class", "<", "PanelConsole", ">", "result", "=", "getClass", "(", "panel", ".", "getClassName", "(", ")", "+", "\"Console\"", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getClass", "(", "panel", ".", "getClassName", "(", ")", "+", "\"\"", ")", ";", "}", "return", "result", ";", "}", "@", "Override", "protected", "PanelConsole", "createView", "(", "Panel", "panel", ",", "Class", "<", "PanelConsole", ">", "viewClass", ")", "{", "Class", "<", "PanelConsole", ">", "impl", "=", "getViewClass", "(", ")", ";", "if", "(", "impl", "==", "null", ")", "{", "throw", "new", "IzPackException", "(", "\"\"", "+", "panel", ".", "getClassName", "(", ")", ")", ";", "}", "return", "getFactory", "(", ")", ".", "create", "(", "impl", ")", ";", "}", "@", "Override", "protected", "AbstractUIHandler", "getHandler", "(", ")", "{", "return", "new", "PromptUIHandler", "(", "prompt", ")", "{", "@", "Override", "public", "void", "emitNotification", "(", "String", "message", ")", "{", "console", ".", "println", "(", "message", ")", ";", "}", "}", ";", "}", "}", "</s>" ]
10,625
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "public", "interface", "PanelConsole", "{", "boolean", "runGeneratePropertiesFile", "(", "InstallData", "installData", ",", "PrintWriter", "printWriter", ")", ";", "boolean", "runConsoleFromProperties", "(", "InstallData", "installData", ",", "Properties", "properties", ")", ";", "boolean", "runConsole", "(", "InstallData", "installData", ")", ";", "boolean", "runConsole", "(", "InstallData", "installData", ",", "Console", "console", ")", ";", "}", "</s>" ]
10,626
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "automation", ".", "PanelAutomationHelper", ";", "public", "class", "ConsolePanelAutomationHelper", "extends", "PanelAutomationHelper", "{", "public", "ConsolePanelAutomationHelper", "(", ")", "{", "super", "(", ")", ";", "}", "}", "</s>" ]
10,627
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "public", "abstract", "class", "AbstractTextPanelConsole", "extends", "AbstractPanelConsole", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "AbstractTextPanelConsole", ".", "class", ".", "getName", "(", ")", ")", ";", "@", "Override", "public", "boolean", "runConsoleFromProperties", "(", "InstallData", "installData", ",", "Properties", "properties", ")", "{", "return", "true", ";", "}", "@", "Override", "public", "boolean", "runConsole", "(", "InstallData", "installData", ",", "Console", "console", ")", "{", "boolean", "result", ";", "String", "text", "=", "getText", "(", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "result", "=", "paginateText", "(", "text", ",", "console", ")", ";", "}", "else", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "result", "=", "false", ";", "}", "return", "result", "&&", "promptEndPanel", "(", "installData", ",", "console", ")", ";", "}", "protected", "abstract", "String", "getText", "(", ")", ";", "protected", "boolean", "paginateText", "(", "String", "text", ",", "Console", "console", ")", "{", "boolean", "result", "=", "true", ";", "int", "lines", "=", "22", ";", "int", "line", "=", "0", ";", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "text", ",", "\"n\"", ")", ";", "while", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokens", ".", "nextToken", "(", ")", ";", "console", ".", "println", "(", "token", ")", ";", "line", "++", ";", "if", "(", "line", ">=", "lines", "&&", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "if", "(", "!", "promptContinue", "(", "console", ")", ")", "{", "result", "=", "false", ";", "break", ";", "}", "line", "=", "0", ";", "}", "}", "return", "result", ";", "}", "protected", "boolean", "promptContinue", "(", "Console", "console", ")", "{", "String", "value", "=", "console", ".", "prompt", "(", "\"\"", ",", "\"x\"", ")", ";", "console", ".", "println", "(", ")", ";", "return", "!", "value", ".", "equalsIgnoreCase", "(", "\"x\"", ")", ";", "}", "}", "</s>" ]
10,628
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "abstract", "public", "class", "PanelConsoleHelper", "extends", "AbstractPanelConsole", "{", "@", "Deprecated", "public", "int", "askEndOfConsolePanel", "(", ")", "{", "return", "new", "Console", "(", ")", ".", "prompt", "(", "\"\"", ",", "1", ",", "3", ",", "2", ")", ";", "}", "}", "</s>" ]
10,629
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "class", "PanelConsoleFactory", "{", "private", "final", "ObjectFactory", "factory", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "PanelConsoleFactory", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "PanelConsoleFactory", "(", "ObjectFactory", "factory", ")", "{", "this", ".", "factory", "=", "factory", ";", "}", "public", "PanelConsole", "create", "(", "Panel", "panel", ")", "throws", "InstallerException", "{", "Class", "<", "PanelConsole", ">", "impl", "=", "getClass", "(", "panel", ")", ";", "return", "factory", ".", "create", "(", "impl", ")", ";", "}", "public", "Class", "<", "PanelConsole", ">", "getClass", "(", "Panel", "panel", ")", "{", "Class", "<", "PanelConsole", ">", "result", "=", "getClass", "(", "panel", ".", "getClassName", "(", ")", "+", "\"Console\"", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getClass", "(", "panel", ".", "getClassName", "(", ")", "+", "\"\"", ")", ";", "}", "return", "result", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Class", "<", "PanelConsole", ">", "getClass", "(", "String", "name", ")", "{", "Class", "<", "PanelConsole", ">", "result", "=", "null", ";", "try", "{", "Class", "type", "=", "Class", ".", "forName", "(", "name", ")", ";", "if", "(", "!", "PanelConsole", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "{", "logger", ".", "warning", "(", "name", "+", "\"\"", "+", "PanelConsole", ".", "class", ".", "getName", "(", ")", "+", "\",", "ignoring\"", ")", ";", "}", "else", "{", "result", "=", "(", "Class", "<", "PanelConsole", ">", ")", "type", ";", "}", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "logger", ".", "fine", "(", "\"\"", "+", "name", "+", "\":", "\"", "+", "e", ".", "toString", "(", ")", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,630
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "AutomatedInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Info", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "base", ".", "InstallerBase", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "bootstrap", ".", "Installer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "requirement", ".", "RequirementsChecker", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "public", "class", "ConsoleInstaller", "extends", "InstallerBase", "{", "private", "final", "ConsolePanels", "panels", ";", "private", "InstallData", "installData", ";", "private", "final", "RequirementsChecker", "requirements", ";", "private", "UninstallDataWriter", "uninstallDataWriter", ";", "private", "Console", "console", ";", "private", "final", "Housekeeper", "housekeeper", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "ConsoleInstaller", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "ConsoleInstaller", "(", "ConsolePanels", "panels", ",", "AutomatedInstallData", "installData", ",", "RequirementsChecker", "requirements", ",", "UninstallDataWriter", "uninstallDataWriter", ",", "Console", "console", ",", "Housekeeper", "housekeeper", ")", "{", "this", ".", "panels", "=", "panels", ";", "this", ".", "installData", "=", "installData", ";", "this", ".", "requirements", "=", "requirements", ";", "this", ".", "uninstallDataWriter", "=", "uninstallDataWriter", ";", "this", ".", "console", "=", "console", ";", "this", ".", "housekeeper", "=", "housekeeper", ";", "}", "public", "boolean", "canInstall", "(", ")", "{", "boolean", "success", "=", "true", ";", "for", "(", "ConsolePanelView", "panel", ":", "panels", ".", "getPanelViews", "(", ")", ")", "{", "if", "(", "panel", ".", "getViewClass", "(", ")", "==", "null", ")", "{", "success", "=", "false", ";", "logger", ".", "warning", "(", "\"\"", "+", "panel", ".", "getPanel", "(", ")", ".", "getClassName", "(", ")", ")", ";", "}", "}", "return", "success", ";", "}", "public", "void", "setMediaPath", "(", "String", "path", ")", "{", "installData", ".", "setMediaPath", "(", "path", ")", ";", "}", "public", "void", "run", "(", "int", "type", ",", "String", "path", ")", "{", "boolean", "success", "=", "false", ";", "ConsoleAction", "action", "=", "null", ";", "if", "(", "!", "canInstall", "(", ")", ")", "{", "console", ".", "println", "(", "\"\"", ")", ";", "shutdown", "(", "false", ",", "false", ")", ";", "}", "else", "{", "try", "{", "if", "(", "requirements", ".", "check", "(", ")", ")", "{", "action", "=", "createConsoleAction", "(", "type", ",", "path", ",", "console", ")", ";", "panels", ".", "setAction", "(", "action", ")", ";", "while", "(", "panels", ".", "hasNext", "(", ")", ")", "{", "success", "=", "panels", ".", "next", "(", ")", ";", "if", "(", "!", "success", ")", "{", "break", ";", "}", "}", "if", "(", "success", ")", "{", "success", "=", "panels", ".", "isValid", "(", ")", ";", "if", "(", "success", ")", "{", "success", "=", "action", ".", "complete", "(", ")", ";", "}", "}", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "success", "=", "false", ";", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "t", ".", "getMessage", "(", ")", ",", "t", ")", ";", "}", "finally", "{", "if", "(", "action", "!=", "null", "&&", "action", ".", "isInstall", "(", ")", ")", "{", "shutdown", "(", "success", ",", "console", ")", ";", "}", "else", "{", "shutdown", "(", "success", ",", "false", ")", ";", "}", "}", "}", "}", "protected", "void", "shutdown", "(", "boolean", "exitSuccess", ",", "Console", "console", ")", "{", "boolean", "reboot", "=", "false", ";", "if", "(", "installData", ".", "isRebootNecessary", "(", ")", ")", "{", "console", ".", "println", "(", "\"\"", ")", ";", "switch", "(", "installData", ".", "getInfo", "(", ")", ".", "getRebootAction", "(", ")", ")", "{", "case", "Info", ".", "REBOOT_ACTION_ALWAYS", ":", "reboot", "=", "true", ";", "}", "if", "(", "reboot", ")", "{", "console", ".", "println", "(", "\"\"", ")", ";", "}", "}", "shutdown", "(", "exitSuccess", ",", "reboot", ")", ";", "}", "protected", "void", "shutdown", "(", "boolean", "exitSuccess", ",", "boolean", "reboot", ")", "{", "if", "(", "exitSuccess", "&&", "!", "installData", ".", "isInstallSuccess", "(", ")", ")", "{", "logger", ".", "severe", "(", "\"\"", ")", ";", "exitSuccess", "=", "false", ";", "}", "installData", ".", "setInstallSuccess", "(", "exitSuccess", ")", ";", "if", "(", "exitSuccess", ")", "{", "console", ".", "println", "(", "\"\"", ")", ";", "}", "else", "{", "console", ".", "println", "(", "\"\"", ")", ";", "}", "terminate", "(", "exitSuccess", ",", "reboot", ")", ";", "}", "protected", "void", "terminate", "(", "boolean", "exitSuccess", ",", "boolean", "reboot", ")", "{", "housekeeper", ".", "shutDown", "(", "exitSuccess", "?", "0", ":", "1", ",", "reboot", ")", ";", "}", "protected", "Console", "getConsole", "(", ")", "{", "return", "console", ";", "}", "private", "ConsoleAction", "createConsoleAction", "(", "int", "type", ",", "String", "path", ",", "Console", "console", ")", "throws", "IOException", "{", "ConsoleAction", "action", ";", "switch", "(", "type", ")", "{", "case", "Installer", ".", "CONSOLE_GEN_TEMPLATE", ":", "action", "=", "createGeneratePropertiesAction", "(", "path", ")", ";", "break", ";", "case", "Installer", ".", "CONSOLE_FROM_TEMPLATE", ":", "action", "=", "createInstallFromPropertiesFileAction", "(", "path", ")", ";", "break", ";", "case", "Installer", ".", "CONSOLE_FROM_SYSTEMPROPERTIES", ":", "action", "=", "new", "PropertyInstallAction", "(", "installData", ",", "uninstallDataWriter", ",", "System", ".", "getProperties", "(", ")", ")", ";", "break", ";", "case", "Installer", ".", "CONSOLE_FROM_SYSTEMPROPERTIESMERGE", ":", "action", "=", "createInstallFromSystemPropertiesMergeAction", "(", "path", ",", "console", ")", ";", "break", ";", "default", ":", "action", "=", "createInstallAction", "(", ")", ";", "}", "return", "action", ";", "}", "private", "ConsoleAction", "createInstallAction", "(", ")", "{", "return", "new", "ConsoleInstallAction", "(", "console", ",", "installData", ",", "uninstallDataWriter", ")", ";", "}", "private", "ConsoleAction", "createGeneratePropertiesAction", "(", "String", "path", ")", "throws", "IOException", "{", "return", "new", "GeneratePropertiesAction", "(", "installData", ",", "path", ")", ";", "}", "private", "ConsoleAction", "createInstallFromPropertiesFileAction", "(", "String", "path", ")", "throws", "IOException", "{", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "path", ")", ";", "try", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "load", "(", "in", ")", ";", "return", "new", "PropertyInstallAction", "(", "installData", ",", "uninstallDataWriter", ",", "properties", ")", ";", "}", "finally", "{", "FileUtils", ".", "close", "(", "in", ")", ";", "}", "}", "private", "ConsoleAction", "createInstallFromSystemPropertiesMergeAction", "(", "String", "path", ",", "Console", "console", ")", "throws", "IOException", "{", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "path", ")", ";", "try", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "load", "(", "in", ")", ";", "Properties", "systemProperties", "=", "System", ".", "getProperties", "(", ")", ";", "Enumeration", "<", "?", ">", "e", "=", "systemProperties", ".", "propertyNames", "(", ")", ";", "while", "(", "e", ".", "hasMoreElements", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "String", "newValue", "=", "systemProperties", ".", "getProperty", "(", "key", ")", ";", "String", "oldValue", "=", "(", "String", ")", "properties", ".", "setProperty", "(", "key", ",", "newValue", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "{", "console", ".", "println", "(", "\"\"", "+", "key", "+", "\"\"", "+", "oldValue", "+", "\"'", "-->", "'\"", "+", "newValue", "+", "\"'\"", ")", ";", "}", "}", "return", "new", "PropertyInstallAction", "(", "installData", ",", "uninstallDataWriter", ",", "properties", ")", ";", "}", "finally", "{", "FileUtils", ".", "close", "(", "in", ")", ";", "}", "}", "}", "</s>" ]
10,631
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "event", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "AutomatedInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Pack", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "PackFile", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "InstallerListener", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "ProgressListener", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "event", ".", "ProgressNotifiers", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "AbstractUIProgressHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Messages", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "helper", ".", "SpecHelper", ";", "@", "Deprecated", "public", "class", "SimpleInstallerListener", "implements", "InstallerListener", "{", "protected", "static", "final", "String", "LANG_FILE_NAME", "=", "\"\"", ";", "private", "Messages", "messages", ";", "private", "AutomatedInstallData", "installData", "=", "null", ";", "private", "SpecHelper", "specHelper", "=", "null", ";", "private", "final", "Resources", "resources", ";", "private", "final", "ProgressNotifiers", "notifiers", ";", "private", "AbstractUIProgressHandler", "handler", ";", "public", "SimpleInstallerListener", "(", "Resources", "resources", ")", "{", "this", "(", "resources", ",", "null", ",", "false", ")", ";", "}", "public", "SimpleInstallerListener", "(", "Resources", "resources", ",", "ProgressNotifiers", "notifiers", ")", "{", "this", "(", "resources", ",", "notifiers", ",", "false", ")", ";", "}", "public", "SimpleInstallerListener", "(", "Resources", "resources", ",", "boolean", "useSpecHelper", ")", "{", "this", "(", "resources", ",", "null", ",", "useSpecHelper", ")", ";", "}", "public", "SimpleInstallerListener", "(", "Resources", "resources", ",", "ProgressNotifiers", "notifiers", ",", "boolean", "useSpecHelper", ")", "{", "super", "(", ")", ";", "if", "(", "useSpecHelper", ")", "{", "setSpecHelper", "(", "new", "SpecHelper", "(", "resources", ")", ")", ";", "}", "this", ".", "resources", "=", "resources", ";", "this", ".", "notifiers", "=", "notifiers", ";", "}", "public", "void", "setHandler", "(", "AbstractUIProgressHandler", "handler", ")", "{", "this", ".", "handler", "=", "handler", ";", "}", "@", "Override", "public", "void", "initialise", "(", ")", "{", "try", "{", "afterInstallerInitialization", "(", "installData", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "beforePacks", "(", "List", "<", "Pack", ">", "packs", ")", "{", "try", "{", "beforePacks", "(", "installData", ",", "packs", ".", "size", "(", ")", ",", "handler", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "beforePack", "(", "Pack", "pack", ",", "int", "index", ")", "{", "try", "{", "beforePack", "(", "pack", ",", "index", ",", "handler", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "afterPack", "(", "Pack", "pack", ",", "int", "index", ")", "{", "try", "{", "afterPack", "(", "pack", ",", "index", ",", "handler", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "afterPacks", "(", "List", "<", "Pack", ">", "packs", ",", "ProgressListener", "listener", ")", "{", "try", "{", "afterPacks", "(", "installData", ",", "handler", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "beforeDir", "(", "File", "dir", ",", "PackFile", "packFile", ",", "Pack", "pack", ")", "{", "try", "{", "beforeDir", "(", "dir", ",", "packFile", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "afterDir", "(", "File", "dir", ",", "PackFile", "packFile", ",", "Pack", "pack", ")", "{", "try", "{", "afterDir", "(", "dir", ",", "packFile", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "beforeFile", "(", "File", "file", ",", "PackFile", "packFile", ",", "Pack", "pack", ")", "{", "try", "{", "beforeFile", "(", "file", ",", "packFile", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "@", "Override", "public", "void", "afterFile", "(", "File", "file", ",", "PackFile", "packFile", ",", "Pack", "pack", ")", "{", "try", "{", "afterFile", "(", "file", ",", "packFile", ")", ";", "}", "catch", "(", "IzPackException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "IzPackException", "(", "exception", ")", ";", "}", "}", "public", "void", "afterFile", "(", "File", "file", ",", "PackFile", "pf", ")", "throws", "Exception", "{", "}", "public", "void", "afterDir", "(", "File", "dir", ",", "PackFile", "pf", ")", "throws", "Exception", "{", "}", "public", "void", "afterPacks", "(", "AutomatedInstallData", "idata", ",", "AbstractUIProgressHandler", "handler", ")", "throws", "Exception", "{", "}", "public", "void", "afterPack", "(", "Pack", "pack", ",", "Integer", "i", ",", "AbstractUIProgressHandler", "handler", ")", "throws", "Exception", "{", "}", "public", "void", "beforePacks", "(", "AutomatedInstallData", "idata", ",", "Integer", "npacks", ",", "AbstractUIProgressHandler", "handler", ")", "throws", "Exception", "{", "}", "public", "void", "beforePack", "(", "Pack", "pack", ",", "Integer", "i", ",", "AbstractUIProgressHandler", "handler", ")", "throws", "Exception", "{", "}", "public", "boolean", "isFileListener", "(", ")", "{", "return", "false", ";", "}", "public", "void", "beforeFile", "(", "File", "file", ",", "PackFile", "pf", ")", "throws", "Exception", "{", "}", "public", "void", "beforeDir", "(", "File", "dir", ",", "PackFile", "pf", ")", "throws", "Exception", "{", "}", "public", "void", "afterInstallerInitialization", "(", "AutomatedInstallData", "data", ")", "throws", "Exception", "{", "}", "public", "SpecHelper", "getSpecHelper", "(", ")", "{", "return", "specHelper", ";", "}", "public", "void", "setSpecHelper", "(", "SpecHelper", "helper", ")", "{", "specHelper", "=", "helper", ";", "}", "public", "AutomatedInstallData", "getInstalldata", "(", ")", "{", "return", "installData", ";", "}", "public", "void", "setInstalldata", "(", "AutomatedInstallData", "data", ")", "{", "installData", "=", "data", ";", "messages", "=", "installData", ".", "getMessages", "(", ")", ";", "}", "protected", "ProgressNotifiers", "getNotifiers", "(", ")", "{", "return", "notifiers", ";", "}", "protected", "int", "getProgressBarCallerId", "(", ")", "{", "return", "notifiers", "!=", "null", "?", "notifiers", ".", "indexOf", "(", "this", ")", "+", "1", ":", "0", ";", "}", "protected", "void", "setProgressBarCaller", "(", ")", "{", "if", "(", "notifiers", "!=", "null", ")", "{", "notifiers", ".", "addNotifier", "(", "this", ")", ";", "}", "}", "protected", "boolean", "informProgressBar", "(", ")", "{", "return", "notifiers", "!=", "null", "&&", "notifiers", ".", "notifyProgress", "(", ")", ";", "}", "protected", "String", "getMsg", "(", "String", "id", ")", "{", "return", "(", "messages", "!=", "null", ")", "?", "messages", ".", "get", "(", "id", ")", ":", "id", ";", "}", "protected", "Resources", "getResources", "(", ")", "{", "return", "resources", ";", "}", "}", "</s>" ]
10,632
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "xml", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "public", "class", "XMLHelper", "{", "public", "final", "static", "String", "YES", "=", "\"YES\"", ";", "public", "final", "static", "String", "NO", "=", "\"NO\"", ";", "public", "final", "static", "String", "TRUE", "=", "\"TRUE\"", ";", "public", "final", "static", "String", "FALSE", "=", "\"FALSE\"", ";", "public", "final", "static", "String", "ON", "=", "\"ON\"", ";", "public", "final", "static", "String", "OFF", "=", "\"OFF\"", ";", "public", "final", "static", "String", "_1", "=", "\"1\"", ";", "public", "final", "static", "String", "_0", "=", "\"0\"", ";", "public", "XMLHelper", "(", ")", "{", "super", "(", ")", ";", "}", "public", "static", "boolean", "attributeIsTrue", "(", "IXMLElement", "element", ",", "String", "name", ")", "{", "String", "value", "=", "element", ".", "getAttribute", "(", "name", ",", "\"\"", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "value", ".", "equals", "(", "YES", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "TRUE", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "ON", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "_1", ")", ")", "{", "return", "(", "true", ")", ";", "}", "return", "(", "false", ")", ";", "}", "public", "static", "boolean", "attributeIsFalse", "(", "IXMLElement", "element", ",", "String", "name", ")", "{", "String", "value", "=", "element", ".", "getAttribute", "(", "name", ",", "\"\"", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "value", ".", "equals", "(", "\"NO\"", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "\"FALSE\"", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "\"OFF\"", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "\"0\"", ")", ")", "{", "return", "(", "true", ")", ";", "}", "return", "(", "false", ")", ";", "}", "}", "</s>" ]
10,633
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ";", "import", "javax", ".", "swing", ".", "event", ".", "HyperlinkEvent", ";", "import", "javax", ".", "swing", ".", "event", ".", "HyperlinkListener", ";", "public", "class", "HyperlinkHandler", "implements", "HyperlinkListener", "{", "public", "void", "hyperlinkUpdate", "(", "HyperlinkEvent", "e", ")", "{", "try", "{", "if", "(", "e", ".", "getEventType", "(", ")", "==", "HyperlinkEvent", ".", "EventType", ".", "ACTIVATED", ")", "{", "String", "urls", "=", "e", ".", "getURL", "(", ")", ".", "toExternalForm", "(", ")", ";", "if", "(", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "OsVersion", ".", "IS_OSX", ")", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"open", "\"", "+", "urls", ")", ";", "}", "else", "if", "(", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "OsVersion", ".", "IS_UNIX", ")", "{", "String", "[", "]", "launchers", "=", "{", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"opera", "QqzURL\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", "}", ";", "for", "(", "String", "launcher", ":", "launchers", ")", "{", "try", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "launcher", ".", "replaceAll", "(", "\"QqzURL\"", ",", "urls", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"OK\"", ")", ";", "break", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "System", ".", "out", ".", "println", "(", "launcher", "+", "\"", "NOT", "OK\"", ")", ";", "}", "}", "}", "else", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "\"\"", "+", "urls", ")", ";", "}", "}", "}", "catch", "(", "Exception", "err", ")", "{", "err", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "</s>" ]
10,634
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "NativeLibraryClient", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "WinSetupAPIBase", "implements", "NativeLibraryClient", "{", "protected", "static", "final", "int", "INVALID_HANDLE_VALUE", "=", "-", "1", ";", "public", "static", "final", "int", "SP_COPY_DELETESOURCE", "=", "0x0000001", ";", "public", "static", "final", "int", "SP_COPY_REPLACEONLY", "=", "0x0000002", ";", "public", "static", "final", "int", "SP_COPY_NEWER", "=", "0x0000004", ";", "public", "static", "final", "int", "SP_COPY_NEWER_OR_SAME", "=", "SP_COPY_NEWER", ";", "public", "static", "final", "int", "SP_COPY_NOOVERWRITE", "=", "0x0000008", ";", "public", "static", "final", "int", "SP_COPY_NODECOMP", "=", "0x0000010", ";", "public", "static", "final", "int", "SP_COPY_LANGUAGEAWARE", "=", "0x0000020", ";", "public", "static", "final", "int", "SP_COPY_SOURCE_ABSOLUTE", "=", "0x0000040", ";", "public", "static", "final", "int", "SP_COPY_SOURCEPATH_ABSOLUTE", "=", "0x0000080", ";", "public", "static", "final", "int", "SP_COPY_IN_USE_NEEDS_REBOOT", "=", "0x0000100", ";", "public", "static", "final", "int", "SP_COPY_FORCE_IN_USE", "=", "0x0000200", ";", "public", "static", "final", "int", "SP_COPY_NOSKIP", "=", "0x0000400", ";", "public", "static", "final", "int", "SP_FLAG_CABINETCONTINUATION", "=", "0x0000800", ";", "public", "static", "final", "int", "SP_COPY_FORCE_NOOVERWRITE", "=", "0x0001000", ";", "public", "static", "final", "int", "SP_COPY_FORCE_NEWER", "=", "0x0002000", ";", "public", "static", "final", "int", "SP_COPY_WARNIFSKIP", "=", "0x0004000", ";", "public", "static", "final", "int", "SP_COPY_NOBROWSE", "=", "0x0008000", ";", "public", "static", "final", "int", "SP_COPY_NEWER_ONLY", "=", "0x0010000", ";", "public", "static", "final", "int", "SP_COPY_SOURCE_SIS_MASTER", "=", "0x0020000", ";", "public", "static", "final", "int", "SP_COPY_OEMINF_CATALOG_ONLY", "=", "0x0040000", ";", "public", "static", "final", "int", "SP_COPY_REPLACE_BOOT_FILE", "=", "0x0080000", ";", "public", "static", "final", "int", "SP_COPY_NOPRUNE", "=", "0x0100000", ";", "public", "static", "final", "int", "SPFILEQ_FILE_IN_USE", "=", "0x00000001", ";", "public", "static", "final", "int", "SPFILEQ_REBOOT_RECOMMENDED", "=", "0x00000002", ";", "public", "static", "final", "int", "SPFILEQ_REBOOT_IN_PROGRESS", "=", "0x00000004", ";", "public", "WinSetupAPIBase", "(", "Librarian", "librarian", ")", "{", "try", "{", "librarian", ".", "loadLibrary", "(", "\"WinSetupAPI\"", ",", "this", ")", ";", "}", "catch", "(", "UnsatisfiedLinkError", "error", ")", "{", "throw", "new", "IzPackException", "(", "\"\"", ",", "error", ")", ";", "}", "}", "public", "void", "freeLibrary", "(", "String", "name", ")", "{", "}", ";", "protected", "native", "int", "SetupOpenFileQueue", "(", "Object", "handler", ")", "throws", "IOException", ";", "protected", "native", "void", "SetupCloseFileQueue", "(", "int", "queuehandle", ")", ";", "protected", "native", "void", "SetupQueueCopy", "(", "int", "queuehandle", ",", "String", "SourceRootPath", ",", "String", "SourcePath", ",", "String", "SourceFileName", ",", "String", "SourceDescription", ",", "String", "SourceTagFile", ",", "String", "TargetDirectory", ",", "String", "TargetFileName", ",", "int", "CopyStyle", ")", "throws", "IOException", ";", "protected", "native", "void", "SetupQueueDelete", "(", "int", "queuehandle", ",", "String", "PathPart1", ",", "String", "PathPart2", ")", "throws", "IOException", ";", "protected", "native", "void", "SetupQueueRename", "(", "int", "queuehandle", ",", "String", "SourcePath", ",", "String", "SourceFileName", ",", "String", "TargetPath", ",", "String", "TargetFileName", ")", "throws", "IOException", ";", "protected", "native", "boolean", "SetupCommitFileQueue", "(", "int", "queuehandle", ")", "throws", "IOException", ";", "protected", "native", "int", "SetupPromptReboot", "(", "int", "queuehandle", ",", "boolean", "scanonly", ")", "throws", "IOException", ";", "}", "</s>" ]
10,635
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "FileQueueCopy", "implements", "FileQueueOperation", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileQueueCopy", ".", "class", ".", "getName", "(", ")", ")", ";", "protected", "File", "fromFile", "=", "null", ";", "protected", "File", "toFile", "=", "null", ";", "protected", "int", "copyStyle", "=", "WinSetupAPIBase", ".", "SP_COPY_NOOVERWRITE", ";", "public", "FileQueueCopy", "(", "File", "fromFile", ",", "File", "toFile", ")", "{", "this", "(", "fromFile", ",", "toFile", ",", "false", ",", "false", ")", ";", "}", "public", "FileQueueCopy", "(", "File", "fromFile", ",", "File", "toFile", ",", "boolean", "deleteSource", ",", "boolean", "forceInUse", ")", "{", "this", ".", "fromFile", "=", "fromFile", ";", "this", ".", "toFile", "=", "toFile", ";", "setDeleteSource", "(", "deleteSource", ")", ";", "setForceInUse", "(", "forceInUse", ")", ";", "}", "public", "void", "setDeleteSource", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_DELETESOURCE", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_DELETESOURCE", ")", ";", "}", "}", "public", "void", "setForceInUse", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_FORCE_IN_USE", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_FORCE_IN_USE", ")", ";", "}", "}", "public", "void", "setInUseNeedsReboot", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_IN_USE_NEEDS_REBOOT", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_IN_USE_NEEDS_REBOOT", ")", ";", "}", "}", "public", "void", "setLanguageAware", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_LANGUAGEAWARE", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_LANGUAGEAWARE", ")", ";", "}", "}", "public", "void", "setNewerOrSame", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_NEWER_OR_SAME", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_NEWER_OR_SAME", ")", ";", "}", "}", "public", "void", "setNewerOnly", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "&=", "WinSetupAPIBase", ".", "SP_COPY_NEWER_ONLY", ";", "}", "}", "public", "void", "setReplaceOnly", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_REPLACEONLY", ";", "}", "else", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_REPLACEONLY", ")", ";", "}", "}", "public", "void", "setOverwrite", "(", "boolean", "flag", ")", "{", "if", "(", "flag", ")", "{", "this", ".", "copyStyle", "&=", "(", "~", "WinSetupAPIBase", ".", "SP_COPY_NOOVERWRITE", ")", ";", "}", "else", "{", "this", ".", "copyStyle", "|=", "WinSetupAPIBase", ".", "SP_COPY_NOOVERWRITE", ";", "}", "}", "public", "void", "addTo", "(", "WinSetupFileQueue", "filequeue", ")", "throws", "IOException", "{", "if", "(", "fromFile", ".", "equals", "(", "toFile", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "fromFile", ")", ";", "}", "else", "{", "try", "{", "logger", ".", "fine", "(", "\"\"", "+", "fromFile", "+", "\"", "to", "\"", "+", "toFile", "+", "\"", "(0x\"", "+", "Integer", ".", "toHexString", "(", "copyStyle", ")", "+", "\")\"", ")", ";", "filequeue", ".", "addCopy", "(", "fromFile", ",", "toFile", ",", "copyStyle", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "String", "msg", "=", "\"\"", "+", "fromFile", "+", "\"", "to", "\"", "+", "toFile", "+", "\"", "due", "to", "\"", "+", "ioe", ".", "getMessage", "(", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "}", "}", "}", "</s>" ]
10,636
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "StringTool", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "Win_Shortcut", "extends", "Shortcut", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "Win_Shortcut", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "ShellLink", "shortcut", ";", "private", "final", "Librarian", "librarian", ";", "public", "Win_Shortcut", "(", "Librarian", "librarian", ")", "{", "this", ".", "librarian", "=", "librarian", ";", "}", "@", "Override", "public", "void", "initialize", "(", "int", "type", ",", "String", "name", ")", "throws", "Exception", "{", "switch", "(", "type", ")", "{", "case", "APPLICATIONS", ":", "{", "shortcut", "=", "new", "ShellLink", "(", "ShellLink", ".", "PROGRAM_MENU", ",", "name", ",", "librarian", ")", ";", "break", ";", "}", "case", "START_MENU", ":", "{", "shortcut", "=", "new", "ShellLink", "(", "ShellLink", ".", "START_MENU", ",", "name", ",", "librarian", ")", ";", "break", ";", "}", "case", "DESKTOP", ":", "{", "shortcut", "=", "new", "ShellLink", "(", "ShellLink", ".", "DESKTOP", ",", "name", ",", "librarian", ")", ";", "break", ";", "}", "case", "START_UP", ":", "{", "shortcut", "=", "new", "ShellLink", "(", "ShellLink", ".", "STARTUP", ",", "name", ",", "librarian", ")", ";", "break", ";", "}", "default", ":", "{", "shortcut", "=", "new", "ShellLink", "(", "ShellLink", ".", "PROGRAM_MENU", ",", "name", ",", "librarian", ")", ";", "break", ";", "}", "}", "}", "@", "Override", "public", "String", "getBasePath", "(", ")", "throws", "Exception", "{", "String", "result", "=", "shortcut", ".", "getLinkPath", "(", "shortcut", ".", "getUserType", "(", ")", ")", ";", "return", "result", ";", "}", "@", "Override", "public", "List", "<", "String", ">", "getProgramGroups", "(", "int", "userType", ")", "{", "int", "type", "=", "ShellLink", ".", "CURRENT_USER", ";", "if", "(", "userType", "==", "ALL_USERS", ")", "{", "type", "=", "ShellLink", ".", "ALL_USERS", ";", "}", "else", "{", "type", "=", "ShellLink", ".", "CURRENT_USER", ";", "}", "String", "linkPath", "=", "shortcut", ".", "getLinkPath", "(", "type", ")", ";", "if", "(", "linkPath", "==", "null", ")", "{", "return", "(", "new", "ArrayList", "<", "String", ">", "(", ")", ")", ";", "}", "File", "path", "=", "new", "File", "(", "linkPath", ")", ";", "File", "[", "]", "file", "=", "path", ".", "listFiles", "(", ")", ";", "List", "<", "String", ">", "groups", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "for", "(", "File", "aFile", ":", "file", ")", "{", "String", "aFilename", "=", "aFile", ".", "getName", "(", ")", ";", "if", "(", "aFile", ".", "isDirectory", "(", ")", ")", "{", "groups", ".", "add", "(", "aFilename", ")", ";", "}", "}", "}", "return", "groups", ";", "}", "@", "Override", "public", "String", "getFileName", "(", ")", "{", "String", "aFilename", "=", "shortcut", ".", "getFileName", "(", ")", ";", "return", "aFilename", ";", "}", "@", "Override", "public", "String", "getDirectoryCreated", "(", ")", "{", "String", "directoryCreated", "=", "shortcut", ".", "getDirectoryCreated", "(", ")", ";", "return", "(", "directoryCreated", ")", ";", "}", "@", "Override", "public", "boolean", "multipleUsers", "(", ")", "{", "boolean", "result", "=", "false", ";", "String", "allUsers", "=", "shortcut", ".", "getallUsersLinkPath", "(", ")", ";", "String", "currentUsers", "=", "shortcut", ".", "getcurrentUserLinkPath", "(", ")", ";", "if", "(", "allUsers", "==", "null", "||", "currentUsers", "==", "null", ")", "{", "result", "=", "false", ";", "}", "else", "{", "result", "=", "allUsers", ".", "length", "(", ")", ">", "0", "&&", "currentUsers", ".", "length", "(", ")", ">", "0", ";", "}", "return", "result", ";", "}", "@", "Override", "public", "boolean", "supported", "(", ")", "{", "return", "true", ";", "}", "@", "Override", "public", "void", "setArguments", "(", "String", "arguments", ")", "{", "shortcut", ".", "setArguments", "(", "arguments", ")", ";", "}", "@", "Override", "public", "void", "setDescription", "(", "String", "description", ")", "{", "shortcut", ".", "setDescription", "(", "description", ")", ";", "}", "@", "Override", "public", "void", "setIconLocation", "(", "String", "path", ",", "int", "index", ")", "{", "shortcut", ".", "setIconLocation", "(", "path", ",", "index", ")", ";", "}", "@", "Override", "public", "String", "getIconLocation", "(", ")", "{", "return", "shortcut", ".", "getIconLocation", "(", ")", ";", "}", "@", "Override", "public", "void", "setProgramGroup", "(", "String", "groupName", ")", "{", "shortcut", ".", "setProgramGroup", "(", "groupName", ")", ";", "}", "@", "Override", "public", "void", "setShowCommand", "(", "int", "show", ")", "throws", "IllegalArgumentException", "{", "switch", "(", "show", ")", "{", "case", "HIDE", ":", "{", "shortcut", ".", "setShowCommand", "(", "ShellLink", ".", "MINNOACTIVE", ")", ";", "break", ";", "}", "case", "NORMAL", ":", "{", "shortcut", ".", "setShowCommand", "(", "ShellLink", ".", "NORMAL", ")", ";", "break", ";", "}", "case", "MINIMIZED", ":", "{", "shortcut", ".", "setShowCommand", "(", "ShellLink", ".", "MINNOACTIVE", ")", ";", "break", ";", "}", "case", "MAXIMIZED", ":", "{", "shortcut", ".", "setShowCommand", "(", "ShellLink", ".", "MAXIMIZED", ")", ";", "break", ";", "}", "default", ":", "{", "throw", "(", "new", "IllegalArgumentException", "(", "show", "+", "\"\"", ")", ")", ";", "}", "}", "}", "@", "Override", "public", "int", "getShowCommand", "(", ")", "{", "int", "showCommand", "=", "shortcut", ".", "getShowCommand", "(", ")", ";", "switch", "(", "showCommand", ")", "{", "case", "ShellLink", ".", "NORMAL", ":", "showCommand", "=", "NORMAL", ";", "break", ";", "case", "ShellLink", ".", "MINNOACTIVE", ":", "case", "ShellLink", ".", "MINIMIZED", ":", "showCommand", "=", "MINIMIZED", ";", "break", ";", "case", "ShellLink", ".", "MAXIMIZED", ":", "showCommand", "=", "MAXIMIZED", ";", "break", ";", "default", ":", "break", ";", "}", "return", "showCommand", ";", "}", "@", "Override", "public", "void", "setTargetPath", "(", "String", "path", ")", "{", "shortcut", ".", "setTargetPath", "(", "path", ")", ";", "}", "@", "Override", "public", "void", "setWorkingDirectory", "(", "String", "dir", ")", "{", "shortcut", ".", "setWorkingDirectory", "(", "dir", ")", ";", "}", "@", "Override", "public", "String", "getWorkingDirectory", "(", ")", "{", "String", "result", "=", "shortcut", ".", "getWorkingDirectory", "(", ")", ";", "return", "result", ";", "}", "@", "Override", "public", "void", "setLinkName", "(", "String", "name", ")", "{", "shortcut", ".", "setLinkName", "(", "name", ")", ";", "}", "@", "Override", "public", "int", "getLinkType", "(", ")", "{", "int", "typ", "=", "shortcut", ".", "getLinkType", "(", ")", ";", "switch", "(", "typ", ")", "{", "case", "ShellLink", ".", "DESKTOP", ":", "typ", "=", "DESKTOP", ";", "break", ";", "case", "ShellLink", ".", "PROGRAM_MENU", ":", "typ", "=", "APPLICATIONS", ";", "break", ";", "case", "ShellLink", ".", "START_MENU", ":", "typ", "=", "START_MENU", ";", "break", ";", "case", "ShellLink", ".", "STARTUP", ":", "typ", "=", "START_UP", ";", "break", ";", "default", ":", "break", ";", "}", "return", "typ", ";", "}", "@", "Override", "public", "void", "setLinkType", "(", "int", "type", ")", "throws", "IllegalArgumentException", ",", "UnsupportedEncodingException", "{", "switch", "(", "type", ")", "{", "case", "DESKTOP", ":", "{", "shortcut", ".", "setLinkType", "(", "ShellLink", ".", "DESKTOP", ")", ";", "break", ";", "}", "case", "APPLICATIONS", ":", "{", "shortcut", ".", "setLinkType", "(", "ShellLink", ".", "PROGRAM_MENU", ")", ";", "break", ";", "}", "case", "START_MENU", ":", "{", "shortcut", ".", "setLinkType", "(", "ShellLink", ".", "START_MENU", ")", ";", "break", ";", "}", "case", "START_UP", ":", "{", "shortcut", ".", "setLinkType", "(", "ShellLink", ".", "STARTUP", ")", ";", "break", ";", "}", "default", ":", "{", "throw", "(", "new", "IllegalArgumentException", "(", "type", "+", "\"\"", ")", ")", ";", "}", "}", "}", "@", "Override", "public", "int", "getUserType", "(", ")", "{", "int", "utype", "=", "shortcut", ".", "getUserType", "(", ")", ";", "switch", "(", "utype", ")", "{", "case", "ShellLink", ".", "ALL_USERS", ":", "utype", "=", "ALL_USERS", ";", "break", ";", "case", "ShellLink", ".", "CURRENT_USER", ":", "utype", "=", "CURRENT_USER", ";", "break", ";", "}", "return", "utype", ";", "}", "@", "Override", "public", "void", "setUserType", "(", "int", "type", ")", "{", "if", "(", "type", "==", "CURRENT_USER", ")", "{", "if", "(", "shortcut", ".", "getcurrentUserLinkPath", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "shortcut", ".", "setUserType", "(", "ShellLink", ".", "CURRENT_USER", ")", ";", "}", "}", "else", "if", "(", "type", "==", "ALL_USERS", ")", "{", "if", "(", "shortcut", ".", "getallUsersLinkPath", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "shortcut", ".", "setUserType", "(", "ShellLink", ".", "ALL_USERS", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "save", "(", ")", "throws", "Exception", "{", "shortcut", ".", "save", "(", ")", ";", "}", "@", "Override", "public", "int", "getHotkey", "(", ")", "{", "int", "result", "=", "shortcut", ".", "getHotkey", "(", ")", ";", "return", "result", ";", "}", "@", "Override", "public", "void", "setHotkey", "(", "int", "hotkey", ")", "{", "shortcut", ".", "setHotkey", "(", "hotkey", ")", ";", "}", "@", "Override", "public", "String", "getProgramsFolder", "(", "int", "current_user", ")", "{", "int", "USER", "=", "0", ";", "if", "(", "current_user", "==", "Shortcut", ".", "CURRENT_USER", ")", "{", "USER", "=", "ShellLink", ".", "CURRENT_USER", ";", "}", "else", "if", "(", "current_user", "==", "Shortcut", ".", "ALL_USERS", ")", "{", "USER", "=", "ShellLink", ".", "ALL_USERS", ";", "}", "String", "result", "=", "null", ";", "try", "{", "result", "=", "new", "String", "(", "shortcut", ".", "getLinkPath", "(", "USER", ")", ".", "getBytes", "(", "StringTool", ".", "getPlatformEncoding", "(", ")", ")", ",", "StringTool", ".", "getPlatformEncoding", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,637
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "BufferedWriter", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ResourceNotFoundException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "FileExecutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "StringTool", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "unix", ".", "ShellScript", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "unix", ".", "UnixHelper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "unix", ".", "UnixUser", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "unix", ".", "UnixUsers", ";", "public", "class", "Unix_Shortcut", "extends", "Shortcut", "implements", "Unix_ShortcutConstants", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "Unix_Shortcut", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "static", "String", "version", "=", "\"$Id$\"", ";", "private", "static", "String", "rev", "=", "\"$Revision$\"", ";", "private", "static", "String", "DESKTOP_EXT", "=", "\".desktop\"", ";", "private", "static", "String", "template", "=", "\"\"", ";", "private", "final", "static", "String", "N", "=", "\"n\"", ";", "private", "final", "static", "String", "H", "=", "\"#\"", ";", "private", "final", "static", "String", "S", "=", "\"", "\"", ";", "private", "final", "static", "String", "C", "=", "H", "+", "S", ";", "private", "final", "static", "String", "QM", "=", "\"\\\"\"", ";", "private", "int", "ShortcutType", ";", "private", "static", "ShellScript", "rootScript", "=", "null", ";", "private", "static", "ShellScript", "uninstallScript", "=", "null", ";", "private", "List", "<", "UnixUser", ">", "users", ";", "private", "String", "createdDirectory", ";", "private", "int", "itsUserType", ";", "private", "String", "itsGroupName", ";", "private", "String", "itsName", ";", "private", "String", "itsFileName", ";", "private", "Properties", "props", ";", "public", "StringBuffer", "hlp", ";", "public", "ShellScript", "myInstallScript", ";", "public", "final", "String", "FS", "=", "File", ".", "separator", ";", "public", "final", "String", "myHome", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "private", "String", "su", ";", "private", "String", "xdgDesktopIconCmd", ";", "private", "String", "myXdgDesktopIconScript", ";", "private", "String", "myXdgDesktopIconCmd", ";", "private", "final", "Resources", "resources", ";", "private", "final", "InstallData", "installData", ";", "public", "Unix_Shortcut", "(", "Resources", "resources", ",", "InstallData", "installData", ")", "{", "this", ".", "resources", "=", "resources", ";", "this", ".", "installData", "=", "installData", ";", "hlp", "=", "new", "StringBuffer", "(", ")", ";", "String", "userLanguage", "=", "System", ".", "getProperty", "(", "\"\"", ",", "\"en\"", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Categories=\"", "+", "$Categories", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Comment=\"", "+", "$Comment", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Comment[\"", ")", ".", "append", "(", "userLanguage", ")", ".", "append", "(", "\"]=\"", "+", "$Comment", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Encoding=\"", "+", "$Encoding", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Exec=\"", "+", "$E_QUOT", "+", "$Exec", "+", "$E_QUOT", "+", "S", "+", "$Arguments", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"GenericName=\"", "+", "$GenericName", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"GenericName[\"", ")", ".", "append", "(", "userLanguage", ")", ".", "append", "(", "\"]=\"", "+", "$GenericName", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Icon=\"", "+", "$Icon", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"MimeType=\"", "+", "$MimeType", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Name=\"", "+", "$Name", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Name[\"", ")", ".", "append", "(", "userLanguage", ")", ".", "append", "(", "\"]=\"", "+", "$Name", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Path=\"", "+", "$P_QUOT", "+", "$Path", "+", "$P_QUOT", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "$ServiceTypes", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"SwallowExec=\"", "+", "$SwallowExec", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "$SwallowTitle", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Terminal=\"", "+", "$Terminal", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "$Options_For_Terminal", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"Type=\"", "+", "$Type", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"URL=\"", "+", "$URL", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "$X_KDE_SubstituteUID", "+", "N", ")", ";", "hlp", ".", "append", "(", "\"\"", "+", "$X_KDE_Username", "+", "N", ")", ";", "hlp", ".", "append", "(", "N", ")", ";", "hlp", ".", "append", "(", "C", "+", "\"created", "by\"", "+", "S", ")", ".", "append", "(", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "S", ")", ".", "append", "(", "rev", ")", ".", "append", "(", "N", ")", ";", "hlp", ".", "append", "(", "C", ")", ".", "append", "(", "version", ")", ";", "template", "=", "hlp", ".", "toString", "(", ")", ";", "props", "=", "new", "Properties", "(", ")", ";", "initProps", "(", ")", ";", "if", "(", "rootScript", "==", "null", ")", "{", "rootScript", "=", "new", "ShellScript", "(", ")", ";", "}", "if", "(", "uninstallScript", "==", "null", ")", "{", "uninstallScript", "=", "new", "ShellScript", "(", ")", ";", "}", "if", "(", "myInstallScript", "==", "null", ")", "{", "myInstallScript", "=", "new", "ShellScript", "(", ")", ";", "}", "}", "private", "void", "initProps", "(", ")", "{", "String", "[", "]", "propsArray", "=", "{", "$Comment", ",", "$$LANG_Comment", ",", "$Encoding", ",", "$Exec", ",", "$Arguments", ",", "$GenericName", ",", "$$LANG_GenericName", ",", "$MimeType", ",", "$Name", ",", "$$LANG_Name", ",", "$Path", ",", "$ServiceTypes", ",", "$SwallowExec", ",", "$SwallowTitle", ",", "$Terminal", ",", "$Options_For_Terminal", ",", "$Type", ",", "$X_KDE_SubstituteUID", ",", "$X_KDE_Username", ",", "$Icon", ",", "$URL", ",", "$E_QUOT", ",", "$P_QUOT", ",", "$Categories", ",", "$TryExec", "}", ";", "for", "(", "String", "aPropsArray", ":", "propsArray", ")", "{", "props", ".", "put", "(", "aPropsArray", ",", "\"\"", ")", ";", "}", "}", "@", "Override", "public", "void", "initialize", "(", "int", "aType", ",", "String", "aName", ")", "throws", "Exception", "{", "this", ".", "itsName", "=", "aName", ";", "props", ".", "put", "(", "$Name", ",", "aName", ")", ";", "}", "@", "Override", "public", "boolean", "supported", "(", ")", "{", "return", "true", ";", "}", "@", "Override", "public", "String", "getDirectoryCreated", "(", ")", "{", "return", "this", ".", "createdDirectory", ";", "}", "@", "Override", "public", "String", "getFileName", "(", ")", "{", "return", "(", "this", ".", "itsFileName", ")", ";", "}", "@", "Override", "public", "List", "<", "String", ">", "getProgramGroups", "(", "int", "userType", ")", "{", "List", "<", "String", ">", "groups", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "File", "kdeShareApplnk", "=", "getKdeShareApplnkFolder", "(", "userType", ")", ";", "try", "{", "File", "[", "]", "listing", "=", "kdeShareApplnk", ".", "listFiles", "(", ")", ";", "for", "(", "File", "aListing", ":", "listing", ")", "{", "if", "(", "aListing", ".", "isDirectory", "(", ")", ")", "{", "groups", ".", "add", "(", "aListing", ".", "getName", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "return", "(", "groups", ")", ";", "}", "@", "Override", "public", "String", "getProgramsFolder", "(", "int", "current_user", ")", "{", "String", "result", "=", "\"\"", ";", "result", "=", "getKdeShareApplnkFolder", "(", "current_user", ")", ".", "toString", "(", ")", ";", "return", "result", ";", "}", "private", "File", "getKdeShareApplnkFolder", "(", "int", "userType", ")", "{", "if", "(", "userType", "==", "Shortcut", ".", "ALL_USERS", ")", "{", "return", "new", "File", "(", "File", ".", "separator", "+", "\"usr\"", "+", "File", ".", "separator", "+", "\"share\"", "+", "File", ".", "separator", "+", "\"applications\"", ")", ";", "}", "else", "{", "return", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", "File", ".", "separator", "+", "\".local\"", "+", "File", ".", "separator", "+", "\"share\"", "+", "File", ".", "separator", "+", "\"applications\"", ")", ";", "}", "}", "@", "Override", "public", "boolean", "multipleUsers", "(", ")", "{", "return", "(", "true", ")", ";", "}", "@", "Override", "public", "void", "save", "(", ")", "throws", "Exception", "{", "String", "target", "=", "null", ";", "String", "shortCutDef", "=", "this", ".", "replace", "(", ")", ";", "boolean", "rootUser4All", "=", "this", ".", "getUserType", "(", ")", "==", "Shortcut", ".", "ALL_USERS", ";", "boolean", "create4All", "=", "this", ".", "getCreateForAll", "(", ")", ";", "if", "(", "\"\"", ".", "equals", "(", "this", ".", "itsGroupName", ")", "&&", "(", "this", ".", "getLinkType", "(", ")", "==", "Shortcut", ".", "DESKTOP", ")", ")", "{", "this", ".", "itsFileName", "=", "target", ";", "File", "shortCutLocation", "=", "null", ";", "File", "ApplicationShortcutPath", ";", "String", "ApplicationShortcutPathName", "=", "installData", ".", "getVariable", "(", "\"\"", ")", ";", "if", "(", "null", "!=", "ApplicationShortcutPathName", "&&", "!", "ApplicationShortcutPathName", ".", "equals", "(", "\"\"", ")", ")", "{", "ApplicationShortcutPath", "=", "new", "File", "(", "ApplicationShortcutPathName", ")", ";", "if", "(", "ApplicationShortcutPath", ".", "isAbsolute", "(", ")", ")", "{", "if", "(", "!", "ApplicationShortcutPath", ".", "exists", "(", ")", "&&", "ApplicationShortcutPath", ".", "mkdirs", "(", ")", "&&", "ApplicationShortcutPath", ".", "canWrite", "(", ")", ")", "{", "shortCutLocation", "=", "ApplicationShortcutPath", ";", "}", "if", "(", "ApplicationShortcutPath", ".", "exists", "(", ")", "&&", "ApplicationShortcutPath", ".", "isDirectory", "(", ")", "&&", "ApplicationShortcutPath", ".", "canWrite", "(", ")", ")", "{", "shortCutLocation", "=", "ApplicationShortcutPath", ";", "}", "}", "else", "{", "File", "relativePath", "=", "new", "File", "(", "installData", ".", "getInstallPath", "(", ")", "+", "FS", "+", "ApplicationShortcutPath", ")", ";", "relativePath", ".", "mkdirs", "(", ")", ";", "shortCutLocation", "=", "new", "File", "(", "relativePath", ".", "toString", "(", ")", ")", ";", "}", "}", "else", "{", "shortCutLocation", "=", "new", "File", "(", "installData", ".", "getInstallPath", "(", ")", ")", ";", "}", "File", "writtenDesktopFile", "=", "writeAppShortcutWithOutSpace", "(", "shortCutLocation", ".", "toString", "(", ")", ",", "this", ".", "itsName", ",", "shortCutDef", ")", ";", "uninstaller", ".", "addFile", "(", "writtenDesktopFile", ".", "toString", "(", ")", ",", "true", ")", ";", "String", "cmd", "=", "getXdgDesktopIconCmd", "(", ")", ";", "if", "(", "cmd", "!=", "null", ")", "{", "createExtXdgDesktopIconCmd", "(", "shortCutLocation", ")", ";", "myInstallScript", ".", "appendln", "(", "new", "String", "[", "]", "{", "myXdgDesktopIconCmd", ",", "\"install\"", ",", "\"--novendor\"", ",", "StringTool", ".", "escapeSpaces", "(", "writtenDesktopFile", ".", "toString", "(", ")", ")", "}", ")", ";", "ShellScript", "myUninstallScript", "=", "new", "ShellScript", "(", ")", ";", "myUninstallScript", ".", "appendln", "(", "new", "String", "[", "]", "{", "myXdgDesktopIconCmd", ",", "\"uninstall\"", ",", "\"--novendor\"", ",", "StringTool", ".", "escapeSpaces", "(", "writtenDesktopFile", ".", "toString", "(", ")", ")", "}", ")", ";", "uninstaller", ".", "addUninstallScript", "(", "myUninstallScript", ".", "getContentAsString", "(", ")", ")", ";", "}", "else", "{", "File", "myDesktopFile", ";", "do", "{", "myDesktopFile", "=", "new", "File", "(", "myHome", "+", "FS", "+", "\"Desktop\"", "+", "writtenDesktopFile", ".", "getName", "(", ")", "+", "\"-\"", "+", "System", ".", "currentTimeMillis", "(", ")", "+", "DESKTOP_EXT", ")", ";", "}", "while", "(", "myDesktopFile", ".", "exists", "(", ")", ")", ";", "copyTo", "(", "writtenDesktopFile", ",", "myDesktopFile", ")", ";", "uninstaller", ".", "addFile", "(", "myDesktopFile", ".", "toString", "(", ")", ",", "true", ")", ";", "}", "if", "(", "rootUser4All", "&&", "create4All", ")", "{", "if", "(", "cmd", "!=", "null", ")", "{", "installDesktopFileToAllUsersDesktop", "(", "writtenDesktopFile", ")", ";", "}", "else", "{", "copyDesktopFileToAllUsersDesktop", "(", "writtenDesktopFile", ")", ";", "}", "}", "}", "else", "{", "if", "(", "rootUser4All", "&&", "create4All", ")", "{", "{", "File", "theIcon", "=", "new", "File", "(", "this", ".", "getIconLocation", "(", ")", ")", ";", "File", "commonIcon", "=", "new", "File", "(", "\"\"", "+", "theIcon", ".", "getName", "(", ")", ")", ";", "try", "{", "copyTo", "(", "theIcon", ",", "commonIcon", ")", ";", "uninstaller", ".", "addFile", "(", "commonIcon", ".", "toString", "(", ")", ",", "true", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "theIcon", "+", "\"", "to", "\"", "+", "commonIcon", "+", "\"(", "\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"", ")\"", ",", "e", ")", ";", "}", "this", ".", "itsFileName", "=", "target", ";", "File", "writtenFile", "=", "writeAppShortcut", "(", "\"\"", ",", "this", ".", "itsName", ",", "shortCutDef", ")", ";", "setWrittenFileName", "(", "writtenFile", ".", "getName", "(", ")", ")", ";", "uninstaller", ".", "addFile", "(", "writtenFile", ".", "toString", "(", ")", ",", "true", ")", ";", "}", "}", "else", "{", "String", "localApps", "=", "myHome", "+", "\"\"", ";", "String", "localPixmaps", "=", "myHome", "+", "\"\"", ";", "try", "{", "java", ".", "io", ".", "File", "file", "=", "new", "java", ".", "io", ".", "File", "(", "localApps", ")", ";", "file", ".", "mkdirs", "(", ")", ";", "file", "=", "new", "java", ".", "io", ".", "File", "(", "localPixmaps", ")", ";", "file", ".", "mkdirs", "(", ")", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "localApps", "+", "\"", "or", "\"", "+", "localPixmaps", ")", ";", "}", "File", "theIcon", "=", "new", "File", "(", "this", ".", "getIconLocation", "(", ")", ")", ";", "File", "commonIcon", "=", "new", "File", "(", "localPixmaps", "+", "theIcon", ".", "getName", "(", ")", ")", ";", "try", "{", "copyTo", "(", "theIcon", ",", "commonIcon", ")", ";", "uninstaller", ".", "addFile", "(", "commonIcon", ".", "toString", "(", ")", ",", "true", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "theIcon", "+", "\"", "to", "\"", "+", "commonIcon", "+", "\"(", "\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"", ")\"", ",", "e", ")", ";", "}", "this", ".", "itsFileName", "=", "target", ";", "File", "writtenFile", "=", "writeAppShortcut", "(", "localApps", ",", "this", ".", "itsName", ",", "shortCutDef", ")", ";", "setWrittenFileName", "(", "writtenFile", ".", "getName", "(", ")", ")", ";", "uninstaller", ".", "addFile", "(", "writtenFile", ".", "toString", "(", ")", ",", "true", ")", ";", "}", "}", "}", "public", "void", "createExtXdgDesktopIconCmd", "(", "File", "shortCutLocation", ")", "throws", "IOException", ",", "ResourceNotFoundException", "{", "ShellScript", "myXdgDesktopIconScript", "=", "new", "ShellScript", "(", "null", ")", ";", "String", "lines", "=", "\"\"", ";", "lines", "=", "resources", ".", "getString", "(", "\"\"", ",", "null", ")", ";", "myXdgDesktopIconScript", ".", "append", "(", "lines", ")", ";", "myXdgDesktopIconCmd", "=", "new", "String", "(", "shortCutLocation", "+", "FS", "+", "\"\"", ")", ";", "myXdgDesktopIconScript", ".", "write", "(", "myXdgDesktopIconCmd", ")", ";", "FileExecutor", ".", "getExecOutput", "(", "new", "String", "[", "]", "{", "UnixHelper", ".", "getCustomCommand", "(", "\"chmod\"", ")", ",", "\"+x\"", ",", "myXdgDesktopIconCmd", "}", ",", "true", ")", ";", "}", "private", "void", "installDesktopFileToAllUsersDesktop", "(", "File", "writtenDesktopFile", ")", "{", "for", "(", "UnixUser", "user", ":", "getUsers", "(", ")", ")", "{", "if", "(", "user", ".", "getHome", "(", ")", ".", "equals", "(", "myHome", ")", ")", "{", "logger", ".", "info", "(", "\"\"", "+", "user", ".", "getHome", "(", ")", "+", "\"", "==", "\"", "+", "myHome", ")", ";", "continue", ";", "}", "try", "{", "rootScript", ".", "append", "(", "new", "String", "[", "]", "{", "getSuCommand", "(", ")", ",", "user", ".", "getName", "(", ")", ",", "\"-c\"", "}", ")", ";", "rootScript", ".", "appendln", "(", "new", "String", "[", "]", "{", "\"\\\"\"", "+", "myXdgDesktopIconCmd", ",", "\"install\"", ",", "\"--novendor\"", ",", "StringTool", ".", "escapeSpaces", "(", "writtenDesktopFile", ".", "toString", "(", ")", ")", "+", "\"\\\"\"", "}", ")", ";", "uninstallScript", ".", "append", "(", "new", "String", "[", "]", "{", "getSuCommand", "(", ")", ",", "user", ".", "getName", "(", ")", ",", "\"-c\"", "}", ")", ";", "uninstallScript", ".", "appendln", "(", "new", "String", "[", "]", "{", "\"\\\"\"", "+", "myXdgDesktopIconCmd", ",", "\"uninstall\"", ",", "\"--novendor\"", ",", "StringTool", ".", "escapeSpaces", "(", "writtenDesktopFile", ".", "toString", "(", ")", ")", "+", "\"\\\"\"", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "logger", ".", "fine", "(", "\"\"", ")", ";", "logger", ".", "fine", "(", "rootScript", ".", "getContentAsString", "(", ")", ")", ";", "}", "private", "String", "getSuCommand", "(", ")", "{", "if", "(", "su", "==", "null", ")", "{", "su", "=", "UnixHelper", ".", "getSuCommand", "(", ")", ";", "}", "return", "su", ";", "}", "private", "String", "getXdgDesktopIconCmd", "(", ")", "{", "if", "(", "xdgDesktopIconCmd", "==", "null", ")", "{", "xdgDesktopIconCmd", "=", "UnixHelper", ".", "getCustomCommand", "(", "\"\"", ")", ";", "}", "return", "xdgDesktopIconCmd", ";", "}", "private", "List", "<", "UnixUser", ">", "getUsers", "(", ")", "{", "if", "(", "users", "==", "null", ")", "{", "users", "=", "UnixUsers", ".", "getUsersWithValidShellsExistingHomesAndDesktops", "(", ")", ";", "}", "return", "users", ";", "}", "private", "void", "copyDesktopFileToAllUsersDesktop", "(", "File", "writtenDesktopFile", ")", "throws", "IOException", "{", "String", "chmod", "=", "UnixHelper", ".", "getCustomCommand", "(", "\"chmod\"", ")", ";", "String", "chown", "=", "UnixHelper", ".", "getCustomCommand", "(", "\"chown\"", ")", ";", "String", "rm", "=", "UnixHelper", ".", "getRmCommand", "(", ")", ";", "String", "copy", "=", "UnixHelper", ".", "getCpCommand", "(", ")", ";", "File", "dest", "=", "null", ";", "File", "tempFile", "=", "File", ".", "createTempFile", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "Long", ".", "toString", "(", "System", ".", "currentTimeMillis", "(", ")", ")", "+", "\".tmp\"", ")", ";", "copyTo", "(", "writtenDesktopFile", ",", "tempFile", ")", ";", "FileExecutor", ".", "getExecOutput", "(", "new", "String", "[", "]", "{", "chmod", ",", "\"uga+rwx\"", ",", "tempFile", ".", "toString", "(", ")", "}", ")", ";", "for", "(", "UnixUser", "user", ":", "getUsers", "(", ")", ")", "{", "if", "(", "user", ".", "getHome", "(", ")", ".", "equals", "(", "myHome", ")", ")", "{", "logger", ".", "info", "(", "\"\"", "+", "user", ".", "getHome", "(", ")", "+", "\"", "==", "\"", "+", "myHome", ")", ";", "continue", ";", "}", "try", "{", "dest", "=", "new", "File", "(", "user", ".", "getHome", "(", ")", "+", "FS", "+", "\"Desktop\"", "+", "FS", "+", "writtenDesktopFile", ".", "getName", "(", ")", ")", ";", "rootScript", ".", "append", "(", "getSuCommand", "(", ")", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "user", ".", "getName", "(", ")", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "\"-c\"", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "'\"'", ")", ";", "rootScript", ".", "append", "(", "copy", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "tempFile", ".", "toString", "(", ")", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "StringTool", ".", "replace", "(", "dest", ".", "toString", "(", ")", ",", "\"", "\"", ",", "\"\\\\", "\"", ")", ")", ";", "rootScript", ".", "appendln", "(", "'\"'", ")", ";", "rootScript", ".", "append", "(", "'\\n'", ")", ";", "rootScript", ".", "append", "(", "chown", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "append", "(", "user", ".", "getName", "(", ")", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "appendln", "(", "StringTool", ".", "replace", "(", "dest", ".", "toString", "(", ")", ",", "\"", "\"", ",", "\"\\\\", "\"", ")", ")", ";", "rootScript", ".", "append", "(", "'\\n'", ")", ";", "rootScript", ".", "append", "(", "'\\n'", ")", ";", "uninstallScript", ".", "append", "(", "getSuCommand", "(", ")", ")", ";", "uninstallScript", ".", "append", "(", "S", ")", ";", "uninstallScript", ".", "append", "(", "user", ".", "getName", "(", ")", ")", ";", "uninstallScript", ".", "append", "(", "S", ")", ";", "uninstallScript", ".", "append", "(", "\"-c\"", ")", ";", "uninstallScript", ".", "append", "(", "S", ")", ";", "uninstallScript", ".", "append", "(", "'\"'", ")", ";", "uninstallScript", ".", "append", "(", "rm", ")", ";", "uninstallScript", ".", "append", "(", "S", ")", ";", "uninstallScript", ".", "append", "(", "StringTool", ".", "replace", "(", "dest", ".", "toString", "(", ")", ",", "\"", "\"", ",", "\"\\\\", "\"", ")", ")", ";", "uninstallScript", ".", "appendln", "(", "'\"'", ")", ";", "uninstallScript", ".", "appendln", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "INFO", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "rootScript", ".", "append", "(", "rm", ")", ";", "rootScript", ".", "append", "(", "S", ")", ";", "rootScript", ".", "appendln", "(", "tempFile", ".", "toString", "(", ")", ")", ";", "rootScript", ".", "appendln", "(", ")", ";", "}", "@", "Override", "public", "void", "execPostAction", "(", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "String", "pseudoUnique", "=", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "Long", ".", "toString", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "String", "scriptFilename", "=", "null", ";", "try", "{", "scriptFilename", "=", "File", ".", "createTempFile", "(", "pseudoUnique", ",", "\".sh\"", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "scriptFilename", "=", "System", ".", "getProperty", "(", "\"\"", ",", "\"/tmp\"", ")", "+", "\"/\"", "+", "pseudoUnique", "+", "\".sh\"", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "rootScript", ".", "write", "(", "scriptFilename", ")", ";", "rootScript", ".", "exec", "(", ")", ";", "rootScript", ".", "delete", "(", ")", ";", "logger", ".", "fine", "(", "rootScript", ".", "toString", "(", ")", ")", ";", "pseudoUnique", "=", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "Long", ".", "toString", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "try", "{", "scriptFilename", "=", "File", ".", "createTempFile", "(", "pseudoUnique", ",", "\".sh\"", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "scriptFilename", "=", "System", ".", "getProperty", "(", "\"\"", ",", "\"/tmp\"", ")", "+", "\"/\"", "+", "pseudoUnique", "+", "\".sh\"", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "myInstallScript", ".", "write", "(", "scriptFilename", ")", ";", "myInstallScript", ".", "exec", "(", ")", ";", "myInstallScript", ".", "delete", "(", ")", ";", "logger", ".", "fine", "(", "myInstallScript", ".", "toString", "(", ")", ")", ";", "logger", ".", "fine", "(", "uninstallScript", ".", "toString", "(", ")", ")", ";", "uninstaller", ".", "addUninstallScript", "(", "uninstallScript", ".", "getContentAsString", "(", ")", ")", ";", "}", "public", "static", "void", "copyTo", "(", "File", "inFile", ",", "File", "outFile", ")", "throws", "IOException", "{", "char", "[", "]", "cbuff", "=", "new", "char", "[", "32768", "]", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "inFile", ")", ")", ";", "BufferedWriter", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "outFile", ")", ")", ";", "int", "readBytes", "=", "0", ";", "while", "(", "(", "readBytes", "=", "reader", ".", "read", "(", "cbuff", ",", "0", ",", "cbuff", ".", "length", ")", ")", "!=", "-", "1", ")", "{", "writer", ".", "write", "(", "cbuff", ",", "0", ",", "readBytes", ")", ";", "}", "reader", ".", "close", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "}", "private", "String", "writtenFileName", ";", "public", "String", "getWrittenFileName", "(", ")", "{", "return", "writtenFileName", ";", "}", "protected", "void", "setWrittenFileName", "(", "String", "s", ")", "{", "writtenFileName", "=", "s", ";", "}", "private", "File", "writeAppShortcut", "(", "String", "targetPath", ",", "String", "shortcutName", ",", "String", "shortcutDef", ")", "{", "return", "writeAppShortcutWithSimpleSpacehandling", "(", "targetPath", ",", "shortcutName", ",", "shortcutDef", ",", "false", ")", ";", "}", "private", "File", "writeAppShortcutWithOutSpace", "(", "String", "targetPath", ",", "String", "shortcutName", ",", "String", "shortcutDef", ")", "{", "return", "writeAppShortcutWithSimpleSpacehandling", "(", "targetPath", ",", "shortcutName", ",", "shortcutDef", ",", "true", ")", ";", "}", "private", "File", "writeAppShortcutWithSimpleSpacehandling", "(", "String", "targetPath", ",", "String", "shortcutName", ",", "String", "shortcutDef", ",", "boolean", "replaceSpacesWithMinus", ")", "{", "if", "(", "!", "(", "targetPath", ".", "endsWith", "(", "\"/\"", ")", "||", "targetPath", ".", "endsWith", "(", "\"\\\\\"", ")", ")", ")", "{", "targetPath", "+=", "File", ".", "separatorChar", ";", "}", "File", "shortcutFile", ";", "do", "{", "shortcutFile", "=", "new", "File", "(", "targetPath", "+", "(", "replaceSpacesWithMinus", "==", "true", "?", "StringTool", ".", "replaceSpacesWithMinus", "(", "shortcutName", ")", ":", "shortcutName", ")", "+", "\"-\"", "+", "System", ".", "currentTimeMillis", "(", ")", "+", "DESKTOP_EXT", ")", ";", "}", "while", "(", "shortcutFile", ".", "exists", "(", ")", ")", ";", "FileWriter", "fileWriter", "=", "null", ";", "try", "{", "fileWriter", "=", "new", "FileWriter", "(", "shortcutFile", ")", ";", "}", "catch", "(", "IOException", "e1", ")", "{", "System", ".", "out", ".", "println", "(", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "fileWriter", ".", "write", "(", "shortcutDef", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "try", "{", "fileWriter", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e2", ")", "{", "e2", ".", "printStackTrace", "(", ")", ";", "}", "return", "shortcutFile", ";", "}", "@", "Override", "public", "void", "setArguments", "(", "String", "args", ")", "{", "props", ".", "put", "(", "$Arguments", ",", "args", ")", ";", "}", "@", "Override", "public", "void", "setDescription", "(", "String", "description", ")", "{", "props", ".", "put", "(", "$Comment", ",", "description", ")", ";", "}", "@", "Override", "public", "void", "setIconLocation", "(", "String", "path", ",", "int", "index", ")", "{", "props", ".", "put", "(", "$Icon", ",", "path", ")", ";", "}", "@", "Override", "public", "void", "setLinkName", "(", "String", "aName", ")", "{", "this", ".", "itsName", "=", "aName", ";", "props", ".", "put", "(", "$Name", ",", "aName", ")", ";", "}", "@", "Override", "public", "void", "setLinkType", "(", "int", "aType", ")", "throws", "IllegalArgumentException", ",", "UnsupportedEncodingException", "{", "ShortcutType", "=", "aType", ";", "}", "@", "Override", "public", "void", "setProgramGroup", "(", "String", "aGroupName", ")", "{", "this", ".", "itsGroupName", "=", "aGroupName", ";", "}", "@", "Override", "public", "void", "setShowCommand", "(", "int", "show", ")", "{", "}", "@", "Override", "public", "void", "setTargetPath", "(", "String", "aPath", ")", "{", "StringTokenizer", "whiteSpaceTester", "=", "new", "StringTokenizer", "(", "aPath", ")", ";", "if", "(", "whiteSpaceTester", ".", "countTokens", "(", ")", ">", "1", ")", "{", "props", ".", "put", "(", "$E_QUOT", ",", "QM", ")", ";", "}", "props", ".", "put", "(", "$Exec", ",", "aPath", ")", ";", "}", "@", "Override", "public", "void", "setUserType", "(", "int", "aUserType", ")", "{", "this", ".", "itsUserType", "=", "aUserType", ";", "}", "@", "Override", "public", "void", "setWorkingDirectory", "(", "String", "aDirectory", ")", "{", "StringTokenizer", "whiteSpaceTester", "=", "new", "StringTokenizer", "(", "aDirectory", ")", ";", "if", "(", "whiteSpaceTester", ".", "countTokens", "(", ")", ">", "1", ")", "{", "props", ".", "put", "(", "$P_QUOT", ",", "QM", ")", ";", "}", "props", ".", "put", "(", "$Path", ",", "aDirectory", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "itsName", "+", "N", "+", "template", ";", "}", "public", "String", "replace", "(", ")", "{", "String", "result", "=", "template", ";", "Enumeration", "<", "Object", ">", "enumeration", "=", "props", ".", "keys", "(", ")", ";", "while", "(", "enumeration", ".", "hasMoreElements", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "enumeration", ".", "nextElement", "(", ")", ";", "result", "=", "StringTool", ".", "replace", "(", "result", ",", "key", ",", "props", ".", "getProperty", "(", "key", ")", ")", ";", "}", "return", "result", ";", "}", "@", "Override", "public", "void", "setEncoding", "(", "String", "aEncoding", ")", "{", "props", ".", "put", "(", "$Encoding", ",", "aEncoding", ")", ";", "}", "@", "Override", "public", "void", "setKdeSubstUID", "(", "String", "trueFalseOrNothing", ")", "{", "props", ".", "put", "(", "$X_KDE_SubstituteUID", ",", "trueFalseOrNothing", ")", ";", "}", "@", "Override", "public", "void", "setKdeUserName", "(", "String", "aUserName", ")", "{", "props", ".", "put", "(", "$X_KDE_Username", ",", "aUserName", ")", ";", "}", "@", "Override", "public", "void", "setMimetype", "(", "String", "aMimetype", ")", "{", "props", ".", "put", "(", "$MimeType", ",", "aMimetype", ")", ";", "}", "@", "Override", "public", "void", "setTerminal", "(", "String", "trueFalseOrNothing", ")", "{", "props", ".", "put", "(", "$Terminal", ",", "trueFalseOrNothing", ")", ";", "}", "@", "Override", "public", "void", "setTerminalOptions", "(", "String", "someTerminalOptions", ")", "{", "props", ".", "put", "(", "$Options_For_Terminal", ",", "someTerminalOptions", ")", ";", "}", "@", "Override", "public", "void", "setType", "(", "String", "aType", ")", "{", "props", ".", "put", "(", "$Type", ",", "aType", ")", ";", "}", "@", "Override", "public", "void", "setURL", "(", "String", "anUrl", ")", "{", "props", ".", "put", "(", "$URL", ",", "anUrl", ")", ";", "}", "@", "Override", "public", "int", "getUserType", "(", ")", "{", "return", "itsUserType", ";", "}", "@", "Override", "public", "void", "setCategories", "(", "String", "theCategories", ")", "{", "props", ".", "put", "(", "$Categories", ",", "theCategories", ")", ";", "}", "@", "Override", "public", "void", "setTryExec", "(", "String", "aTryExec", ")", "{", "props", ".", "put", "(", "$TryExec", ",", "aTryExec", ")", ";", "}", "@", "Override", "public", "int", "getLinkType", "(", ")", "{", "return", "ShortcutType", ";", "}", "}", "</s>" ]
10,638
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "FileQueueDelete", "implements", "FileQueueOperation", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileQueueDelete", ".", "class", ".", "getName", "(", ")", ")", ";", "protected", "File", "file", ";", "public", "FileQueueDelete", "(", "File", "file", ")", "{", "this", ".", "file", "=", "file", ";", "}", "public", "FileQueueDelete", "(", "String", "file", ")", "{", "this", ".", "file", "=", "new", "File", "(", "file", ")", ";", "}", "public", "void", "addTo", "(", "WinSetupFileQueue", "fileQueue", ")", "throws", "IOException", "{", "if", "(", "file", "!=", "null", ")", "{", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "logger", ".", "warning", "(", "\"Directory", "\"", "+", "file", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "}", "else", "{", "logger", ".", "fine", "(", "\"\"", "+", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "try", "{", "fileQueue", ".", "addDelete", "(", "file", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "String", "msg", "=", "\"\"", "+", "file", "+", "\"", "due", "to", "\"", "+", "ioe", ".", "getMessage", "(", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "}", "}", "else", "{", "logger", ".", "warning", "(", "\"\"", "+", "file", ".", "getAbsolutePath", "(", ")", "+", "\"", "to", "delete.\"", ")", ";", "}", "}", "}", "}", "</s>" ]
10,639
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "FileQueueMove", "extends", "FileQueueCopy", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileQueueMove", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "FileQueueMove", "(", "File", "fromFile", ",", "File", "toFile", ")", "{", "this", "(", "fromFile", ",", "toFile", ",", "false", ")", ";", "}", "public", "FileQueueMove", "(", "File", "fromFile", ",", "File", "toFile", ",", "boolean", "forceInUse", ")", "{", "super", "(", "fromFile", ",", "toFile", ",", "true", ",", "forceInUse", ")", ";", "}", "@", "Override", "public", "void", "addTo", "(", "WinSetupFileQueue", "filequeue", ")", "throws", "IOException", "{", "try", "{", "logger", ".", "fine", "(", "\"\"", "+", "fromFile", "+", "\"", "to", "\"", "+", "toFile", "+", "\"", "(0x\"", "+", "Integer", ".", "toHexString", "(", "copyStyle", ")", "+", "\")\"", ")", ";", "filequeue", ".", "addMove", "(", "fromFile", ",", "toFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "fromFile", "+", "\"", "to", "\"", "+", "toFile", "+", "\"", "due", "to", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
10,640
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallData", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "Shortcut", "{", "public", "static", "final", "int", "APPLICATIONS", "=", "1", ";", "public", "static", "final", "int", "START_MENU", "=", "2", ";", "public", "static", "final", "int", "DESKTOP", "=", "3", ";", "public", "static", "final", "int", "START_UP", "=", "4", ";", "public", "static", "final", "int", "HIDE", "=", "0", ";", "public", "static", "final", "int", "NORMAL", "=", "1", ";", "public", "static", "final", "int", "MINIMIZED", "=", "2", ";", "public", "static", "final", "int", "MAXIMIZED", "=", "3", ";", "public", "static", "final", "int", "CURRENT_USER", "=", "1", ";", "public", "static", "final", "int", "ALL_USERS", "=", "2", ";", "private", "Boolean", "createForAll", ";", "protected", "UninstallData", "uninstaller", ";", "public", "void", "initialize", "(", "int", "type", ",", "String", "name", ")", "throws", "Exception", "{", "}", "public", "String", "getBasePath", "(", ")", "throws", "Exception", "{", "return", "(", "\"\"", ")", ";", "}", "public", "List", "<", "String", ">", "getProgramGroups", "(", "int", "userType", ")", "{", "return", "null", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "(", "\"\"", ")", ";", "}", "public", "String", "getDirectoryCreated", "(", ")", "{", "return", "(", "null", ")", ";", "}", "public", "boolean", "multipleUsers", "(", ")", "{", "return", "(", "false", ")", ";", "}", "public", "boolean", "supported", "(", ")", "{", "return", "(", "false", ")", ";", "}", "public", "void", "setArguments", "(", "String", "arguments", ")", "{", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "}", "public", "void", "setIconLocation", "(", "String", "path", ",", "int", "index", ")", "{", "}", "public", "String", "getIconLocation", "(", ")", "{", "return", "\"\"", ";", "}", "public", "void", "setProgramGroup", "(", "String", "groupName", ")", "{", "}", "public", "void", "setShowCommand", "(", "int", "show", ")", "{", "}", "public", "int", "getShowCommand", "(", ")", "{", "return", "Shortcut", ".", "NORMAL", ";", "}", "public", "void", "setTargetPath", "(", "String", "path", ")", "{", "}", "public", "void", "setWorkingDirectory", "(", "String", "dir", ")", "{", "}", "public", "String", "getWorkingDirectory", "(", ")", "{", "return", "\"\"", ";", "}", "public", "void", "setLinkName", "(", "String", "name", ")", "{", "}", "public", "int", "getLinkType", "(", ")", "{", "return", "Shortcut", ".", "DESKTOP", ";", "}", "public", "void", "setLinkType", "(", "int", "type", ")", "throws", "IllegalArgumentException", ",", "UnsupportedEncodingException", "{", "}", "public", "void", "setUserType", "(", "int", "type", ")", "{", "}", "public", "int", "getUserType", "(", ")", "{", "return", "CURRENT_USER", ";", "}", "public", "void", "save", "(", ")", "throws", "Exception", "{", "}", "public", "int", "getHotkey", "(", ")", "{", "return", "0", ";", "}", "public", "void", "setHotkey", "(", "int", "hotkey", ")", "{", "}", "public", "void", "setEncoding", "(", "String", "string", ")", "{", "}", "public", "void", "setMimetype", "(", "String", "string", ")", "{", "}", "public", "void", "setTerminal", "(", "String", "string", ")", "{", "}", "public", "void", "setTerminalOptions", "(", "String", "string", ")", "{", "}", "public", "void", "setType", "(", "String", "string", ")", "{", "}", "public", "void", "setKdeUserName", "(", "String", "string", ")", "{", "}", "public", "void", "setKdeSubstUID", "(", "String", "string", ")", "{", "}", "public", "void", "setURL", "(", "String", "string", ")", "{", "}", "public", "String", "getProgramsFolder", "(", "int", "current_user", ")", "{", "return", "null", ";", "}", "public", "void", "setCreateForAll", "(", "Boolean", "aCreateForAll", ")", "{", "this", ".", "createForAll", "=", "aCreateForAll", ";", "}", "public", "Boolean", "getCreateForAll", "(", ")", "{", "return", "createForAll", ";", "}", "public", "void", "setCategories", "(", "String", "theCategories", ")", "{", "}", "public", "void", "setTryExec", "(", "String", "aTryExec", ")", "{", "}", "public", "void", "setUninstaller", "(", "UninstallData", "theUninstaller", ")", "{", "uninstaller", "=", "theUninstaller", ";", "}", "public", "void", "execPostAction", "(", ")", "{", "}", "public", "void", "cleanUp", "(", ")", "{", "}", "}", "</s>" ]
10,641
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "interface", "FileQueueOperation", "{", "public", "abstract", "void", "addTo", "(", "WinSetupFileQueue", "filequeue", ")", "throws", "IOException", ";", "}", "</s>" ]
10,642
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "IzPackException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "WinSetupFileQueue", "extends", "WinSetupAPIBase", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "WinSetupFileQueue", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "int", "reboot", "=", "0", ";", "private", "int", "handle", "=", "INVALID_HANDLE_VALUE", ";", "public", "WinSetupFileQueue", "(", "Librarian", "librarian", ")", "throws", "Exception", "{", "this", "(", "librarian", ",", "null", ")", ";", "}", "public", "WinSetupFileQueue", "(", "Librarian", "librarian", ",", "WinSetupQueueCallbackInterface", "handler", ")", "throws", "IOException", "{", "super", "(", "librarian", ")", ";", "this", ".", "handle", "=", "SetupOpenFileQueue", "(", "handler", ")", ";", "}", "protected", "void", "addCopy", "(", "File", "sourcefile", ",", "File", "targetfile", ",", "int", "copyStyle", ")", "throws", "IOException", "{", "SetupQueueCopy", "(", "this", ".", "handle", ",", "sourcefile", ".", "getParent", "(", ")", ",", "null", ",", "sourcefile", ".", "getName", "(", ")", ",", "null", ",", "null", ",", "targetfile", ".", "getParent", "(", ")", ",", "targetfile", ".", "getName", "(", ")", ",", "copyStyle", ")", ";", "}", "public", "void", "addCopy", "(", "File", "sourcefile", ",", "File", "targetfile", ")", "throws", "IOException", "{", "addCopy", "(", "sourcefile", ",", "targetfile", ",", "false", ")", ";", "}", "public", "void", "addCopy", "(", "File", "sourcefile", ",", "File", "targetfile", ",", "boolean", "forceInUse", ")", "throws", "IOException", "{", "int", "style", "=", "0", ";", "if", "(", "forceInUse", ")", "{", "style", "|=", "SP_COPY_FORCE_IN_USE", ";", "}", "addCopy", "(", "sourcefile", ",", "targetfile", ",", "style", ")", ";", "}", "public", "void", "addDelete", "(", "File", "file", ")", "throws", "IOException", "{", "SetupQueueDelete", "(", "this", ".", "handle", ",", "file", ".", "getParent", "(", ")", ",", "file", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "addRename", "(", "File", "sourcefile", ",", "File", "targetfile", ")", "throws", "IOException", "{", "SetupQueueRename", "(", "this", ".", "handle", ",", "sourcefile", ".", "getParent", "(", ")", ",", "sourcefile", ".", "getName", "(", ")", ",", "targetfile", ".", "getParent", "(", ")", ",", "targetfile", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "addMove", "(", "File", "sourcefile", ",", "File", "targetfile", ")", "throws", "IOException", "{", "addCopy", "(", "sourcefile", ",", "targetfile", ",", "false", ")", ";", "}", "public", "void", "addMove", "(", "File", "sourcefile", ",", "File", "targetfile", ",", "boolean", "forceInUse", ")", "throws", "IOException", "{", "int", "style", "=", "SP_COPY_DELETESOURCE", ";", "if", "(", "forceInUse", ")", "{", "style", "|=", "SP_COPY_FORCE_IN_USE", ";", "}", "addCopy", "(", "sourcefile", ",", "targetfile", ",", "style", ")", ";", "}", "public", "boolean", "commit", "(", ")", "throws", "IOException", "{", "boolean", "result", "=", "SetupCommitFileQueue", "(", "this", ".", "handle", ")", ";", "if", "(", "result", ")", "{", "reboot", "=", "SetupPromptReboot", "(", "this", ".", "handle", ",", "true", ")", ";", "if", "(", "(", "reboot", "&", "SPFILEQ_FILE_IN_USE", ")", "!=", "0", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "}", "if", "(", "(", "reboot", "&", "SPFILEQ_REBOOT_RECOMMENDED", ")", "!=", "0", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "}", "if", "(", "(", "reboot", "&", "SPFILEQ_REBOOT_IN_PROGRESS", ")", "!=", "0", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "}", "}", "return", "result", ";", "}", "public", "void", "close", "(", ")", "{", "SetupCloseFileQueue", "(", "this", ".", "handle", ")", ";", "this", ".", "handle", "=", "INVALID_HANDLE_VALUE", ";", "}", "public", "boolean", "isRebootNecessary", "(", ")", "{", "return", "reboot", ">", "0", ";", "}", "}", "</s>" ]
10,643
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "File", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "DefaultTargetPlatformFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platform", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platforms", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "TargetFactory", ";", "public", "class", "WinSetupAPIMain", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", ">", "0", ")", "{", "try", "{", "ObjectFactory", "dummy", "=", "new", "ObjectFactory", "(", ")", "{", "@", "Override", "public", "<", "T", ">", "T", "create", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "parameters", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "<", "T", ">", "T", "create", "(", "String", "className", ",", "Class", "<", "T", ">", "superType", ",", "Object", "...", "parameters", ")", "{", "return", "null", ";", "}", "}", ";", "Platforms", "platforms", "=", "new", "Platforms", "(", ")", ";", "Platform", "platform", "=", "platforms", ".", "getCurrentPlatform", "(", ")", ";", "TargetFactory", "factory", "=", "new", "TargetFactory", "(", "new", "DefaultTargetPlatformFactory", "(", "dummy", ",", "platform", ",", "platforms", ")", ")", ";", "Librarian", "librarian", "=", "new", "Librarian", "(", "factory", ",", "new", "Housekeeper", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "WinSetupFileQueue", "fq", "=", "new", "WinSetupFileQueue", "(", "librarian", ",", "new", "WinSetupDefaultCallbackHandler", "(", ")", ")", ";", "String", "name", "=", "args", "[", "0", "]", ";", "char", "c", "=", "name", ".", "charAt", "(", "0", ")", ";", "switch", "(", "c", ")", "{", "case", "'c'", ":", "if", "(", "args", ".", "length", "==", "3", ")", "{", "File", "srcfile", "=", "new", "File", "(", "args", "[", "1", "]", ")", ";", "File", "destfile", "=", "new", "File", "(", "args", "[", "2", "]", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "1", "]", "+", "\"", "->", "\"", "+", "args", "[", "2", "]", ")", ";", "fq", ".", "addCopy", "(", "srcfile", ",", "destfile", ")", ";", "}", "else", "{", "usageNotes", "(", ")", ";", "}", "break", ";", "case", "'m'", ":", "if", "(", "args", ".", "length", "==", "3", ")", "{", "File", "srcfile", "=", "new", "File", "(", "args", "[", "1", "]", ")", ";", "File", "destfile", "=", "new", "File", "(", "args", "[", "2", "]", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "1", "]", "+", "\"", "->", "\"", "+", "args", "[", "2", "]", ")", ";", "fq", ".", "addMove", "(", "srcfile", ",", "destfile", ")", ";", "}", "else", "{", "usageNotes", "(", ")", ";", "}", "break", ";", "case", "'d'", ":", "if", "(", "args", ".", "length", "==", "2", ")", "{", "File", "file", "=", "new", "File", "(", "args", "[", "1", "]", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "1", "]", ")", ";", "fq", ".", "addDelete", "(", "file", ")", ";", "}", "else", "{", "usageNotes", "(", ")", ";", "}", "break", ";", "default", ":", "usageNotes", "(", ")", ";", "break", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "fq", ".", "commit", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "fq", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "System", ".", "exit", "(", "1", ")", ";", "}", "}", "else", "{", "usageNotes", "(", ")", ";", "}", "}", "private", "static", "void", "usageNotes", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"Usage:\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
10,644
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "WinSetupDefaultCallbackHandler", "implements", "WinSetupQueueCallbackInterface", "{", "private", "List", "<", "SystemErrorException", ">", "exceptions", ";", "public", "int", "handleNeedMedia", "(", "String", "tagfile", ",", "String", "description", ",", "String", "sourcePath", ",", "String", "sourceFile", ")", "{", "File", "file", "=", "new", "File", "(", "sourcePath", ",", "sourceFile", ")", ";", "if", "(", "file", ".", "exists", "(", ")", "&&", "file", ".", "canRead", "(", ")", ")", "{", "return", "FILEOP_RETRY", ";", "}", "addException", "(", "\"Source", "file", "\"", "+", "file", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "return", "FILEOP_ABORT", ";", "}", "public", "int", "handleCopyError", "(", "String", "source", ",", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", "{", "addException", "(", "errCode", ",", "\"\"", "+", "source", "+", "\"", "->", "\"", "+", "target", "+", "\":", "\"", "+", "errMsg", ")", ";", "return", "FILEOP_ABORT", ";", "}", "public", "int", "handleDeleteError", "(", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", "{", "addException", "(", "errCode", ",", "\"\"", "+", "target", "+", "\":", "\"", "+", "errMsg", ")", ";", "return", "FILEOP_SKIP", ";", "}", "public", "int", "handleRenameError", "(", "String", "source", ",", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", "{", "addException", "(", "errCode", ",", "\"\"", "+", "source", "+", "\"", "->", "\"", "+", "target", "+", "\":", "\"", "+", "errMsg", ")", ";", "return", "FILEOP_ABORT", ";", "}", "public", "List", "<", "SystemErrorException", ">", "getExceptions", "(", ")", "{", "return", "exceptions", ";", "}", "private", "void", "addException", "(", "String", "errMsg", ")", "{", "addException", "(", "0", ",", "errMsg", ")", ";", "}", "private", "void", "addException", "(", "int", "errCode", ",", "String", "errMsg", ")", "{", "if", "(", "exceptions", "==", "null", ")", "{", "exceptions", "=", "new", "ArrayList", "<", "SystemErrorException", ">", "(", ")", ";", "}", "exceptions", ".", "add", "(", "new", "SystemErrorException", "(", "errCode", ",", "errMsg", ")", ")", ";", "}", "}", "</s>" ]
10,645
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "public", "class", "FileQueue", "{", "private", "List", "<", "FileQueueOperation", ">", "operations", "=", "new", "ArrayList", "<", "FileQueueOperation", ">", "(", ")", ";", "protected", "WinSetupFileQueue", "filequeue", ";", "private", "final", "Librarian", "librarian", ";", "public", "FileQueue", "(", "Librarian", "librarian", ")", "{", "this", ".", "librarian", "=", "librarian", ";", "}", "public", "void", "add", "(", "FileQueueOperation", "op", ")", "{", "operations", ".", "add", "(", "op", ")", ";", "}", "public", "boolean", "isEmpty", "(", ")", "{", "return", "operations", ".", "isEmpty", "(", ")", ";", "}", "public", "void", "execute", "(", ")", "throws", "IOException", "{", "WinSetupDefaultCallbackHandler", "handler", "=", "new", "WinSetupDefaultCallbackHandler", "(", ")", ";", "try", "{", "filequeue", "=", "new", "WinSetupFileQueue", "(", "librarian", ",", "handler", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "ioe", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "for", "(", "FileQueueOperation", "operation", ":", "operations", ")", "{", "operation", ".", "addTo", "(", "filequeue", ")", ";", "}", "filequeue", ".", "commit", "(", ")", ";", "List", "<", "SystemErrorException", ">", "exceptions", "=", "handler", ".", "getExceptions", "(", ")", ";", "if", "(", "exceptions", "!=", "null", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"\"", ")", ";", "for", "(", "SystemErrorException", "exception", ":", "exceptions", ")", "{", "buf", ".", "append", "(", "'\\t'", ")", ";", "buf", ".", "append", "(", "exception", ".", "toString", "(", ")", ")", ";", "buf", ".", "append", "(", "'\\n'", ")", ";", "}", "throw", "new", "IOException", "(", "buf", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "ioe", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "filequeue", ".", "close", "(", ")", ";", "}", "}", "public", "boolean", "isRebootNecessary", "(", ")", "{", "return", "filequeue", "!=", "null", "&&", "filequeue", ".", "isRebootNecessary", "(", ")", ";", "}", "public", "List", "<", "FileQueueOperation", ">", "getOperations", "(", ")", "{", "return", "operations", ";", "}", "}", "</s>" ]
10,646
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "public", "interface", "WinSetupQueueCallbackInterface", "{", "public", "final", "static", "int", "FILEOP_ABORT", "=", "0", ";", "public", "final", "static", "int", "FILEOP_DOIT", "=", "1", ";", "public", "final", "static", "int", "FILEOP_SKIP", "=", "2", ";", "public", "final", "static", "int", "FILEOP_RETRY", "=", "FILEOP_DOIT", ";", "public", "final", "static", "int", "FILEOP_NEWPATH", "=", "4", ";", "public", "int", "handleNeedMedia", "(", "String", "tagfile", ",", "String", "description", ",", "String", "sourcePath", ",", "String", "sourceFile", ")", ";", "public", "int", "handleCopyError", "(", "String", "source", ",", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", ";", "public", "int", "handleDeleteError", "(", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", ";", "public", "int", "handleRenameError", "(", "String", "source", ",", "String", "target", ",", "int", "errCode", ",", "String", "errMsg", ")", ";", "}", "</s>" ]
10,647
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "NativeLibraryClient", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "public", "class", "ShellLink", "implements", "NativeLibraryClient", "{", "public", "static", "final", "int", "HIDE", "=", "0", ";", "public", "static", "final", "int", "NORMAL", "=", "1", ";", "public", "static", "final", "int", "MINIMIZED", "=", "2", ";", "public", "static", "final", "int", "MAXIMIZED", "=", "3", ";", "public", "static", "final", "int", "MINNOACTIVE", "=", "7", ";", "private", "static", "final", "int", "MIN_SHOW", "=", "0", ";", "private", "static", "final", "int", "MAX_SHOW", "=", "7", ";", "public", "static", "final", "int", "DESKTOP", "=", "1", ";", "public", "static", "final", "int", "PROGRAM_MENU", "=", "2", ";", "public", "static", "final", "int", "START_MENU", "=", "3", ";", "public", "static", "final", "int", "STARTUP", "=", "4", ";", "private", "static", "final", "int", "MIN_TYPE", "=", "1", ";", "private", "static", "final", "int", "MAX_TYPE", "=", "4", ";", "private", "static", "final", "int", "SL_OK", "=", "1", ";", "private", "static", "final", "int", "SL_ERROR", "=", "-", "1", ";", "private", "static", "final", "int", "SL_INITIALIZED", "=", "-", "2", ";", "private", "static", "final", "int", "SL_NOT_INITIALIZED", "=", "-", "3", ";", "private", "static", "final", "int", "SL_OUT_OF_HANDLES", "=", "-", "4", ";", "private", "static", "final", "int", "SL_NO_IPERSIST", "=", "-", "5", ";", "private", "static", "final", "int", "SL_NO_SAVE", "=", "-", "6", ";", "private", "static", "final", "int", "SL_WRONG_DATA_TYPE", "=", "-", "7", ";", "private", "static", "final", "int", "UNINITIALIZED", "=", "-", "1", ";", "private", "static", "final", "String", "LINK_EXTENSION", "=", "\".lnk\"", ";", "public", "static", "final", "int", "CURRENT_USER", "=", "0", ";", "public", "static", "final", "int", "ALL_USERS", "=", "1", ";", "private", "int", "nativeHandle", "=", "UNINITIALIZED", ";", "private", "String", "currentUserLinkPath", ";", "private", "String", "allUsersLinkPath", ";", "private", "String", "groupName", "=", "\"\"", ";", "private", "String", "linkName", "=", "\"\"", ";", "private", "String", "linkFileName", "=", "\"\"", ";", "private", "String", "linkDirectory", "=", "\"\"", ";", "private", "String", "arguments", "=", "\"\"", ";", "private", "String", "description", "=", "\"\"", ";", "private", "String", "iconPath", "=", "\"\"", ";", "private", "String", "targetPath", "=", "\"\"", ";", "private", "String", "workingDirectory", "=", "\"\"", ";", "private", "String", "dummyString", "=", "\"\"", ";", "private", "int", "hotkey", "=", "0", ";", "private", "int", "iconIndex", "=", "0", ";", "private", "int", "showCommand", "=", "NORMAL", ";", "private", "int", "linkType", "=", "DESKTOP", ";", "private", "int", "userType", "=", "CURRENT_USER", ";", "private", "boolean", "initializeSucceeded", "=", "false", ";", "private", "final", "Librarian", "librarian", ";", "private", "native", "int", "initializeCOM", "(", ")", ";", "private", "native", "int", "releaseCOM", "(", ")", ";", "private", "native", "int", "getInterface", "(", ")", ";", "private", "native", "int", "releaseInterface", "(", ")", ";", "private", "native", "int", "GetArguments", "(", ")", ";", "private", "native", "int", "GetDescription", "(", ")", ";", "private", "native", "int", "GetHotkey", "(", ")", ";", "private", "native", "int", "GetIconLocation", "(", ")", ";", "private", "native", "int", "GetPath", "(", ")", ";", "private", "native", "int", "GetShowCommand", "(", ")", ";", "private", "native", "int", "GetWorkingDirectory", "(", ")", ";", "private", "native", "int", "Resolve", "(", ")", ";", "private", "native", "int", "SetArguments", "(", ")", ";", "private", "native", "int", "SetDescription", "(", ")", ";", "private", "native", "int", "SetHotkey", "(", ")", ";", "private", "native", "int", "SetIconLocation", "(", ")", ";", "private", "native", "int", "SetPath", "(", ")", ";", "private", "native", "int", "SetShowCommand", "(", ")", ";", "private", "native", "int", "SetWorkingDirectory", "(", ")", ";", "private", "native", "int", "saveLink", "(", "String", "name", ")", ";", "private", "native", "int", "loadLink", "(", "String", "name", ")", ";", "private", "native", "int", "GetFullLinkPath", "(", "int", "usertype", ",", "int", "linktype", ")", ";", "private", "native", "void", "FreeLibrary", "(", "String", "name", ")", ";", "public", "ShellLink", "(", "int", "type", ",", "String", "name", ",", "Librarian", "librarian", ")", "throws", "Exception", "{", "if", "(", "(", "type", "<", "MIN_TYPE", ")", "||", "(", "type", ">", "MAX_TYPE", ")", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "if", "(", "name", "==", "null", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "linkName", "=", "name", ";", "linkType", "=", "type", ";", "this", ".", "librarian", "=", "librarian", ";", "initialize", "(", ")", ";", "setAllLinkPaths", "(", ")", ";", "}", "public", "ShellLink", "(", "String", "name", ",", "int", "userType", ",", "Librarian", "librarian", ")", "throws", "Exception", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "this", ".", "userType", "=", "userType", ";", "this", ".", "librarian", "=", "librarian", ";", "initialize", "(", ")", ";", "int", "pathEnd", "=", "name", ".", "lastIndexOf", "(", "File", ".", "separator", ")", ";", "int", "nameStart", "=", "pathEnd", "+", "1", ";", "int", "nameEnd", "=", "name", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "nameEnd", "<", "0", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "linkName", "=", "name", ".", "substring", "(", "nameStart", ",", "nameEnd", ")", ";", "if", "(", "userType", "==", "CURRENT_USER", ")", "{", "currentUserLinkPath", "=", "name", ".", "substring", "(", "0", ",", "pathEnd", ")", ";", "}", "else", "{", "allUsersLinkPath", "=", "name", ".", "substring", "(", "0", ",", "pathEnd", ")", ";", "}", "linkFileName", "=", "fullLinkName", "(", "userType", ")", ";", "if", "(", "loadLink", "(", "linkFileName", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "get", "(", ")", ";", "}", "public", "ShellLink", "(", "int", "linkType", ",", "int", "userType", ",", "String", "group", ",", "String", "name", ",", "Librarian", "librarian", ")", "throws", "Exception", "{", "if", "(", "(", "linkType", "<", "MIN_TYPE", ")", "||", "(", "linkType", ">", "MAX_TYPE", ")", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "if", "(", "name", "==", "null", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "this", ".", "linkType", "=", "linkType", ";", "this", ".", "userType", "=", "userType", ";", "this", ".", "librarian", "=", "librarian", ";", "initialize", "(", ")", ";", "setAllLinkPaths", "(", ")", ";", "if", "(", "group", "!=", "null", ")", "{", "groupName", "=", "group", ";", "}", "linkName", "=", "name", ";", "linkFileName", "=", "fullLinkName", "(", "userType", ")", ";", "if", "(", "loadLink", "(", "linkFileName", ")", "!=", "SL_OK", ")", "{", "throw", "new", "Exception", "(", "\"\"", "+", "linkFileName", ")", ";", "}", "get", "(", ")", ";", "}", "private", "void", "initialize", "(", ")", "throws", "Exception", "{", "try", "{", "librarian", ".", "loadLibrary", "(", "\"ShellLink\"", ",", "this", ")", ";", "}", "catch", "(", "UnsatisfiedLinkError", "exception", ")", "{", "throw", "new", "Exception", "(", "\"\"", ",", "exception", ")", ";", "}", "try", "{", "if", "(", "initializeCOM", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "else", "{", "initializeSucceeded", "=", "true", ";", "}", "}", "catch", "(", "Throwable", "exception", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", "+", "exception", ".", "toString", "(", ")", ")", ")", ";", "}", "int", "successCode", "=", "getInterface", "(", ")", ";", "if", "(", "successCode", "!=", "SL_OK", ")", "{", "releaseCOM", "(", ")", ";", "initializeSucceeded", "=", "false", ";", "if", "(", "successCode", "==", "SL_OUT_OF_HANDLES", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "else", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "}", "}", "protected", "void", "finalize", "(", ")", "throws", "Throwable", "{", "releaseInterface", "(", ")", ";", "if", "(", "initializeSucceeded", ")", "{", "releaseCOM", "(", ")", ";", "initializeSucceeded", "=", "false", ";", "}", "super", ".", "finalize", "(", ")", ";", "}", "public", "void", "freeLibrary", "(", "String", "name", ")", "{", "int", "result", "=", "releaseInterface", "(", ")", ";", "if", "(", "initializeSucceeded", ")", "{", "result", "=", "releaseCOM", "(", ")", ";", "initializeSucceeded", "=", "false", ";", "}", "FreeLibrary", "(", "name", ")", ";", "}", "private", "String", "fullLinkPath", "(", "int", "userType", ")", "{", "StringBuffer", "path", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "userType", "==", "CURRENT_USER", ")", "{", "path", ".", "append", "(", "currentUserLinkPath", ")", ";", "}", "else", "{", "path", ".", "append", "(", "allUsersLinkPath", ")", ";", "}", "if", "(", "(", "groupName", "!=", "null", ")", "&&", "(", "groupName", ".", "length", "(", ")", ">", "0", ")", ")", "{", "path", ".", "append", "(", "File", ".", "separator", ")", ";", "path", ".", "append", "(", "groupName", ")", ";", "}", "return", "(", "path", ".", "toString", "(", ")", ")", ";", "}", "private", "String", "fullLinkName", "(", "int", "userType", ")", "{", "StringBuffer", "name", "=", "new", "StringBuffer", "(", ")", ";", "name", ".", "append", "(", "fullLinkPath", "(", "userType", ")", ")", ";", "name", ".", "append", "(", "File", ".", "separator", ")", ";", "name", ".", "append", "(", "linkName", ")", ";", "name", ".", "append", "(", "LINK_EXTENSION", ")", ";", "return", "(", "name", ".", "toString", "(", ")", ")", ";", "}", "private", "void", "set", "(", ")", "throws", "Exception", "{", "if", "(", "SetArguments", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetDescription", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetHotkey", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetIconLocation", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetPath", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetShowCommand", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "SetWorkingDirectory", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "}", "private", "void", "get", "(", ")", "throws", "Exception", "{", "if", "(", "GetArguments", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetDescription", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetHotkey", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetIconLocation", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetPath", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetShowCommand", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "GetWorkingDirectory", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "}", "public", "void", "setProgramGroup", "(", "String", "groupName", ")", "{", "this", ".", "groupName", "=", "groupName", ";", "}", "public", "void", "setArguments", "(", "String", "arguments", ")", "{", "this", ".", "arguments", "=", "arguments", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "public", "void", "setHotkey", "(", "int", "hotkey", ")", "{", "this", ".", "hotkey", "=", "hotkey", ";", "}", "public", "void", "setIconLocation", "(", "String", "path", ",", "int", "index", ")", "{", "this", ".", "iconPath", "=", "path", ";", "this", ".", "iconIndex", "=", "index", ";", "}", "public", "void", "setTargetPath", "(", "String", "path", ")", "{", "this", ".", "targetPath", "=", "path", ";", "}", "public", "void", "setShowCommand", "(", "int", "show", ")", "{", "if", "(", "(", "show", "<", "MIN_SHOW", ")", "||", "(", "show", ">", "MAX_SHOW", ")", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", "+", "show", ")", ")", ";", "}", "this", ".", "showCommand", "=", "show", ";", "}", "public", "void", "setWorkingDirectory", "(", "String", "dir", ")", "{", "this", ".", "workingDirectory", "=", "dir", ";", "}", "public", "void", "setLinkName", "(", "String", "name", ")", "{", "linkName", "=", "name", ";", "}", "public", "void", "setLinkType", "(", "int", "type", ")", "throws", "IllegalArgumentException", ",", "UnsupportedEncodingException", "{", "if", "(", "(", "type", "<", "MIN_TYPE", ")", "||", "(", "type", ">", "MAX_TYPE", ")", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "linkType", "=", "type", ";", "setAllLinkPaths", "(", ")", ";", "}", "public", "int", "getLinkType", "(", ")", "{", "return", "linkType", ";", "}", "public", "void", "setUserType", "(", "int", "type", ")", "throws", "IllegalArgumentException", "{", "if", "(", "(", "type", "==", "CURRENT_USER", ")", "||", "(", "type", "==", "ALL_USERS", ")", ")", "{", "userType", "=", "type", ";", "}", "else", "{", "throw", "(", "new", "IllegalArgumentException", "(", "type", "+", "\"\"", ")", ")", ";", "}", "}", "public", "int", "getUserType", "(", ")", "{", "return", "userType", ";", "}", "public", "String", "getLinkPath", "(", "int", "userType", ")", "{", "String", "result", "=", "null", ";", "if", "(", "userType", "==", "CURRENT_USER", ")", "{", "result", "=", "currentUserLinkPath", ";", "}", "else", "{", "result", "=", "allUsersLinkPath", ";", "}", "return", "result", ";", "}", "public", "String", "getArguments", "(", ")", "{", "return", "(", "arguments", ")", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "(", "description", ")", ";", "}", "public", "int", "getHotkey", "(", ")", "{", "return", "(", "hotkey", ")", ";", "}", "public", "String", "getIconLocation", "(", ")", "{", "return", "(", "iconPath", ")", ";", "}", "public", "int", "getIconIndex", "(", ")", "{", "return", "(", "iconIndex", ")", ";", "}", "public", "String", "getTargetPath", "(", ")", "{", "return", "(", "targetPath", ")", ";", "}", "public", "int", "getShowCommand", "(", ")", "{", "return", "(", "showCommand", ")", ";", "}", "public", "String", "getWorkingDirectory", "(", ")", "{", "return", "(", "workingDirectory", ")", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "(", "linkFileName", ")", ";", "}", "public", "String", "getDirectoryCreated", "(", ")", "{", "return", "(", "linkDirectory", ")", ";", "}", "public", "String", "getLinkName", "(", ")", "{", "return", "(", "linkName", ")", ";", "}", "public", "String", "getcurrentUserLinkPath", "(", ")", "{", "return", "currentUserLinkPath", ";", "}", "public", "String", "getallUsersLinkPath", "(", ")", "{", "return", "allUsersLinkPath", ";", "}", "public", "void", "save", "(", ")", "throws", "Exception", "{", "set", "(", ")", ";", "int", "result", "=", "Resolve", "(", ")", ";", "if", "(", "result", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "File", "directory", "=", "new", "File", "(", "fullLinkPath", "(", "userType", ")", ")", ";", "if", "(", "!", "directory", ".", "exists", "(", ")", ")", "{", "directory", ".", "mkdirs", "(", ")", ";", "linkDirectory", "=", "directory", ".", "getPath", "(", ")", ";", "}", "else", "{", "linkDirectory", "=", "\"\"", ";", "}", "File", "allUsersFileObj", "=", "null", ";", "long", "aufLastModVal", "=", "0", ";", "if", "(", "userType", "==", "CURRENT_USER", ")", "{", "allUsersFileObj", "=", "new", "File", "(", "fullLinkName", "(", "ALL_USERS", ")", ")", ";", "aufLastModVal", "=", "allUsersFileObj", ".", "lastModified", "(", ")", ";", "}", "String", "saveTo", "=", "fullLinkName", "(", "userType", ")", ";", "result", "=", "saveLink", "(", "saveTo", ")", ";", "if", "(", "result", "==", "SL_NO_IPERSIST", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "else", "if", "(", "result", "==", "SL_NO_SAVE", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "if", "(", "allUsersFileObj", "!=", "null", ")", "{", "try", "{", "if", "(", "allUsersFileObj", ".", "exists", "(", ")", "&&", "allUsersFileObj", ".", "lastModified", "(", ")", ">", "aufLastModVal", ")", "{", "final", "File", "curUserFileObj", "=", "new", "File", "(", "saveTo", ")", ";", "moveFileTo", "(", "allUsersFileObj", ",", "curUserFileObj", ")", ";", "allUsersFileObj", ".", "getParentFile", "(", ")", ".", "delete", "(", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "}", "}", "linkFileName", "=", "saveTo", ";", "}", "public", "void", "save", "(", "String", "name", ")", "throws", "Exception", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"\"", ")", ")", ";", "}", "set", "(", ")", ";", "if", "(", "Resolve", "(", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "File", "directory", "=", "new", "File", "(", "name", ".", "substring", "(", "0", ",", "name", ".", "lastIndexOf", "(", "File", ".", "separatorChar", ")", ")", ")", ";", "if", "(", "!", "directory", ".", "exists", "(", ")", ")", "{", "directory", ".", "mkdirs", "(", ")", ";", "linkDirectory", "=", "directory", ".", "getPath", "(", ")", ";", "}", "else", "{", "linkDirectory", "=", "null", ";", "}", "if", "(", "saveLink", "(", "name", ")", "!=", "SL_OK", ")", "{", "throw", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "}", "linkFileName", "=", "name", ";", "}", "protected", "void", "moveFileTo", "(", "File", "srcFileObj", ",", "File", "destFileObj", ")", "{", "if", "(", "destFileObj", ".", "exists", "(", ")", ")", "{", "final", "File", "tempFileObj", "=", "new", "File", "(", "destFileObj", ".", "getPath", "(", ")", "+", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "destFileObj", ".", "renameTo", "(", "tempFileObj", ")", ";", "srcFileObj", ".", "renameTo", "(", "destFileObj", ")", ";", "tempFileObj", ".", "delete", "(", ")", ";", "}", "else", "{", "srcFileObj", ".", "renameTo", "(", "destFileObj", ")", ";", "}", "}", "private", "void", "setAllLinkPaths", "(", ")", "throws", "IllegalArgumentException", "{", "currentUserLinkPath", "=", "\"\"", ";", "allUsersLinkPath", "=", "\"\"", ";", "GetFullLinkPath", "(", "CURRENT_USER", ",", "linkType", ")", ";", "GetFullLinkPath", "(", "ALL_USERS", ",", "linkType", ")", ";", "if", "(", "userType", "==", "CURRENT_USER", "&&", "currentUserLinkPath", ".", "length", "(", ")", "==", "0", ")", "{", "userType", "=", "ALL_USERS", ";", "}", "else", "if", "(", "userType", "==", "ALL_USERS", "&&", "allUsersLinkPath", ".", "length", "(", ")", "==", "0", ")", "{", "userType", "=", "CURRENT_USER", ";", "}", "if", "(", "allUsersLinkPath", ".", "length", "(", ")", "==", "0", "&&", "currentUserLinkPath", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"linkType", "\"", "+", "linkType", "+", "\"", "is", "invalid.\"", ")", ")", ";", "}", "}", "}", "</s>" ]
10,648
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "public", "class", "SystemErrorException", "extends", "Exception", "{", "private", "int", "errorCode", "=", "0", ";", "public", "SystemErrorException", "(", ")", "{", "super", "(", ")", ";", "}", "public", "SystemErrorException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "public", "SystemErrorException", "(", "int", "errorCode", ",", "String", "message", ")", "{", "super", "(", "message", ")", ";", "this", ".", "errorCode", "=", "errorCode", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "super", ".", "toString", "(", ")", ";", "}", "public", "void", "setErrorCode", "(", "int", "errorCode", ")", "{", "this", ".", "errorCode", "=", "errorCode", ";", "}", "public", "int", "getErrorCode", "(", ")", "{", "return", "errorCode", ";", "}", "}", "</s>" ]
10,649
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "public", "interface", "Unix_ShortcutConstants", "{", "public", "final", "static", "String", "$Comment", "=", "\"$Comment\"", ";", "public", "final", "static", "String", "$$LANG_Comment", "=", "\"\"", ";", "public", "final", "static", "String", "$Encoding", "=", "\"$Encoding\"", ";", "public", "final", "static", "String", "$Exec", "=", "\"$Exec\"", ";", "public", "final", "static", "String", "$Arguments", "=", "\"$Arguments\"", ";", "public", "final", "static", "String", "$GenericName", "=", "\"$GenericName\"", ";", "public", "final", "static", "String", "$$LANG_GenericName", "=", "\"\"", ";", "public", "final", "static", "String", "$MimeType", "=", "\"$MimeType\"", ";", "public", "final", "static", "String", "$Name", "=", "\"$Name\"", ";", "public", "final", "static", "String", "$$LANG_Name", "=", "\"$$LANG_Name\"", ";", "public", "final", "static", "String", "$Path", "=", "\"$Path\"", ";", "public", "final", "static", "String", "$ServiceTypes", "=", "\"\"", ";", "public", "final", "static", "String", "$SwallowExec", "=", "\"$SwallowExec\"", ";", "public", "final", "static", "String", "$SwallowTitle", "=", "\"\"", ";", "public", "final", "static", "String", "$Terminal", "=", "\"$Terminal\"", ";", "public", "final", "static", "String", "$Options_For_Terminal", "=", "\"\"", ";", "public", "final", "static", "String", "$Type", "=", "\"$Type\"", ";", "public", "final", "static", "String", "$X_KDE_SubstituteUID", "=", "\"\"", ";", "public", "final", "static", "String", "$X_KDE_Username", "=", "\"\"", ";", "public", "final", "static", "String", "$Icon", "=", "\"$Icon\"", ";", "public", "final", "static", "String", "$URL", "=", "\"$URL\"", ";", "public", "final", "static", "String", "$E_QUOT", "=", "\"$E_QUOT\"", ";", "public", "final", "static", "String", "$P_QUOT", "=", "\"$P_QUOT\"", ";", "public", "final", "static", "String", "$Categories", "=", "\"$Categories\"", ";", "public", "final", "static", "String", "$TryExec", "=", "\"$TryExec\"", ";", "}", "</s>" ]
10,650
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "os", ";", "import", "com", ".", "coi", ".", "tools", ".", "os", ".", "izpack", ".", "Registry", ";", "import", "com", ".", "coi", ".", "tools", ".", "os", ".", "win", ".", "RegDataContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "NativeLibException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "os", ".", "RegistryHandler", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "substitutor", ".", "VariableSubstitutorImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Librarian", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Properties", ";", "public", "class", "Win_RegistryHandler", "extends", "RegistryHandler", "{", "private", "final", "Librarian", "librarian", ";", "private", "Registry", "registry", ";", "public", "Win_RegistryHandler", "(", "Librarian", "librarian", ")", "{", "this", ".", "librarian", "=", "librarian", ";", "}", "public", "void", "setValue", "(", "String", "key", ",", "String", "value", ",", "String", "contents", ")", "throws", "NativeLibException", "{", "if", "(", "contents", ".", "contains", "(", "\"\"", ")", "&&", "getRegistry", "(", ")", ".", "valueExist", "(", "key", ",", "value", ")", ")", "{", "Object", "ob", "=", "getRegistry", "(", ")", ".", "getValueAsObject", "(", "key", ",", "value", ")", ";", "if", "(", "ob", "instanceof", "String", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", ".", "put", "(", "\"\"", ",", "ob", ")", ";", "VariableSubstitutor", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "props", ")", ";", "try", "{", "contents", "=", "variableSubstitutor", ".", "substitute", "(", "contents", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "getRegistry", "(", ")", ".", "setValue", "(", "key", ",", "value", ",", "contents", ")", ";", "}", "public", "void", "setValue", "(", "String", "key", ",", "String", "value", ",", "String", "[", "]", "contents", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setValue", "(", "key", ",", "value", ",", "contents", ")", ";", "}", "public", "void", "setValue", "(", "String", "key", ",", "String", "value", ",", "byte", "[", "]", "contents", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setValue", "(", "key", ",", "value", ",", "contents", ")", ";", "}", "public", "void", "setValue", "(", "String", "key", ",", "String", "value", ",", "long", "contents", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setValue", "(", "key", ",", "value", ",", "contents", ")", ";", "}", "public", "RegDataContainer", "getValue", "(", "String", "key", ",", "String", "value", ",", "RegDataContainer", "defaultVal", ")", "throws", "NativeLibException", "{", "if", "(", "valueExist", "(", "key", ",", "value", ")", ")", "{", "return", "(", "getValue", "(", "key", ",", "value", ")", ")", ";", "}", "return", "(", "defaultVal", ")", ";", "}", "public", "boolean", "keyExist", "(", "String", "key", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "keyExist", "(", "key", ")", ")", ";", "}", "public", "boolean", "valueExist", "(", "String", "key", ",", "String", "value", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "valueExist", "(", "key", ",", "value", ")", ")", ";", "}", "public", "String", "[", "]", "getSubkeys", "(", "String", "key", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getSubkeys", "(", "key", ")", ")", ";", "}", "public", "String", "[", "]", "getValueNames", "(", "String", "key", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getValueNames", "(", "key", ")", ")", ";", "}", "public", "RegDataContainer", "getValue", "(", "String", "key", ",", "String", "value", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getValue", "(", "key", ",", "value", ")", ")", ";", "}", "public", "void", "createKey", "(", "String", "key", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "createKey", "(", "key", ")", ";", "}", "public", "void", "deleteKey", "(", "String", "key", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "deleteKey", "(", "key", ")", ";", "}", "public", "void", "deleteKeyIfEmpty", "(", "String", "key", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "deleteKeyIfEmpty", "(", "key", ")", ";", "}", "public", "void", "deleteValue", "(", "String", "key", ",", "String", "value", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "deleteValue", "(", "key", ",", "value", ")", ";", "}", "public", "void", "setRoot", "(", "int", "i", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setRoot", "(", "i", ")", ";", "}", "public", "int", "getRoot", "(", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getRoot", "(", ")", ")", ";", "}", "public", "void", "setLogPrevSetValueFlag", "(", "boolean", "flagVal", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setLogPrevSetValueFlag", "(", "flagVal", ")", ";", "}", "public", "boolean", "getLogPrevSetValueFlag", "(", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getLogPrevSetValueFlag", "(", ")", ")", ";", "}", "public", "void", "activateLogging", "(", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "activateLogging", "(", ")", ";", "}", "public", "void", "suspendLogging", "(", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "suspendLogging", "(", ")", ";", "}", "public", "void", "resetLogging", "(", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "resetLogging", "(", ")", ";", "}", "public", "List", "<", "Object", ">", "getLoggingInfo", "(", ")", "throws", "NativeLibException", "{", "return", "(", "getRegistry", "(", ")", ".", "getLoggingInfo", "(", ")", ")", ";", "}", "public", "void", "setLoggingInfo", "(", "List", "info", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "setLoggingInfo", "(", "info", ")", ";", "}", "public", "void", "addLoggingInfo", "(", "List", "info", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "addLoggingInfo", "(", "info", ")", ";", "}", "public", "void", "rewind", "(", ")", "throws", "NativeLibException", "{", "getRegistry", "(", ")", ".", "rewind", "(", ")", ";", "}", "private", "synchronized", "Registry", "getRegistry", "(", ")", "throws", "NativeLibException", "{", "if", "(", "registry", "==", "null", ")", "{", "try", "{", "registry", "=", "new", "Registry", "(", "librarian", ")", ";", "}", "catch", "(", "Throwable", "exception", ")", "{", "throw", "new", "NativeLibException", "(", "\"\"", "+", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "}", "}", "return", "registry", ";", "}", "}", "</s>" ]
10,651
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "util", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Info", ".", "TempDir", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "public", "class", "TemporaryDirectory", "implements", "CleanupClient", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "TemporaryDirectory", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "File", "tempdir", ";", "private", "final", "InstallData", "installData", ";", "private", "final", "TempDir", "tempDirDescription", ";", "private", "boolean", "deleteOnExit", "=", "false", ";", "private", "final", "Housekeeper", "housekeeper", ";", "public", "TemporaryDirectory", "(", "TempDir", "tempDirDescription", ",", "InstallData", "installData", ",", "Housekeeper", "housekeeper", ")", "{", "if", "(", "null", "==", "tempDirDescription", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "if", "(", "null", "==", "installData", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "this", ".", "installData", "=", "installData", ";", "this", ".", "tempDirDescription", "=", "tempDirDescription", ";", "this", ".", "housekeeper", "=", "housekeeper", ";", "}", "public", "void", "create", "(", ")", "throws", "IOException", "{", "try", "{", "tempdir", "=", "File", ".", "createTempFile", "(", "tempDirDescription", ".", "getPrefix", "(", ")", ",", "tempDirDescription", ".", "getSuffix", "(", ")", ")", ";", "tempdir", ".", "delete", "(", ")", ";", "tempdir", ".", "mkdir", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "throw", "e", ";", "}", "installData", ".", "setVariable", "(", "tempDirDescription", ".", "getVariableName", "(", ")", ",", "tempdir", ".", "getAbsolutePath", "(", ")", ")", ";", "housekeeper", ".", "registerForCleanup", "(", "this", ")", ";", "}", "public", "void", "deleteOnExit", "(", ")", "{", "deleteOnExit", "=", "true", ";", "}", "@", "Override", "public", "void", "cleanUp", "(", ")", "{", "if", "(", "null", "!=", "tempdir", ")", "{", "if", "(", "deleteOnExit", ")", "{", "if", "(", "!", "FileUtils", ".", "deleteRecursively", "(", "tempdir", ")", ")", "{", "logger", ".", "warning", "(", "\"\"", "+", "tempdir", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "}", "}", "else", "{", "logger", ".", "warning", "(", "\"\"", "+", "tempdir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "else", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "}", "}", "}", "</s>" ]
10,652
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "junit", ".", "Rule", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "rules", ".", "TemporaryFolder", ";", "import", "org", ".", "junit", ".", "runner", ".", "RunWith", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestConsolePanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "junit", ".", "PicoRunner", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "util", ".", "TestConsole", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "@", "RunWith", "(", "PicoRunner", ".", "class", ")", "@", "Container", "(", "TestConsolePanelContainer", ".", "class", ")", "public", "class", "TargetPanelConsoleTest", "{", "@", "Rule", "public", "TemporaryFolder", "temporaryFolder", "=", "new", "TemporaryFolder", "(", ")", ";", "private", "final", "InstallData", "installData", ";", "private", "final", "TestConsole", "console", ";", "public", "TargetPanelConsoleTest", "(", "InstallData", "installData", ",", "TestConsole", "console", ")", "{", "this", ".", "console", "=", "console", ";", "this", ".", "installData", "=", "installData", ";", "installData", ".", "setInstallPath", "(", "null", ")", ";", "}", "@", "Test", "public", "void", "testRunConsoleIncompatibleInstallation", "(", ")", "throws", "Exception", "{", "File", "root", "=", "temporaryFolder", ".", "getRoot", "(", ")", ";", "File", "badDir", "=", "new", "File", "(", "root", ",", "\"badDir\"", ")", ";", "assertTrue", "(", "badDir", ".", "mkdirs", "(", ")", ")", ";", "File", "goodDir", "=", "new", "File", "(", "root", ",", "\"goodDir\"", ")", ";", "installData", ".", "setDefaultInstallPath", "(", "badDir", ".", "getAbsolutePath", "(", ")", ")", ";", "TargetPanelTestHelper", ".", "createBadInstallationInfo", "(", "badDir", ")", ";", "console", ".", "addScript", "(", "\"\"", ",", "\"n\"", ")", ";", "TargetPanelConsole", "panel", "=", "new", "TargetPanelConsole", "(", ")", ";", "assertFalse", "(", "panel", ".", "runConsole", "(", "installData", ",", "console", ")", ")", ";", "assertTrue", "(", "console", ".", "scriptCompleted", "(", ")", ")", ";", "assertNull", "(", "installData", ".", "getInstallPath", "(", ")", ")", ";", "console", ".", "addScript", "(", "\"\"", ",", "goodDir", ".", "getAbsolutePath", "(", ")", ",", "\"1\"", ")", ";", "assertTrue", "(", "panel", ".", "runConsole", "(", "installData", ",", "console", ")", ")", ";", "assertTrue", "(", "console", ".", "scriptCompleted", "(", ")", ")", ";", "assertEquals", "(", "goodDir", ".", "getAbsolutePath", "(", ")", ",", "installData", ".", "getInstallPath", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "testIncompatibleInstallationFromProperties", "(", ")", "throws", "IOException", "{", "File", "root", "=", "temporaryFolder", ".", "getRoot", "(", ")", ";", "File", "badDir", "=", "new", "File", "(", "root", ",", "\"badDir\"", ")", ";", "assertTrue", "(", "badDir", ".", "mkdirs", "(", ")", ")", ";", "TargetPanelTestHelper", ".", "createBadInstallationInfo", "(", "badDir", ")", ";", "File", "goodDir", "=", "new", "File", "(", "root", ",", "\"goodDir\"", ")", ";", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "setProperty", "(", "InstallData", ".", "INSTALL_PATH", ",", "badDir", ".", "getAbsolutePath", "(", ")", ")", ";", "TargetPanelConsole", "panel", "=", "new", "TargetPanelConsole", "(", ")", ";", "assertFalse", "(", "panel", ".", "runConsoleFromProperties", "(", "installData", ",", "properties", ")", ")", ";", "properties", ".", "setProperty", "(", "InstallData", ".", "INSTALL_PATH", ",", "goodDir", ".", "getAbsolutePath", "(", ")", ")", ";", "assertTrue", "(", "panel", ".", "runConsoleFromProperties", "(", "installData", ",", "properties", ")", ")", ";", "}", "}", "</s>" ]
10,653
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "java", ".", "io", ".", "File", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "FrameFixture", ";", "import", "org", ".", "junit", ".", "Rule", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "rules", ".", "TemporaryFolder", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "GuiId", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "IconsDatabase", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "simplefinish", ".", "SimpleFinishPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "AbstractPanelTest", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestGUIPanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "@", "Container", "(", "TestGUIPanelContainer", ".", "class", ")", "public", "class", "TargetPanelTest", "extends", "AbstractPanelTest", "{", "@", "Rule", "public", "TemporaryFolder", "temporaryFolder", "=", "new", "TemporaryFolder", "(", ")", ";", "public", "TargetPanelTest", "(", "TestGUIPanelContainer", "container", ",", "GUIInstallData", "installData", ",", "ResourceManager", "resourceManager", ",", "ObjectFactory", "factory", ",", "RulesEngine", "rules", ",", "IconsDatabase", "icons", ",", "UninstallDataWriter", "uninstallDataWriter", ")", "{", "super", "(", "container", ",", "installData", ",", "resourceManager", ",", "factory", ",", "rules", ",", "icons", ",", "uninstallDataWriter", ")", ";", "}", "@", "Test", "public", "void", "testIncompatibleInstallation", "(", ")", "throws", "Exception", "{", "GUIInstallData", "installData", "=", "getInstallData", "(", ")", ";", "String", "expectedMessage", "=", "TargetPanelTestHelper", ".", "getIncompatibleInstallationMessage", "(", "installData", ")", ";", "File", "root", "=", "temporaryFolder", ".", "getRoot", "(", ")", ";", "File", "badDir", "=", "new", "File", "(", "root", ",", "\"badDir\"", ")", ";", "assertTrue", "(", "badDir", ".", "mkdirs", "(", ")", ")", ";", "File", "goodDir", "=", "new", "File", "(", "root", ",", "\"goodDir\"", ")", ";", "installData", ".", "setDefaultInstallPath", "(", "badDir", ".", "getAbsolutePath", "(", ")", ")", ";", "TargetPanelTestHelper", ".", "createBadInstallationInfo", "(", "badDir", ")", ";", "FrameFixture", "fixture", "=", "show", "(", "TargetPanel", ".", "class", ",", "SimpleFinishPanel", ".", "class", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "TargetPanel", ")", ";", "TargetPanel", "panel", "=", "(", "TargetPanel", ")", "getPanels", "(", ")", ".", "getView", "(", ")", ";", "fixture", ".", "button", "(", "GuiId", ".", "BUTTON_NEXT", ".", "id", ")", ".", "click", "(", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertEquals", "(", "panel", ",", "getPanels", "(", ")", ".", "getView", "(", ")", ")", ";", "fixture", ".", "optionPane", "(", ")", ".", "requireErrorMessage", "(", ")", ".", "requireMessage", "(", "expectedMessage", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "fixture", ".", "optionPane", "(", ")", ".", "okButton", "(", ")", ".", "click", "(", ")", ";", "assertEquals", "(", "panel", ",", "getPanels", "(", ")", ".", "getView", "(", ")", ")", ";", "fixture", ".", "textBox", "(", ")", ".", "setText", "(", "goodDir", ".", "getAbsolutePath", "(", ")", ")", ";", "installData", ".", "setVariable", "(", "\"\"", ",", "\"false\"", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "fixture", ".", "button", "(", "GuiId", ".", "BUTTON_NEXT", ".", "id", ")", ".", "click", "(", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "SimpleFinishPanel", ")", ";", "}", "}", "</s>" ]
10,654
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "ObjectOutputStream", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "AutomatedInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Pack", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "data", ".", "DefaultVariables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platforms", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "public", "class", "TargetPanelHelperTest", "{", "@", "Test", "public", "void", "testGetPath", "(", ")", "{", "Variables", "variables", "=", "new", "DefaultVariables", "(", ")", ";", "InstallData", "installData", "=", "new", "AutomatedInstallData", "(", "variables", ",", "Platforms", ".", "WINDOWS_7", ")", ";", "assertNull", "(", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"userdir\"", ")", ";", "assertEquals", "(", "\"userdir\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"default\"", ")", ";", "assertEquals", "(", "\"default\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"override\"", ")", ";", "assertEquals", "(", "\"override\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "}", "@", "Test", "public", "void", "testGetPathForWindows", "(", ")", "{", "Variables", "variables", "=", "new", "DefaultVariables", "(", ")", ";", "InstallData", "installData", "=", "new", "AutomatedInstallData", "(", "variables", ",", "Platforms", ".", "WINDOWS_7", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"userdir\"", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"default\"", ")", ";", "assertEquals", "(", "\"default\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"1\"", ")", ";", "assertEquals", "(", "\"1\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"2\"", ")", ";", "assertEquals", "(", "\"2\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "}", "@", "Test", "public", "void", "testGetPathForMac", "(", ")", "{", "Variables", "variables", "=", "new", "DefaultVariables", "(", ")", ";", "InstallData", "installData", "=", "new", "AutomatedInstallData", "(", "variables", ",", "Platforms", ".", "MAC_OSX", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"userdir\"", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"default\"", ")", ";", "assertEquals", "(", "\"default\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"1\"", ")", ";", "assertEquals", "(", "\"1\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"2\"", ")", ";", "assertEquals", "(", "\"2\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"3\"", ")", ";", "assertEquals", "(", "\"3\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "}", "@", "Test", "public", "void", "testGetPathForFedora", "(", ")", "{", "Variables", "variables", "=", "new", "DefaultVariables", "(", ")", ";", "InstallData", "installData", "=", "new", "AutomatedInstallData", "(", "variables", ",", "Platforms", ".", "FEDORA_LINUX", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"userdir\"", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"default\"", ")", ";", "assertEquals", "(", "\"default\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"1\"", ")", ";", "assertEquals", "(", "\"1\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"2\"", ")", ";", "assertEquals", "(", "\"2\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "variables", ".", "set", "(", "\"\"", ",", "\"3\"", ")", ";", "assertEquals", "(", "\"3\"", ",", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ")", ";", "}", "@", "Test", "public", "void", "testIsIncompatibleInstallation", "(", ")", "throws", "IOException", "{", "File", "dir", "=", "File", ".", "createTempFile", "(", "\"junit\"", ",", "\"\"", ")", ";", "FileUtils", ".", "delete", "(", "dir", ")", ";", "assertFalse", "(", "dir", ".", "exists", "(", ")", ")", ";", "assertFalse", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "dir", ".", "getPath", "(", ")", ")", ")", ";", "assertTrue", "(", "dir", ".", "mkdir", "(", ")", ")", ";", "assertFalse", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "dir", ".", "getPath", "(", ")", ")", ")", ";", "File", "file", "=", "new", "File", "(", "dir", ",", "InstallData", ".", "INSTALLATION_INFORMATION", ")", ";", "FileOutputStream", "stream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "ObjectOutputStream", "objStream", "=", "new", "ObjectOutputStream", "(", "stream", ")", ";", "objStream", ".", "writeObject", "(", "new", "ArrayList", "<", "Pack", ">", "(", ")", ")", ";", "objStream", ".", "close", "(", ")", ";", "assertFalse", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "dir", ".", "getPath", "(", ")", ")", ")", ";", "assertTrue", "(", "file", ".", "delete", "(", ")", ")", ";", "stream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "objStream", "=", "new", "ObjectOutputStream", "(", "stream", ")", ";", "objStream", ".", "writeObject", "(", "new", "Integer", "(", "1", ")", ")", ";", "objStream", ".", "close", "(", ")", ";", "assertTrue", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "dir", ".", "getPath", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
10,655
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNotNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "ObjectOutputStream", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "class", "TargetPanelTestHelper", "{", "public", "static", "void", "createBadInstallationInfo", "(", "File", "dir", ")", "throws", "IOException", "{", "File", "info", "=", "new", "File", "(", "dir", ",", "InstallData", ".", "INSTALLATION_INFORMATION", ")", ";", "ObjectOutputStream", "stream", "=", "new", "ObjectOutputStream", "(", "new", "FileOutputStream", "(", "info", ")", ")", ";", "stream", ".", "writeBoolean", "(", "false", ")", ";", "stream", ".", "close", "(", ")", ";", "}", "public", "static", "String", "getIncompatibleInstallationMessage", "(", "InstallData", "installData", ")", "{", "String", "messageId", "=", "\"\"", ";", "String", "result", "=", "installData", ".", "getMessages", "(", ")", ".", "get", "(", "messageId", ")", ";", "assertNotNull", "(", "result", ")", ";", "assertTrue", "(", "!", "messageId", ".", "equals", "(", "result", ")", ")", ";", "return", "result", ";", "}", "}", "</s>" ]
10,656
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "junit", ".", "Rule", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "rules", ".", "TemporaryFolder", ";", "import", "org", ".", "junit", ".", "runner", ".", "RunWith", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "impl", ".", "XMLElementImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestConsolePanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "junit", ".", "PicoRunner", ";", "@", "RunWith", "(", "PicoRunner", ".", "class", ")", "@", "Container", "(", "TestConsolePanelContainer", ".", "class", ")", "public", "class", "TargetPanelAutomationTest", "{", "@", "Rule", "public", "TemporaryFolder", "temporaryFolder", "=", "new", "TemporaryFolder", "(", ")", ";", "private", "final", "InstallData", "installData", ";", "public", "TargetPanelAutomationTest", "(", "InstallData", "installData", ")", "{", "this", ".", "installData", "=", "installData", ";", "}", "@", "Test", "public", "void", "testIncompatibleInstallation", "(", ")", "throws", "IOException", "{", "File", "root", "=", "temporaryFolder", ".", "getRoot", "(", ")", ";", "File", "badDir", "=", "new", "File", "(", "root", ",", "\"badDir\"", ")", ";", "assertTrue", "(", "badDir", ".", "mkdirs", "(", ")", ")", ";", "File", "goodDir", "=", "new", "File", "(", "root", ",", "\"goodDir\"", ")", ";", "String", "expectedMessage", "=", "TargetPanelTestHelper", ".", "getIncompatibleInstallationMessage", "(", "installData", ")", ";", "TargetPanelAutomation", "panel", "=", "new", "TargetPanelAutomation", "(", ")", ";", "IXMLElement", "badPath", "=", "createElement", "(", "badDir", ")", ";", "try", "{", "TargetPanelTestHelper", ".", "createBadInstallationInfo", "(", "badDir", ")", ";", "panel", ".", "runAutomated", "(", "installData", ",", "badPath", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "InstallerException", "expected", ")", "{", "assertEquals", "(", "expectedMessage", ",", "expected", ".", "getMessage", "(", ")", ")", ";", "}", "IXMLElement", "goodPath", "=", "createElement", "(", "goodDir", ")", ";", "panel", ".", "runAutomated", "(", "installData", ",", "goodPath", ")", ";", "assertEquals", "(", "goodDir", ".", "getAbsolutePath", "(", ")", ",", "installData", ".", "getInstallPath", "(", ")", ")", ";", "}", "private", "IXMLElement", "createElement", "(", "File", "dir", ")", "{", "IXMLElement", "element", "=", "new", "XMLElementImpl", "(", "\"foo\"", ")", ";", "XMLElementImpl", "path", "=", "new", "XMLElementImpl", "(", "\"installpath\"", ",", "element", ")", ";", "path", ".", "setContent", "(", "dir", ".", "getAbsolutePath", "(", ")", ")", ";", "element", ".", "addChild", "(", "path", ")", ";", "return", "element", ";", "}", "}", "</s>" ]
10,657
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "java", ".", "awt", ".", "Toolkit", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "mockito", ".", "Mockito", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "data", ".", "DefaultVariables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platforms", ";", "public", "class", "RuleInputFieldTest", "{", "@", "Test", "public", "void", "testIPAddressRuleInputField", "(", ")", "{", "String", "layout", "=", "\"\"", ";", "String", "set", "=", "\"\"", ";", "String", "separator", "=", "null", ";", "String", "validator", "=", "null", ";", "String", "processor", "=", "null", ";", "Toolkit", "toolkit", "=", "Mockito", ".", "mock", "(", "Toolkit", ".", "class", ")", ";", "GUIInstallData", "installData", "=", "new", "GUIInstallData", "(", "new", "DefaultVariables", "(", ")", ",", "Platforms", ".", "HP_UX", ")", ";", "RuleInputField", "field", "=", "new", "RuleInputField", "(", "layout", ",", "set", ",", "separator", ",", "validator", ",", "processor", ",", "RuleInputField", ".", "DISPLAY_FORMAT", ",", "toolkit", ",", "installData", ")", ";", "assertEquals", "(", "4", ",", "field", ".", "getNumFields", "(", ")", ")", ";", "assertEquals", "(", "\"192.168.0.1\"", ",", "field", ".", "getText", "(", ")", ")", ";", "assertEquals", "(", "\"192\"", ",", "field", ".", "getFieldContents", "(", "0", ")", ")", ";", "assertEquals", "(", "\"168\"", ",", "field", ".", "getFieldContents", "(", "1", ")", ")", ";", "assertEquals", "(", "\"0\"", ",", "field", ".", "getFieldContents", "(", "2", ")", ")", ";", "assertEquals", "(", "\"1\"", ",", "field", ".", "getFieldContents", "(", "3", ")", ")", ";", "}", "}", "</s>" ]
10,658
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "StringTool", ";", "import", "junit", ".", "framework", ".", "Assert", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "StringToolTest", "extends", "TestCase", "{", "public", "void", "testReplace", "(", ")", "{", "String", "ref", "=", "\"ABC-012-def\"", ";", "Assert", ".", "assertEquals", "(", "null", ",", "StringTool", ".", "replace", "(", "null", ",", "null", ",", "null", ")", ")", ";", "assertEquals", "(", "\"ABC-012-def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "null", ",", "null", ")", ")", ";", "assertEquals", "(", "\"ABC-012-def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "\"something\"", ",", "null", ")", ")", ";", "assertEquals", "(", "\"ABC012def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "\"-\"", ",", "null", ")", ")", ";", "assertEquals", "(", "\"abc-012-def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "\"ABC\"", ",", "\"abc\"", ")", ")", ";", "assertEquals", "(", "\"ABC-012-def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "\"abc\"", ",", "\"abc\"", ",", "false", ")", ")", ";", "assertEquals", "(", "\"ABC-012-def\"", ",", "StringTool", ".", "replace", "(", "ref", ",", "\"abc\"", ",", "\"abc\"", ",", "true", ")", ")", ";", "}", "public", "void", "testNormalizePath", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "StringTool", ".", "normalizePath", "(", "\"\"", ",", "\"\\\\\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "StringTool", ".", "normalizePath", "(", "\"\"", ",", "\"/\"", ")", ")", ";", "}", "}", "</s>" ]
10,659
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "ServerSocket", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "junit", ".", "Ignore", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processor", ".", "PortProcessor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "junit", ".", "framework", ".", "Assert", ";", "@", "Ignore", "public", "class", "PortProcessorTest", "{", "@", "Test", "public", "void", "testProcessGenericBoundPort", "(", ")", "throws", "IOException", "{", "ServerSocket", "use", "=", "new", "ServerSocket", "(", "0", ")", ";", "int", "usedPort", "=", "use", ".", "getLocalPort", "(", ")", ";", "ProcessingClient", "pc", "=", "new", "ProcessingClientStub", "(", "usedPort", ")", ";", "PortProcessor", "pp", "=", "new", "PortProcessor", "(", ")", ";", "String", "result", "=", "pp", ".", "process", "(", "pc", ")", ";", "Assert", ".", "assertTrue", "(", "(", "Integer", ".", "toString", "(", "usedPort", ")", ")", ".", "equals", "(", "result", ")", ")", ";", "try", "{", "use", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "}", "@", "Test", "public", "void", "testProcessSpecificBoundPort", "(", ")", "throws", "IOException", "{", "ServerSocket", "use", "=", "new", "ServerSocket", "(", "0", ",", "0", ",", "InetAddress", ".", "getByName", "(", "\"localhost\"", ")", ")", ";", "int", "usedPort", "=", "use", ".", "getLocalPort", "(", ")", ";", "ProcessingClient", "pc", "=", "new", "ProcessingClientStub", "(", "\"localhost\"", ",", "usedPort", ")", ";", "PortProcessor", "pp", "=", "new", "PortProcessor", "(", ")", ";", "String", "result", "=", "pp", ".", "process", "(", "pc", ")", ";", "System", ".", "out", ".", "println", "(", "result", ")", ";", "Assert", ".", "assertFalse", "(", "(", "\"localhost*\"", "+", "Integer", ".", "toString", "(", "usedPort", ")", ")", ".", "equals", "(", "result", ")", ")", ";", "try", "{", "use", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "}", "@", "Test", "public", "void", "testProcessGenericOnGenericBoundPortIPv6", "(", ")", "throws", "IOException", "{", "ServerSocket", "use", "=", "new", "ServerSocket", "(", "0", ",", "0", ",", "InetAddress", ".", "getByName", "(", "\"::\"", ")", ")", ";", "int", "usedPort", "=", "use", ".", "getLocalPort", "(", ")", ";", "ProcessingClient", "pc", "=", "new", "ProcessingClientStub", "(", "\"::\"", ",", "usedPort", ")", ";", "PortProcessor", "pp", "=", "new", "PortProcessor", "(", ")", ";", "String", "result", "=", "pp", ".", "process", "(", "pc", ")", ";", "Assert", ".", "assertFalse", "(", "(", "\"::*\"", "+", "Integer", ".", "toString", "(", "usedPort", ")", ")", ".", "equals", "(", "result", ")", ")", ";", "try", "{", "use", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "}", "@", "Test", "public", "void", "testProcessGenericOnGenericBoundPortIPv4", "(", ")", "throws", "IOException", "{", "ServerSocket", "use", "=", "new", "ServerSocket", "(", "0", ",", "0", ",", "InetAddress", ".", "getByName", "(", "\"0.0.0.0\"", ")", ")", ";", "int", "usedPort", "=", "use", ".", "getLocalPort", "(", ")", ";", "ProcessingClient", "pc", "=", "new", "ProcessingClientStub", "(", "\"0.0.0.0\"", ",", "usedPort", ")", ";", "PortProcessor", "pp", "=", "new", "PortProcessor", "(", ")", ";", "String", "result", "=", "pp", ".", "process", "(", "pc", ")", ";", "Assert", ".", "assertFalse", "(", "(", "\"0.0.0.0*\"", "+", "Integer", ".", "toString", "(", "usedPort", ")", ")", ".", "equals", "(", "result", ")", ")", ";", "try", "{", "use", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "}", "@", "Test", "public", "void", "testProcessSpecificOnGenericBoundPortIPv4", "(", ")", "throws", "IOException", "{", "ServerSocket", "use", "=", "new", "ServerSocket", "(", "0", ",", "0", ",", "InetAddress", ".", "getByName", "(", "\"0.0.0.0\"", ")", ")", ";", "int", "usedPort", "=", "use", ".", "getLocalPort", "(", ")", ";", "ProcessingClient", "pc", "=", "new", "ProcessingClientStub", "(", "\"127.0.0.1\"", ",", "usedPort", ")", ";", "PortProcessor", "pp", "=", "new", "PortProcessor", "(", ")", ";", "String", "result", "=", "pp", ".", "process", "(", "pc", ")", ";", "Assert", ".", "assertEquals", "(", "\"127.0.0.1*\"", "+", "Integer", ".", "toString", "(", "usedPort", ")", ",", "result", ")", ";", "try", "{", "use", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "}", "class", "ProcessingClientStub", "implements", "ProcessingClient", "{", "String", "[", "]", "fields", ";", "public", "ProcessingClientStub", "(", "String", "host", ",", "int", "port", ")", "{", "fields", "=", "new", "String", "[", "2", "]", ";", "fields", "[", "0", "]", "=", "host", ";", "fields", "[", "1", "]", "=", "Integer", ".", "toString", "(", "port", ")", ";", "}", "public", "ProcessingClientStub", "(", "int", "port", ")", "{", "fields", "=", "new", "String", "[", "1", "]", ";", "fields", "[", "0", "]", "=", "Integer", ".", "toString", "(", "port", ")", ";", "}", "public", "String", "getFieldContents", "(", "int", "index", ")", "{", "if", "(", "index", "<", "fields", ".", "length", ")", "{", "return", "fields", "[", "index", "]", ";", "}", "else", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}", "public", "int", "getNumFields", "(", ")", "{", "return", "fields", ".", "length", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "null", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "null", ";", "}", "public", "boolean", "hasParams", "(", ")", "{", "return", "false", ";", "}", "}", "}", "</s>" ]
10,660
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "process", ";", "import", "static", "org", ".", "hamcrest", ".", "MatcherAssert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertArrayEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "javax", ".", "swing", ".", "LookAndFeel", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "DialogFixture", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "FrameFixture", ";", "import", "org", ".", "hamcrest", ".", "text", ".", "StringContains", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "jvnet", ".", "substance", ".", "skin", ".", "SubstanceBusinessLookAndFeel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "GuiId", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "IconsDatabase", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "simplefinish", ".", "SimpleFinishPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "AbstractPanelTest", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestGUIPanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "@", "Container", "(", "TestGUIPanelContainer", ".", "class", ")", "public", "class", "ProcessPanelTest", "extends", "AbstractPanelTest", "{", "private", "LookAndFeel", "lookAndFeel", ";", "public", "ProcessPanelTest", "(", "TestGUIPanelContainer", "container", ",", "GUIInstallData", "installData", ",", "ResourceManager", "resourceManager", ",", "ObjectFactory", "factory", ",", "RulesEngine", "rules", ",", "IconsDatabase", "icons", ",", "UninstallDataWriter", "uninstallDataWriter", ")", "{", "super", "(", "container", ",", "installData", ",", "resourceManager", ",", "factory", ",", "rules", ",", "icons", ",", "uninstallDataWriter", ")", ";", "}", "@", "Before", "public", "void", "setUp", "(", ")", "{", "lookAndFeel", "=", "UIManager", ".", "getLookAndFeel", "(", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "throws", "Exception", "{", "super", ".", "tearDown", "(", ")", ";", "UIManager", ".", "setLookAndFeel", "(", "lookAndFeel", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClass", "(", ")", "throws", "Exception", "{", "getResourceManager", "(", ")", ".", "setResourceBasePath", "(", "\"\"", ")", ";", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setReturn", "(", "true", ")", ";", "FrameFixture", "fixture", "=", "show", "(", "ProcessPanel", ".", "class", ",", "SimpleFinishPanel", ".", "class", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "ProcessPanel", ")", ";", "fixture", ".", "button", "(", "GuiId", ".", "BUTTON_NEXT", ".", "id", ")", ".", "click", "(", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "SimpleFinishPanel", ")", ";", "assertEquals", "(", "2", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "1", ")", ",", "new", "String", "[", "]", "{", "\"run1\"", ",", "\"somearg\"", "}", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClassException", "(", ")", "throws", "Exception", "{", "SubstanceBusinessLookAndFeel", "lookAndFeel", "=", "new", "SubstanceBusinessLookAndFeel", "(", ")", ";", "if", "(", "lookAndFeel", ".", "isSupportedLookAndFeel", "(", ")", ")", "{", "UIManager", ".", "setLookAndFeel", "(", "lookAndFeel", ")", ";", "}", "getResourceManager", "(", ")", ".", "setResourceBasePath", "(", "\"\"", ")", ";", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setException", "(", "true", ")", ";", "FrameFixture", "fixture", "=", "show", "(", "ProcessPanel", ".", "class", ",", "SimpleFinishPanel", ".", "class", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "ProcessPanel", ")", ";", "DialogFixture", "dialogFixture", "=", "fixture", ".", "dialog", "(", ")", ";", "dialogFixture", ".", "requireVisible", "(", ")", ";", "assertThat", "(", "dialogFixture", ".", "label", "(", "\"\"", ")", ".", "text", "(", ")", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "dialogFixture", ".", "button", "(", ")", ".", "click", "(", ")", ";", "Thread", ".", "sleep", "(", "2000", ")", ";", "fixture", ".", "button", "(", "GuiId", ".", "BUTTON_NEXT", ".", "id", ")", ".", "requireDisabled", "(", ")", ";", "assertTrue", "(", "getPanels", "(", ")", ".", "getView", "(", ")", "instanceof", "ProcessPanel", ")", ";", "assertEquals", "(", "1", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "}", "}", "</s>" ]
10,661
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "process", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "Executable", "{", "private", "static", "boolean", "result", "=", "false", ";", "private", "static", "boolean", "exception", "=", "false", ";", "private", "static", "int", "invocations", "=", "0", ";", "private", "static", "Map", "<", "Integer", ",", "String", "[", "]", ">", "args", "=", "new", "HashMap", "<", "Integer", ",", "String", "[", "]", ">", "(", ")", ";", "public", "static", "void", "init", "(", ")", "{", "result", "=", "false", ";", "exception", "=", "false", ";", "invocations", "=", "0", ";", "args", ".", "clear", "(", ")", ";", "}", "public", "static", "void", "setReturn", "(", "boolean", "result", ")", "{", "Executable", ".", "result", "=", "result", ";", "}", "public", "static", "void", "setException", "(", "boolean", "exception", ")", "{", "Executable", ".", "exception", "=", "exception", ";", "}", "public", "static", "int", "getInvocations", "(", ")", "{", "return", "invocations", ";", "}", "public", "static", "String", "[", "]", "getArgs", "(", "int", "invocation", ")", "{", "return", "args", ".", "get", "(", "invocation", ")", ";", "}", "public", "boolean", "run", "(", "AbstractUIProcessHandler", "handler", ",", "String", "...", "args", ")", "{", "Executable", ".", "args", ".", "put", "(", "invocations", ",", "args", ")", ";", "++", "invocations", ";", "if", "(", "exception", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,662
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "process", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertArrayEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "runner", ".", "RunWith", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "impl", ".", "XMLElementImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestConsolePanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "junit", ".", "PicoRunner", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "@", "RunWith", "(", "PicoRunner", ".", "class", ")", "@", "Container", "(", "TestConsolePanelContainer", ".", "class", ")", "public", "class", "ProcessPanelAutomationTest", "{", "private", "final", "InstallData", "installData", ";", "private", "final", "RulesEngine", "rules", ";", "private", "final", "ResourceManager", "resources", ";", "private", "final", "PlatformModelMatcher", "matcher", ";", "public", "ProcessPanelAutomationTest", "(", "InstallData", "installData", ",", "RulesEngine", "rules", ",", "ResourceManager", "resources", ",", "PlatformModelMatcher", "matcher", ")", "{", "this", ".", "installData", "=", "installData", ";", "this", ".", "rules", "=", "rules", ";", "this", ".", "resources", "=", "resources", ";", "this", ".", "matcher", "=", "matcher", ";", "resources", ".", "setResourceBasePath", "(", "\"\"", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClass", "(", ")", "{", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setReturn", "(", "true", ")", ";", "ProcessPanelAutomation", "panel", "=", "new", "ProcessPanelAutomation", "(", "installData", ",", "rules", ",", "resources", ",", "matcher", ")", ";", "panel", ".", "runAutomated", "(", "installData", ",", "new", "XMLElementImpl", "(", "\"root\"", ")", ")", ";", "assertEquals", "(", "2", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "1", ")", ",", "new", "String", "[", "]", "{", "\"run1\"", ",", "\"somearg\"", "}", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClassException", "(", ")", "throws", "Exception", "{", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setException", "(", "true", ")", ";", "ProcessPanelAutomation", "panel", "=", "new", "ProcessPanelAutomation", "(", "installData", ",", "rules", ",", "resources", ",", "matcher", ")", ";", "try", "{", "panel", ".", "runAutomated", "(", "installData", ",", "new", "XMLElementImpl", "(", "\"root\"", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "InstallerException", "expected", ")", "{", "}", "assertEquals", "(", "1", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "}", "}", "</s>" ]
10,663
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "process", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertArrayEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "runner", ".", "RunWith", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "handler", ".", "Prompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestConsolePanelContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "junit", ".", "PicoRunner", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "util", ".", "TestConsole", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "@", "RunWith", "(", "PicoRunner", ".", "class", ")", "@", "Container", "(", "TestConsolePanelContainer", ".", "class", ")", "public", "class", "ProcessPanelConsoleTest", "{", "private", "final", "InstallData", "installData", ";", "private", "final", "RulesEngine", "rules", ";", "private", "final", "ResourceManager", "resources", ";", "private", "final", "Prompt", "prompt", ";", "private", "final", "PlatformModelMatcher", "matcher", ";", "private", "final", "TestConsole", "console", ";", "public", "ProcessPanelConsoleTest", "(", "InstallData", "installData", ",", "RulesEngine", "rules", ",", "ResourceManager", "resources", ",", "Prompt", "prompt", ",", "PlatformModelMatcher", "matcher", ",", "TestConsole", "console", ")", "{", "this", ".", "installData", "=", "installData", ";", "this", ".", "rules", "=", "rules", ";", "this", ".", "resources", "=", "resources", ";", "this", ".", "prompt", "=", "prompt", ";", "this", ".", "matcher", "=", "matcher", ";", "this", ".", "console", "=", "console", ";", "resources", ".", "setResourceBasePath", "(", "\"\"", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClass", "(", ")", "{", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setReturn", "(", "true", ")", ";", "ProcessPanelConsole", "panel", "=", "new", "ProcessPanelConsole", "(", "rules", ",", "resources", ",", "prompt", ",", "matcher", ")", ";", "assertTrue", "(", "panel", ".", "runConsole", "(", "installData", ",", "console", ")", ")", ";", "assertEquals", "(", "2", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "1", ")", ",", "new", "String", "[", "]", "{", "\"run1\"", ",", "\"somearg\"", "}", ")", ";", "}", "@", "Test", "public", "void", "testExecuteClassException", "(", ")", "throws", "Exception", "{", "Executable", ".", "init", "(", ")", ";", "Executable", ".", "setException", "(", "true", ")", ";", "ProcessPanelConsole", "panel", "=", "new", "ProcessPanelConsole", "(", "rules", ",", "resources", ",", "prompt", ",", "matcher", ")", ";", "assertFalse", "(", "panel", ".", "runConsole", "(", "installData", ",", "console", ")", ")", ";", "assertEquals", "(", "3", ",", "console", ".", "getOutput", "(", ")", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "console", ".", "getOutput", "(", ")", ".", "get", "(", "2", ")", ".", "equals", "(", "\"\"", ")", ")", ";", "assertEquals", "(", "1", ",", "Executable", ".", "getInvocations", "(", ")", ")", ";", "assertArrayEquals", "(", "Executable", ".", "getArgs", "(", "0", ")", ",", "new", "String", "[", "]", "{", "\"run0\"", "}", ")", ";", "}", "}", "</s>" ]
10,664
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ";", "import", "static", "org", ".", "hamcrest", ".", "MatcherAssert", ".", "assertThat", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "DialogFixture", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "FrameFixture", ";", "import", "org", ".", "hamcrest", ".", "text", ".", "StringContains", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "mockito", ".", "Mockito", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "GuiId", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "binding", ".", "Help", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "IconsDatabase", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanelView", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "finish", ".", "FinishPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "hello", ".", "HelloPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "htmlinfo", ".", "HTMLInfoPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "licence", ".", "LicencePanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "simplefinish", ".", "SimpleFinishPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "AbstractPanelTest", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ".", "TestGUIPanelContainer", ";", "public", "class", "PanelDisplayTest", "extends", "AbstractPanelTest", "{", "public", "PanelDisplayTest", "(", "GUIInstallData", "guiInstallData", ",", "ResourceManager", "resourceManager", ",", "UninstallDataWriter", "uninstallDataWriter", ",", "TestGUIPanelContainer", "container", ",", "IconsDatabase", "icons", ",", "RulesEngine", "rules", ",", "ObjectFactory", "factory", ")", "{", "super", "(", "container", ",", "guiInstallData", ",", "resourceManager", ",", "factory", ",", "rules", ",", "icons", ",", "uninstallDataWriter", ")", ";", "}", "@", "Before", "public", "void", "setUp", "(", ")", "{", "getResourceManager", "(", ")", ".", "setResourceBasePath", "(", "\"\"", ")", ";", "}", "@", "Test", "public", "void", "htmlInfoPanelShouldDisplayText", "(", ")", "throws", "Exception", "{", "FrameFixture", "frameFixture", "=", "show", "(", "HTMLInfoPanel", ".", "class", ")", ";", "String", "textArea", "=", "frameFixture", ".", "textBox", "(", "GuiId", ".", "HTML_INFO_PANEL_TEXT", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "textArea", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "licencePanelShouldDisplayText", "(", ")", "throws", "Exception", "{", "FrameFixture", "frameFixture", "=", "show", "(", "LicencePanel", ".", "class", ",", "HTMLInfoPanel", ".", "class", ")", ";", "String", "textArea", "=", "frameFixture", ".", "textBox", "(", "GuiId", ".", "LICENCE_TEXT_AREA", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "textArea", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "simpleFinishPanelShouldDisplayFinishingText", "(", ")", "throws", "Exception", "{", "FrameFixture", "frameFixture", "=", "show", "(", "SimpleFinishPanel", ".", "class", ")", ";", "String", "text", "=", "frameFixture", ".", "label", "(", "GuiId", ".", "SIMPLE_FINISH_LABEL", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "text", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "helloThenFinishPanelShouldDisplay", "(", ")", "throws", "Exception", "{", "UninstallDataWriter", "uninstallDataWriter", "=", "getUninstallDataWriter", "(", ")", ";", "Mockito", ".", "when", "(", "uninstallDataWriter", ".", "isUninstallRequired", "(", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "FrameFixture", "frameFixture", "=", "show", "(", "HelloPanel", ".", "class", ",", "SimpleFinishPanel", ".", "class", ")", ";", "String", "welcomeLabel", "=", "frameFixture", ".", "label", "(", "GuiId", ".", "HELLO_PANEL_LABEL", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "welcomeLabel", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "frameFixture", ".", "button", "(", "GuiId", ".", "BUTTON_NEXT", ".", "id", ")", ".", "click", "(", ")", ";", "String", "uninstallLabel", "=", "frameFixture", ".", "label", "(", "GuiId", ".", "SIMPLE_FINISH_UNINSTALL_LABEL", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "uninstallLabel", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "finishPanelShouldDisplay", "(", ")", "throws", "Exception", "{", "FrameFixture", "frameFixture", "=", "show", "(", "FinishPanel", ".", "class", ")", ";", "String", "text", "=", "frameFixture", ".", "label", "(", "GuiId", ".", "FINISH_PANEL_LABEL", ".", "id", ")", ".", "text", "(", ")", ";", "assertThat", "(", "text", ",", "StringContains", ".", "containsString", "(", "\"\"", ")", ")", ";", "frameFixture", ".", "button", "(", "GuiId", ".", "FINISH_PANEL_AUTO_BUTTON", ".", "id", ")", ".", "requireVisible", "(", ")", ";", "}", "@", "Test", "public", "void", "helpShouldDisplay", "(", ")", "throws", "Exception", "{", "Panel", "panel", "=", "new", "Panel", "(", ")", ";", "panel", ".", "setClassName", "(", "HelloPanel", ".", "class", ".", "getName", "(", ")", ")", ";", "panel", ".", "setHelps", "(", "Arrays", ".", "asList", "(", "new", "Help", "(", "\"eng\"", ",", "\"un.html\"", ")", ")", ")", ";", "IzPanelView", "panelView", "=", "createPanelView", "(", "panel", ")", ";", "FrameFixture", "frameFixture", "=", "show", "(", "Collections", ".", "singletonList", "(", "panelView", ")", ")", ";", "frameFixture", ".", "button", "(", "GuiId", ".", "BUTTON_HELP", ".", "id", ")", ".", "requireVisible", "(", ")", ";", "frameFixture", ".", "button", "(", "GuiId", ".", "BUTTON_HELP", ".", "id", ")", ".", "click", "(", ")", ";", "DialogFixture", "dialogFixture", "=", "frameFixture", ".", "dialog", "(", "GuiId", ".", "HELP_WINDOWS", ".", "id", ")", ";", "dialogFixture", ".", "requireVisible", "(", ")", ";", "assertThat", "(", "dialogFixture", ".", "textBox", "(", ")", ".", "text", "(", ")", ",", "StringContains", ".", "containsString", "(", "\"toto\"", ")", ")", ";", "}", "}", "</s>" ]
10,665
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "org", ".", "mockito", ".", "Mockito", ";", "import", "org", ".", "picocontainer", ".", "MutablePicoContainer", ";", "import", "org", ".", "picocontainer", ".", "PicoException", ";", "import", "org", ".", "picocontainer", ".", "injectors", ".", "ProviderAdapter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "container", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Variables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ContainerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "container", ".", "AbstractContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "container", ".", "PlatformProvider", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "data", ".", "DefaultVariables", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "factory", ".", "DefaultObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "rules", ".", "ConditionContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "automation", ".", "AutomatedInstaller", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "container", ".", "provider", ".", "RulesProvider", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "unpacker", ".", "IUnpacker", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "PlatformModelMatcher", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platforms", ";", "public", "abstract", "class", "AbstractTestPanelContainer", "extends", "AbstractContainer", "{", "@", "Override", "public", "MutablePicoContainer", "getContainer", "(", ")", "{", "return", "super", ".", "getContainer", "(", ")", ";", "}", "@", "Override", "protected", "void", "fillContainer", "(", "MutablePicoContainer", "container", ")", "{", "Properties", "properties", "=", "System", ".", "getProperties", "(", ")", ";", "addComponent", "(", "properties", ",", "properties", ")", ";", "addComponent", "(", "Variables", ".", "class", ",", "DefaultVariables", ".", "class", ")", ";", "addComponent", "(", "ResourceManager", ".", "class", ")", ";", "addComponent", "(", "UninstallData", ".", "class", ")", ";", "addComponent", "(", "ConditionContainer", ".", "class", ")", ";", "addComponent", "(", "UninstallDataWriter", ".", "class", ",", "Mockito", ".", "mock", "(", "UninstallDataWriter", ".", "class", ")", ")", ";", "addComponent", "(", "AutomatedInstaller", ".", "class", ")", ";", "container", ".", "addComponent", "(", "new", "DefaultObjectFactory", "(", "this", ")", ")", ";", "addComponent", "(", "IUnpacker", ".", "class", ",", "Mockito", ".", "mock", "(", "IUnpacker", ".", "class", ")", ")", ";", "addComponent", "(", "Housekeeper", ".", "class", ",", "Mockito", ".", "mock", "(", "Housekeeper", ".", "class", ")", ")", ";", "addComponent", "(", "Platforms", ".", "class", ")", ";", "addComponent", "(", "Container", ".", "class", ",", "this", ")", ";", "addComponent", "(", "PlatformModelMatcher", ".", "class", ")", ";", "container", ".", "addAdapter", "(", "new", "ProviderAdapter", "(", "new", "RulesProvider", "(", ")", ")", ")", ";", "container", ".", "addAdapter", "(", "new", "ProviderAdapter", "(", "new", "PlatformProvider", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
10,666
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "swing", ".", "SwingUtilities", ";", "import", "org", ".", "fest", ".", "swing", ".", "fixture", ".", "FrameFixture", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "runner", ".", "RunWith", ";", "import", "org", ".", "mockito", ".", "Mockito", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "factory", ".", "ObjectFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "rules", ".", "RulesEngine", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "resource", ".", "ResourceManager", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "IconsDatabase", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "log", ".", "Log", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "base", ".", "InstallDataConfiguratorWithRules", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "UninstallDataWriter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "DefaultNavigator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerController", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanelView", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanels", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "Container", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "junit", ".", "PicoRunner", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Housekeeper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platforms", ";", "@", "RunWith", "(", "PicoRunner", ".", "class", ")", "@", "Container", "(", "TestGUIPanelContainer", ".", "class", ")", "public", "class", "AbstractPanelTest", "{", "private", "final", "TestGUIPanelContainer", "container", ";", "private", "GUIInstallData", "installData", ";", "private", "FrameFixture", "frameFixture", ";", "private", "ResourceManager", "resourceManager", ";", "private", "UninstallDataWriter", "uninstallDataWriter", ";", "private", "final", "IconsDatabase", "icons", ";", "private", "final", "RulesEngine", "rules", ";", "private", "final", "ObjectFactory", "factory", ";", "private", "IzPanels", "panels", ";", "public", "AbstractPanelTest", "(", "TestGUIPanelContainer", "container", ",", "GUIInstallData", "installData", ",", "ResourceManager", "resourceManager", ",", "ObjectFactory", "factory", ",", "RulesEngine", "rules", ",", "IconsDatabase", "icons", ",", "UninstallDataWriter", "uninstallDataWriter", ")", "{", "this", ".", "container", "=", "container", ";", "this", ".", "installData", "=", "installData", ";", "this", ".", "resourceManager", "=", "resourceManager", ";", "this", ".", "factory", "=", "factory", ";", "this", ".", "rules", "=", "rules", ";", "this", ".", "icons", "=", "icons", ";", "this", ".", "uninstallDataWriter", "=", "uninstallDataWriter", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "throws", "Exception", "{", "if", "(", "frameFixture", "!=", "null", ")", "{", "frameFixture", ".", "cleanUp", "(", ")", ";", "}", "}", "protected", "GUIInstallData", "getInstallData", "(", ")", "{", "return", "installData", ";", "}", "protected", "ResourceManager", "getResourceManager", "(", ")", "{", "return", "resourceManager", ";", "}", "protected", "UninstallDataWriter", "getUninstallDataWriter", "(", ")", "{", "return", "uninstallDataWriter", ";", "}", "protected", "IzPanels", "getPanels", "(", ")", "{", "return", "panels", ";", "}", "protected", "FrameFixture", "show", "(", "Class", "...", "panelClasses", ")", "throws", "Exception", "{", "List", "<", "IzPanelView", ">", "panelList", "=", "new", "ArrayList", "<", "IzPanelView", ">", "(", ")", ";", "for", "(", "Class", "panelClass", ":", "panelClasses", ")", "{", "Panel", "panel", "=", "new", "Panel", "(", ")", ";", "panel", ".", "setClassName", "(", "panelClass", ".", "getName", "(", ")", ")", ";", "panelList", ".", "add", "(", "createPanelView", "(", "panel", ")", ")", ";", "}", "return", "show", "(", "panelList", ")", ";", "}", "protected", "FrameFixture", "show", "(", "final", "List", "<", "IzPanelView", ">", "panelViews", ")", "throws", "Exception", "{", "final", "InstallerFrame", "[", "]", "handle", "=", "new", "InstallerFrame", "[", "1", "]", ";", "SwingUtilities", ".", "invokeAndWait", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "panels", "=", "new", "IzPanels", "(", "panelViews", ",", "container", ",", "installData", ")", ";", "DefaultNavigator", "navigator", "=", "new", "DefaultNavigator", "(", "panels", ",", "icons", ",", "installData", ")", ";", "InstallerFrame", "frame", "=", "new", "InstallerFrame", "(", "\"A", "title\"", ",", "installData", ",", "rules", ",", "icons", ",", "panels", ",", "uninstallDataWriter", ",", "resourceManager", ",", "Mockito", ".", "mock", "(", "UninstallData", ".", "class", ")", ",", "Mockito", ".", "mock", "(", "Housekeeper", ".", "class", ")", ",", "navigator", ",", "Mockito", ".", "mock", "(", "Log", ".", "class", ")", ")", ";", "handle", "[", "0", "]", "=", "frame", ";", "}", "}", ")", ";", "InstallerFrame", "frame", "=", "handle", "[", "0", "]", ";", "frameFixture", "=", "new", "FrameFixture", "(", "frame", ")", ";", "container", ".", "getContainer", "(", ")", ".", "addComponent", "(", "frame", ")", ";", "InstallDataConfiguratorWithRules", "configuratorWithRules", "=", "new", "InstallDataConfiguratorWithRules", "(", "installData", ",", "rules", ",", "Platforms", ".", "UNIX", ")", ";", "InstallerController", "controller", "=", "new", "InstallerController", "(", "configuratorWithRules", ",", "frame", ")", ";", "controller", ".", "buildInstallation", "(", ")", ";", "controller", ".", "launchInstallation", "(", ")", ";", "return", "frameFixture", ";", "}", "protected", "IzPanelView", "createPanelView", "(", "Panel", "panel", ")", "{", "return", "new", "IzPanelView", "(", "panel", ",", "factory", ",", "installData", ")", ";", "}", "}", "</s>" ]
10,667
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ";", "import", "org", ".", "mockito", ".", "Mockito", ";", "import", "org", ".", "picocontainer", ".", "MutablePicoContainer", ";", "import", "org", ".", "picocontainer", ".", "PicoException", ";", "import", "org", ".", "picocontainer", ".", "injectors", ".", "ProviderAdapter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ContainerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "log", ".", "Log", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "base", ".", "InstallDataConfiguratorWithRules", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "container", ".", "provider", ".", "IconsProvider", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "provider", ".", "GUIInstallDataMockProvider", ";", "public", "class", "TestGUIPanelContainer", "extends", "AbstractTestPanelContainer", "{", "public", "TestGUIPanelContainer", "(", ")", "{", "initialise", "(", ")", ";", "}", "@", "Override", "protected", "void", "fillContainer", "(", "MutablePicoContainer", "container", ")", "{", "super", ".", "fillContainer", "(", "container", ")", ";", "addComponent", "(", "InstallDataConfiguratorWithRules", ".", "class", ")", ";", "addComponent", "(", "Log", ".", "class", ",", "Mockito", ".", "mock", "(", "Log", ".", "class", ")", ")", ";", "container", ".", "addAdapter", "(", "new", "ProviderAdapter", "(", "new", "GUIInstallDataMockProvider", "(", ")", ")", ")", ";", "container", ".", "addAdapter", "(", "new", "ProviderAdapter", "(", "new", "IconsProvider", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
10,668
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "test", ";", "import", "org", ".", "picocontainer", ".", "MutablePicoContainer", ";", "import", "org", ".", "picocontainer", ".", "PicoException", ";", "import", "org", ".", "picocontainer", ".", "injectors", ".", "ProviderAdapter", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "ContainerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "handler", ".", "ConsolePrompt", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "provider", ".", "InstallDataMockProvider", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "test", ".", "util", ".", "TestConsole", ";", "public", "class", "TestConsolePanelContainer", "extends", "AbstractTestPanelContainer", "{", "public", "TestConsolePanelContainer", "(", ")", "{", "initialise", "(", ")", ";", "}", "@", "Override", "protected", "void", "fillContainer", "(", "MutablePicoContainer", "container", ")", "{", "super", ".", "fillContainer", "(", "container", ")", ";", "addComponent", "(", "TestConsole", ".", "class", ")", ";", "addComponent", "(", "ConsolePrompt", ".", "class", ")", ";", "container", ".", "addAdapter", "(", "new", "ProviderAdapter", "(", "new", "InstallDataMockProvider", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
10,669
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "ObjectInputStream", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Pack", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Platform", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "file", ".", "FileUtils", ";", "class", "TargetPanelHelper", "{", "private", "static", "final", "String", "TARGET_PANEL_DIR", "=", "\"\"", ";", "private", "static", "final", "String", "PREFIX", "=", "TARGET_PANEL_DIR", "+", "\".\"", ";", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "TargetPanelHelper", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "String", "getPath", "(", "InstallData", "installData", ")", "{", "String", "defaultPath", "=", "installData", ".", "getDefaultInstallPath", "(", ")", ";", "if", "(", "defaultPath", "==", "null", ")", "{", "defaultPath", "=", "installData", ".", "getVariable", "(", "\"\"", ")", ";", "}", "String", "path", "=", "getTargetPanelDir", "(", "installData", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "path", "=", "installData", ".", "getVariables", "(", ")", ".", "replace", "(", "path", ")", ";", "}", "if", "(", "path", "==", "null", "&&", "defaultPath", "!=", "null", ")", "{", "path", "=", "installData", ".", "getVariables", "(", ")", ".", "replace", "(", "defaultPath", ")", ";", "}", "return", "path", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "boolean", "isIncompatibleInstallation", "(", "String", "dir", ")", "{", "boolean", "result", "=", "false", ";", "File", "file", "=", "new", "File", "(", "dir", ",", "InstallData", ".", "INSTALLATION_INFORMATION", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "FileInputStream", "input", "=", "null", ";", "ObjectInputStream", "objectInput", "=", "null", ";", "try", "{", "input", "=", "new", "FileInputStream", "(", "file", ")", ";", "objectInput", "=", "new", "ObjectInputStream", "(", "input", ")", ";", "List", "<", "Object", ">", "packs", "=", "(", "List", "<", "Object", ">", ")", "objectInput", ".", "readObject", "(", ")", ";", "for", "(", "Object", "pack", ":", "packs", ")", "{", "if", "(", "!", "(", "pack", "instanceof", "Pack", ")", ")", "{", "return", "true", ";", "}", "}", "}", "catch", "(", "Throwable", "exception", ")", "{", "logger", ".", "log", "(", "Level", ".", "FINE", ",", "\"\"", "+", "file", ".", "getPath", "(", ")", "+", "\"\"", ",", "exception", ")", ";", "result", "=", "true", ";", "}", "finally", "{", "FileUtils", ".", "close", "(", "objectInput", ")", ";", "FileUtils", ".", "close", "(", "input", ")", ";", "}", "}", "return", "result", ";", "}", "private", "static", "String", "getTargetPanelDir", "(", "InstallData", "installData", ")", "{", "Platform", "platform", "=", "installData", ".", "getPlatform", "(", ")", ";", "String", "path", "=", "null", ";", "if", "(", "platform", ".", "getSymbolicName", "(", ")", "!=", "null", ")", "{", "path", "=", "installData", ".", "getVariable", "(", "PREFIX", "+", "platform", ".", "getSymbolicName", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "}", "if", "(", "path", "==", "null", ")", "{", "path", "=", "getTargetPanelDir", "(", "installData", ",", "platform", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "path", "==", "null", ")", "{", "path", "=", "installData", ".", "getVariable", "(", "TARGET_PANEL_DIR", ")", ";", "}", "return", "path", ";", "}", "private", "static", "String", "getTargetPanelDir", "(", "InstallData", "installData", ",", "Platform", ".", "Name", "name", ")", "{", "String", "path", "=", "null", ";", "List", "<", "Platform", ".", "Name", ">", "queue", "=", "new", "ArrayList", "<", "Platform", ".", "Name", ">", "(", ")", ";", "queue", ".", "add", "(", "name", ")", ";", "while", "(", "!", "queue", ".", "isEmpty", "(", ")", ")", "{", "name", "=", "queue", ".", "remove", "(", "0", ")", ";", "path", "=", "installData", ".", "getVariable", "(", "PREFIX", "+", "name", ".", "toString", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "break", ";", "}", "Collections", ".", "addAll", "(", "queue", ",", "name", ".", "getParents", "(", ")", ")", ";", "}", "return", "path", ";", "}", "}", "</s>" ]
10,670
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ".", "AbstractPanelConsole", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ".", "PanelConsole", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "public", "class", "TargetPanelConsole", "extends", "AbstractPanelConsole", "implements", "PanelConsole", "{", "public", "TargetPanelConsole", "(", ")", "{", "super", "(", ")", ";", "}", "public", "boolean", "runGeneratePropertiesFile", "(", "InstallData", "installData", ",", "PrintWriter", "printWriter", ")", "{", "printWriter", ".", "println", "(", "InstallData", ".", "INSTALL_PATH", "+", "\"=\"", ")", ";", "return", "true", ";", "}", "public", "boolean", "runConsoleFromProperties", "(", "InstallData", "installData", ",", "Properties", "properties", ")", "{", "boolean", "result", "=", "false", ";", "String", "path", "=", "properties", ".", "getProperty", "(", "InstallData", ".", "INSTALL_PATH", ")", ";", "if", "(", "path", "==", "null", "||", "\"\"", ".", "equals", "(", "path", ".", "trim", "(", ")", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "else", "if", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "path", ")", ")", "{", "System", ".", "err", ".", "println", "(", "getIncompatibleInstallationMsg", "(", "installData", ")", ")", ";", "}", "else", "{", "path", "=", "installData", ".", "getVariables", "(", ")", ".", "replace", "(", "path", ")", ";", "installData", ".", "setInstallPath", "(", "path", ")", ";", "result", "=", "true", ";", "}", "return", "result", ";", "}", "@", "Override", "public", "boolean", "runConsole", "(", "InstallData", "installData", ",", "Console", "console", ")", "{", "String", "defaultPath", "=", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ";", "if", "(", "defaultPath", "==", "null", ")", "{", "defaultPath", "=", "\"\"", ";", "}", "String", "path", "=", "console", ".", "prompt", "(", "\"\"", "+", "defaultPath", "+", "\"]", "\"", ",", "null", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "path", "=", "path", ".", "trim", "(", ")", ";", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "{", "path", "=", "defaultPath", ";", "}", "path", "=", "installData", ".", "getVariables", "(", ")", ".", "replace", "(", "path", ")", ";", "if", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "path", ")", ")", "{", "console", ".", "println", "(", "getIncompatibleInstallationMsg", "(", "installData", ")", ")", ";", "return", "runConsole", "(", "installData", ",", "console", ")", ";", "}", "else", "if", "(", "!", "path", ".", "isEmpty", "(", ")", ")", "{", "File", "selectedDir", "=", "new", "File", "(", "path", ")", ";", "if", "(", "selectedDir", ".", "exists", "(", ")", "&&", "selectedDir", ".", "isDirectory", "(", ")", "&&", "selectedDir", ".", "list", "(", ")", ".", "length", ">", "0", ")", "{", "console", ".", "println", "(", "installData", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ")", ";", "}", "installData", ".", "setInstallPath", "(", "path", ")", ";", "return", "promptEndPanel", "(", "installData", ",", "console", ")", ";", "}", "return", "runConsole", "(", "installData", ",", "console", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}", "private", "String", "getIncompatibleInstallationMsg", "(", "InstallData", "installData", ")", "{", "return", "installData", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
10,671
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "impl", ".", "XMLElementImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "exception", ".", "InstallerException", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "automation", ".", "PanelAutomation", ";", "public", "class", "TargetPanelAutomation", "implements", "PanelAutomation", "{", "public", "TargetPanelAutomation", "(", ")", "{", "}", "public", "void", "makeXMLData", "(", "InstallData", "idata", ",", "IXMLElement", "panelRoot", ")", "{", "IXMLElement", "ipath", "=", "new", "XMLElementImpl", "(", "\"installpath\"", ",", "panelRoot", ")", ";", "ipath", ".", "setContent", "(", "idata", ".", "getInstallPath", "(", ")", ")", ";", "IXMLElement", "prev", "=", "panelRoot", ".", "getFirstChildNamed", "(", "\"installpath\"", ")", ";", "if", "(", "prev", "!=", "null", ")", "{", "panelRoot", ".", "removeChild", "(", "prev", ")", ";", "}", "panelRoot", ".", "addChild", "(", "ipath", ")", ";", "}", "public", "void", "runAutomated", "(", "InstallData", "idata", ",", "IXMLElement", "panelRoot", ")", "{", "IXMLElement", "ipath", "=", "panelRoot", ".", "getFirstChildNamed", "(", "\"installpath\"", ")", ";", "String", "path", "=", "ipath", ".", "getContent", "(", ")", ";", "path", "=", "idata", ".", "getVariables", "(", ")", ".", "replace", "(", "path", ")", ";", "if", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "path", ")", ")", "{", "throw", "new", "InstallerException", "(", "idata", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ")", ";", "}", "idata", ".", "setInstallPath", "(", "path", ")", ";", "}", "}", "</s>" ]
10,672
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "target", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "log", ".", "Log", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "path", ".", "PathInputPanel", ";", "public", "class", "TargetPanel", "extends", "PathInputPanel", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3256443616359429170L", ";", "public", "TargetPanel", "(", "Panel", "panel", ",", "InstallerFrame", "parent", ",", "GUIInstallData", "installData", ",", "Resources", "resources", ",", "Log", "log", ")", "{", "super", "(", "panel", ",", "parent", ",", "installData", ",", "resources", ",", "log", ")", ";", "}", "public", "void", "panelActivate", "(", ")", "{", "String", "path", "=", "TargetPanelHelper", ".", "getPath", "(", "installData", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "pathSelectionPanel", ".", "setPath", "(", "path", ")", ";", "}", "super", ".", "panelActivate", "(", ")", ";", "}", "public", "boolean", "isValidated", "(", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "TargetPanelHelper", ".", "isIncompatibleInstallation", "(", "pathSelectionPanel", ".", "getPath", "(", ")", ")", ")", "{", "emitError", "(", "getString", "(", "\"\"", ")", ",", "getString", "(", "\"\"", ")", ")", ";", "}", "else", "if", "(", "super", ".", "isValidated", "(", ")", ")", "{", "installData", ".", "setInstallPath", "(", "pathSelectionPanel", ".", "getPath", "(", ")", ")", ";", "result", "=", "true", ";", "}", "return", "result", ";", "}", "public", "void", "makeXMLData", "(", "IXMLElement", "panelRoot", ")", "{", "new", "TargetPanelAutomation", "(", ")", ".", "makeXMLData", "(", "installData", ",", "panelRoot", ")", ";", "}", "public", "String", "getSummaryBody", "(", ")", "{", "return", "(", "this", ".", "installData", ".", "getInstallPath", "(", ")", ")", ";", "}", "}", "</s>" ]
10,673
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "defaulttarget", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "impl", ".", "XMLElementImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "automation", ".", "PanelAutomation", ";", "public", "class", "DefaultTargetPanelAutomationHelper", "implements", "PanelAutomation", "{", "private", "VariableSubstitutor", "variableSubstitutor", ";", "public", "DefaultTargetPanelAutomationHelper", "(", "VariableSubstitutor", "variableSubstitutor", ")", "{", "this", ".", "variableSubstitutor", "=", "variableSubstitutor", ";", "}", "public", "void", "makeXMLData", "(", "InstallData", "idata", ",", "IXMLElement", "panelRoot", ")", "{", "IXMLElement", "ipath", "=", "new", "XMLElementImpl", "(", "\"installpath\"", ",", "panelRoot", ")", ";", "ipath", ".", "setContent", "(", "idata", ".", "getInstallPath", "(", ")", ")", ";", "IXMLElement", "prev", "=", "panelRoot", ".", "getFirstChildNamed", "(", "\"installpath\"", ")", ";", "if", "(", "prev", "!=", "null", ")", "{", "panelRoot", ".", "removeChild", "(", "prev", ")", ";", "}", "panelRoot", ".", "addChild", "(", "ipath", ")", ";", "}", "public", "void", "runAutomated", "(", "InstallData", "idata", ",", "IXMLElement", "panelRoot", ")", "{", "IXMLElement", "ipath", "=", "panelRoot", ".", "getFirstChildNamed", "(", "\"installpath\"", ")", ";", "String", "path", "=", "ipath", ".", "getContent", "(", ")", ";", "try", "{", "path", "=", "variableSubstitutor", ".", "substitute", "(", "path", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "idata", ".", "setInstallPath", "(", "path", ")", ";", "}", "}", "</s>" ]
10,674
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "defaulttarget", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "log", ".", "Log", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "automation", ".", "PanelAutomation", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "path", ".", "PathInputPanel", ";", "public", "class", "DefaultTargetPanel", "extends", "PathInputPanel", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3256443616359329170L", ";", "private", "PanelAutomation", "defaultTargetPanelAutomationHelper", ";", "public", "DefaultTargetPanel", "(", "Panel", "panel", ",", "InstallerFrame", "parent", ",", "GUIInstallData", "installData", ",", "Resources", "resources", ",", "DefaultTargetPanelAutomationHelper", "helper", ",", "Log", "log", ")", "{", "super", "(", "panel", ",", "parent", ",", "installData", ",", "resources", ",", "log", ")", ";", "this", ".", "defaultTargetPanelAutomationHelper", "=", "helper", ";", "}", "public", "void", "panelActivate", "(", ")", "{", "pathSelectionPanel", ".", "setPath", "(", "this", ".", "installData", ".", "getDefaultInstallPath", "(", ")", ")", ";", "parent", ".", "skipPanel", "(", ")", ";", "}", "public", "boolean", "isValidated", "(", ")", "{", "return", "(", "true", ")", ";", "}", "public", "void", "makeXMLData", "(", "IXMLElement", "panelRoot", ")", "{", "defaultTargetPanelAutomationHelper", ".", "makeXMLData", "(", "this", ".", "installData", ",", "panelRoot", ")", ";", "}", "public", "String", "getSummaryBody", "(", ")", "{", "return", "(", "this", ".", "installData", ".", "getInstallPath", "(", ")", ")", ";", "}", "}", "</s>" ]
10,675
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "xinfo", ";", "import", "java", ".", "awt", ".", "Font", ";", "import", "java", ".", "awt", ".", "GridBagConstraints", ";", "import", "java", ".", "awt", ".", "GridBagLayout", ";", "import", "java", ".", "awt", ".", "Insets", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JScrollPane", ";", "import", "javax", ".", "swing", ".", "JTextArea", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "Panel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "LabelFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "LayoutHelper", ";", "public", "class", "XInfoPanel", "extends", "IzPanel", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3257009856274970416L", ";", "private", "JTextArea", "textArea", ";", "private", "String", "info", ";", "public", "XInfoPanel", "(", "Panel", "panel", ",", "InstallerFrame", "parent", ",", "GUIInstallData", "installData", ",", "Resources", "resources", ")", "{", "super", "(", "panel", ",", "parent", ",", "installData", ",", "resources", ")", ";", "GridBagLayout", "layout", "=", "new", "GridBagLayout", "(", ")", ";", "GridBagConstraints", "gbConstraints", "=", "new", "GridBagConstraints", "(", ")", ";", "setLayout", "(", "layout", ")", ";", "JLabel", "infoLabel", "=", "LabelFactory", ".", "create", "(", "getString", "(", "\"\"", ")", ",", "parent", ".", "getIcons", "(", ")", ".", "get", "(", "\"edit\"", ")", ",", "JLabel", ".", "TRAILING", ")", ";", "LayoutHelper", ".", "buildConstraints", "(", "gbConstraints", ",", "0", ",", "0", ",", "1", ",", "1", ",", "1.0", ",", "0.0", ")", ";", "gbConstraints", ".", "insets", "=", "new", "Insets", "(", "5", ",", "5", ",", "5", ",", "5", ")", ";", "gbConstraints", ".", "fill", "=", "GridBagConstraints", ".", "BOTH", ";", "gbConstraints", ".", "anchor", "=", "GridBagConstraints", ".", "SOUTHWEST", ";", "layout", ".", "addLayoutComponent", "(", "infoLabel", ",", "gbConstraints", ")", ";", "add", "(", "infoLabel", ")", ";", "textArea", "=", "new", "JTextArea", "(", ")", ";", "textArea", ".", "setEditable", "(", "false", ")", ";", "String", "textAreaFont", "=", "installData", ".", "getVariable", "(", "\"\"", ")", ";", "if", "(", "textAreaFont", "!=", "null", "&&", "textAreaFont", ".", "length", "(", ")", ">", "0", ")", "{", "Font", "font", "=", "Font", ".", "decode", "(", "textAreaFont", ")", ";", "textArea", ".", "setFont", "(", "font", ")", ";", "}", "JScrollPane", "scroller", "=", "new", "JScrollPane", "(", "textArea", ")", ";", "LayoutHelper", ".", "buildConstraints", "(", "gbConstraints", ",", "0", ",", "1", ",", "1", ",", "1", ",", "1.0", ",", "0.9", ")", ";", "gbConstraints", ".", "anchor", "=", "GridBagConstraints", ".", "CENTER", ";", "layout", ".", "addLayoutComponent", "(", "scroller", ",", "gbConstraints", ")", ";", "add", "(", "scroller", ")", ";", "}", "private", "void", "loadInfo", "(", ")", "{", "info", "=", "getResources", "(", ")", ".", "getString", "(", "\"\"", ",", "null", ",", "\"\"", ")", ";", "}", "private", "void", "parseText", "(", ")", "{", "info", "=", "installData", ".", "getVariables", "(", ")", ".", "replace", "(", "info", ")", ";", "}", "public", "void", "panelActivate", "(", ")", "{", "loadInfo", "(", ")", ";", "parseText", "(", ")", ";", "textArea", ".", "setText", "(", "info", ")", ";", "textArea", ".", "setCaretPosition", "(", "0", ")", ";", "}", "public", "boolean", "isValidated", "(", ")", "{", "return", "true", ";", "}", "}", "</s>" ]
10,676
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "public", "class", "PasswordUIElement", "extends", "UIElement", "{", "public", "PasswordUIElement", "(", ")", "{", "super", "(", ")", ";", "}", "PasswordGroup", "passwordGroup", ";", "public", "PasswordGroup", "getPasswordGroup", "(", ")", "{", "return", "passwordGroup", ";", "}", "public", "void", "setPasswordGroup", "(", "PasswordGroup", "passwordGroup", ")", "{", "this", ".", "passwordGroup", "=", "passwordGroup", ";", "}", "}", "</s>" ]
10,677
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "awt", ".", "Dimension", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionListener", ";", "import", "java", ".", "awt", ".", "event", ".", "FocusEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "FocusListener", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "Box", ";", "import", "javax", ".", "swing", ".", "BoxLayout", ";", "import", "javax", ".", "swing", ".", "DefaultListModel", ";", "import", "javax", ".", "swing", ".", "JButton", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JList", ";", "import", "javax", ".", "swing", ".", "JOptionPane", ";", "import", "javax", ".", "swing", ".", "JPanel", ";", "import", "javax", ".", "swing", ".", "JScrollPane", ";", "import", "javax", ".", "swing", ".", "ListSelectionModel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Messages", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "ButtonFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "StringInputProcessingClient", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "ValidatorContainer", ";", "public", "class", "MultipleFileInputField", "extends", "JPanel", "implements", "ActionListener", ",", "FocusListener", "{", "private", "static", "final", "long", "serialVersionUID", "=", "4673684743657328492L", ";", "private", "static", "final", "transient", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "MultipleFileInputField", ".", "class", ".", "getName", "(", ")", ")", ";", "boolean", "isDirectory", ";", "InstallerFrame", "parentFrame", ";", "List", "<", "ValidatorContainer", ">", "validators", ";", "DefaultListModel", "model", ";", "JList", "fileList", ";", "JButton", "browseBtn", ";", "JButton", "deleteBtn", ";", "String", "set", ";", "int", "size", ";", "GUIInstallData", "data", ";", "String", "fileExtension", ";", "String", "fileExtensionDescription", ";", "boolean", "allowEmpty", ";", "boolean", "createMultipleVariables", ";", "int", "visibleRows", "=", "10", ";", "int", "preferredX", "=", "200", ";", "int", "preferredY", "=", "200", ";", "String", "labeltext", ";", "public", "MultipleFileInputField", "(", "InstallerFrame", "parent", ",", "GUIInstallData", "data", ",", "boolean", "directory", ",", "String", "set", ",", "int", "size", ",", "List", "<", "ValidatorContainer", ">", "validatorConfig", ",", "String", "fileExt", ",", "String", "fileExtDesc", ",", "boolean", "createMultipleVariables", ",", "int", "visibleRows", ",", "int", "preferredXSize", ",", "int", "preferredYSize", ",", "String", "labelText", ")", "{", "this", ".", "parentFrame", "=", "parent", ";", "this", ".", "data", "=", "data", ";", "this", ".", "validators", "=", "validatorConfig", ";", "this", ".", "set", "=", "set", ";", "this", ".", "size", "=", "size", ";", "this", ".", "fileExtension", "=", "fileExt", ";", "this", ".", "fileExtensionDescription", "=", "fileExtDesc", ";", "this", ".", "isDirectory", "=", "directory", ";", "this", ".", "createMultipleVariables", "=", "createMultipleVariables", ";", "this", ".", "visibleRows", "=", "visibleRows", ";", "this", ".", "preferredX", "=", "preferredXSize", ";", "this", ".", "preferredY", "=", "preferredYSize", ";", "this", ".", "labeltext", "=", "labelText", ";", "this", ".", "initialize", "(", ")", ";", "}", "public", "void", "clearFiles", "(", ")", "{", "this", ".", "model", ".", "clear", "(", ")", ";", "}", "public", "void", "addFile", "(", "String", "file", ")", "{", "this", ".", "model", ".", "addElement", "(", "file", ")", ";", "}", "public", "void", "initialize", "(", ")", "{", "JPanel", "main", "=", "new", "JPanel", "(", ")", ";", "main", ".", "setLayout", "(", "new", "BoxLayout", "(", "main", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "JPanel", "labelPanel", "=", "new", "JPanel", "(", ")", ";", "labelPanel", ".", "setLayout", "(", "new", "BoxLayout", "(", "labelPanel", ",", "BoxLayout", ".", "X_AXIS", ")", ")", ";", "JLabel", "label", "=", "new", "JLabel", "(", "this", ".", "labeltext", ")", ";", "labelPanel", ".", "add", "(", "label", ")", ";", "labelPanel", ".", "add", "(", "Box", ".", "createHorizontalGlue", "(", ")", ")", ";", "main", ".", "add", "(", "labelPanel", ")", ";", "model", "=", "new", "DefaultListModel", "(", ")", ";", "fileList", "=", "new", "JList", "(", "model", ")", ";", "fileList", ".", "setSelectionMode", "(", "ListSelectionModel", ".", "SINGLE_SELECTION", ")", ";", "fileList", ".", "setVisibleRowCount", "(", "visibleRows", ")", ";", "JPanel", "panel", "=", "new", "JPanel", "(", ")", ";", "panel", ".", "setLayout", "(", "new", "BoxLayout", "(", "panel", ",", "BoxLayout", ".", "X_AXIS", ")", ")", ";", "JPanel", "buttonPanel", "=", "new", "JPanel", "(", ")", ";", "buttonPanel", ".", "setLayout", "(", "new", "BoxLayout", "(", "buttonPanel", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "Messages", "messages", "=", "data", ".", "getMessages", "(", ")", ";", "browseBtn", "=", "ButtonFactory", ".", "createButton", "(", "messages", ".", "get", "(", "\"\"", ")", ",", "data", ".", "buttonsHColor", ")", ";", "browseBtn", ".", "addActionListener", "(", "this", ")", ";", "deleteBtn", "=", "ButtonFactory", ".", "createButton", "(", "messages", ".", "get", "(", "\"\"", ")", ",", "data", ".", "buttonsHColor", ")", ";", "deleteBtn", ".", "addActionListener", "(", "this", ")", ";", "JScrollPane", "scroller", "=", "new", "JScrollPane", "(", "fileList", ")", ";", "scroller", ".", "setPreferredSize", "(", "new", "Dimension", "(", "preferredX", ",", "preferredY", ")", ")", ";", "panel", ".", "add", "(", "scroller", ")", ";", "buttonPanel", ".", "add", "(", "browseBtn", ")", ";", "buttonPanel", ".", "add", "(", "deleteBtn", ")", ";", "buttonPanel", ".", "add", "(", "Box", ".", "createVerticalGlue", "(", ")", ")", ";", "panel", ".", "add", "(", "buttonPanel", ")", ";", "main", ".", "add", "(", "panel", ")", ";", "main", ".", "add", "(", "Box", ".", "createVerticalGlue", "(", ")", ")", ";", "add", "(", "main", ")", ";", "}", "@", "Override", "public", "void", "actionPerformed", "(", "ActionEvent", "arg0", ")", "{", "if", "(", "arg0", ".", "getSource", "(", ")", "==", "browseBtn", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "String", "initialPath", "=", "\".\"", ";", "if", "(", "fileList", ".", "getSelectedValue", "(", ")", "!=", "null", ")", "{", "initialPath", "=", "(", "String", ")", "fileList", ".", "getSelectedValue", "(", ")", ";", "}", "JFileChooser", "filechooser", "=", "new", "JFileChooser", "(", "initialPath", ")", ";", "if", "(", "isDirectory", ")", "{", "filechooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}", "else", "{", "filechooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "FILES_ONLY", ")", ";", "if", "(", "(", "fileExtension", "!=", "null", ")", "&&", "(", "fileExtensionDescription", "!=", "null", ")", ")", "{", "UserInputFileFilter", "fileFilter", "=", "new", "UserInputFileFilter", "(", ")", ";", "fileFilter", ".", "setFileExt", "(", "fileExtension", ")", ";", "fileFilter", ".", "setFileExtDesc", "(", "fileExtensionDescription", ")", ";", "filechooser", ".", "setFileFilter", "(", "fileFilter", ")", ";", "}", "}", "if", "(", "filechooser", ".", "showOpenDialog", "(", "parentFrame", ")", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "String", "selectedFile", "=", "filechooser", ".", "getSelectedFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "model", ".", "addElement", "(", "selectedFile", ")", ";", "logger", ".", "fine", "(", "\"\"", "+", "selectedFile", ")", ";", "}", "}", "if", "(", "arg0", ".", "getSource", "(", ")", "==", "deleteBtn", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "if", "(", "fileList", ".", "getSelectedValue", "(", ")", "!=", "null", ")", "{", "model", ".", "removeElement", "(", "fileList", ".", "getSelectedValue", "(", ")", ")", ";", "}", "}", "}", "public", "List", "<", "String", ">", "getSelectedFiles", "(", ")", "{", "List", "<", "String", ">", "result", "=", "null", ";", "if", "(", "model", ".", "size", "(", ")", ">", "0", ")", "{", "result", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Enumeration", "<", "?", ">", "elements", "=", "model", ".", "elements", "(", ")", ";", "for", "(", ";", "elements", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "element", "=", "(", "String", ")", "elements", ".", "nextElement", "(", ")", ";", "result", ".", "add", "(", "element", ")", ";", "}", "}", "return", "result", ";", "}", "private", "void", "showMessage", "(", "String", "messageType", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parentFrame", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", "+", "messageType", "+", "\".message\"", ")", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", "+", "messageType", "+", "\".caption\"", ")", ",", "JOptionPane", ".", "WARNING_MESSAGE", ")", ";", "}", "private", "boolean", "validateFile", "(", "String", "input", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "allowEmpty", "&&", "(", "(", "input", "==", "null", ")", "||", "(", "input", ".", "length", "(", ")", "==", "0", ")", ")", ")", "{", "result", "=", "true", ";", "}", "else", "if", "(", "input", "!=", "null", ")", "{", "File", "file", "=", "new", "File", "(", "input", ")", ";", "if", "(", "isDirectory", "&&", "!", "file", ".", "isDirectory", "(", ")", ")", "{", "result", "=", "false", ";", "showMessage", "(", "\"\"", ")", ";", "}", "else", "if", "(", "!", "isDirectory", "&&", "!", "file", ".", "isFile", "(", ")", ")", "{", "result", "=", "false", ";", "showMessage", "(", "\"file.notfile\"", ")", ";", "}", "else", "{", "StringInputProcessingClient", "processingClient", "=", "new", "StringInputProcessingClient", "(", "input", ",", "validators", ")", ";", "boolean", "success", "=", "processingClient", ".", "validate", "(", ")", ";", "if", "(", "!", "success", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parentFrame", ",", "processingClient", ".", "getValidationMessage", "(", ")", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ",", "JOptionPane", ".", "WARNING_MESSAGE", ")", ";", "}", "result", "=", "success", ";", "}", "}", "else", "{", "if", "(", "isDirectory", ")", "{", "showMessage", "(", "\"\"", ")", ";", "}", "else", "{", "showMessage", "(", "\"file.nofile\"", ")", ";", "}", "}", "return", "result", ";", "}", "public", "boolean", "validateField", "(", ")", "{", "boolean", "result", "=", "false", ";", "int", "fileCount", "=", "model", ".", "getSize", "(", ")", ";", "if", "(", "fileCount", "==", "0", "&&", "allowEmpty", ")", "{", "return", "true", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fileCount", ";", "i", "++", ")", "{", "result", "=", "validateFile", "(", "(", "String", ")", "model", ".", "getElementAt", "(", "i", ")", ")", ";", "if", "(", "!", "result", ")", "{", "break", ";", "}", "}", "}", "return", "result", ";", "}", "public", "boolean", "isAllowEmptyInput", "(", ")", "{", "return", "allowEmpty", ";", "}", "public", "void", "setAllowEmptyInput", "(", "boolean", "allowEmpty", ")", "{", "this", ".", "allowEmpty", "=", "allowEmpty", ";", "}", "@", "Override", "public", "void", "focusGained", "(", "FocusEvent", "e", ")", "{", "}", "@", "Override", "public", "void", "focusLost", "(", "FocusEvent", "e", ")", "{", "}", "public", "boolean", "isCreateMultipleVariables", "(", ")", "{", "return", "createMultipleVariables", ";", "}", "public", "void", "setCreateMultipleVariables", "(", "boolean", "createMultipleVariables", ")", "{", "this", ".", "createMultipleVariables", "=", "createMultipleVariables", ";", "}", "}", "</s>" ]
10,678
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JPasswordField", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processor", ".", "Processor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "Validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "ValidatorContainer", ";", "public", "class", "PasswordGroup", "implements", "ProcessingClient", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "PasswordGroup", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "List", "<", "JPasswordField", ">", "fields", "=", "new", "ArrayList", "<", "JPasswordField", ">", "(", ")", ";", "private", "List", "<", "ValidatorContainer", ">", "validatorContainers", "=", "null", ";", "private", "Processor", "processor", "=", "null", ";", "private", "String", "modifiedPassword", "=", "null", ";", "private", "int", "currentValidator", "=", "0", ";", "private", "GUIInstallData", "idata", ";", "public", "PasswordGroup", "(", "GUIInstallData", "idata", ",", "List", "<", "ValidatorContainer", ">", "validatorContainers", ",", "String", "processor", ")", "{", "try", "{", "this", ".", "idata", "=", "idata", ";", "this", ".", "validatorContainers", "=", "validatorContainers", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "t", ",", "t", ")", ";", "this", ".", "validatorContainers", "=", "null", ";", "}", "try", "{", "this", ".", "processor", "=", "(", "Processor", ")", "Class", ".", "forName", "(", "processor", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "t", ",", "t", ")", ";", "this", ".", "processor", "=", "null", ";", "}", "}", "public", "GUIInstallData", "getIdata", "(", ")", "{", "return", "idata", ";", "}", "@", "Override", "public", "int", "getNumFields", "(", ")", "{", "return", "(", "fields", ".", "size", "(", ")", ")", ";", "}", "@", "Override", "public", "String", "getFieldContents", "(", "int", "index", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "(", "index", "<", "0", ")", "||", "(", "index", ">=", "fields", ".", "size", "(", ")", ")", ")", "{", "throw", "(", "new", "IndexOutOfBoundsException", "(", ")", ")", ";", "}", "String", "contents", "=", "new", "String", "(", "(", "fields", ".", "get", "(", "index", ")", ")", ".", "getPassword", "(", ")", ")", ";", "return", "(", "contents", ")", ";", "}", "public", "void", "addField", "(", "JPasswordField", "field", ")", "{", "if", "(", "field", "!=", "null", ")", "{", "fields", ".", "add", "(", "field", ")", ";", "}", "}", "public", "boolean", "validateContents", "(", "int", "i", ")", "{", "boolean", "returnValue", "=", "true", ";", "try", "{", "currentValidator", "=", "i", ";", "ValidatorContainer", "container", "=", "getValidatorContainer", "(", "i", ")", ";", "Validator", "validator", "=", "container", ".", "getValidator", "(", ")", ";", "if", "(", "validator", "!=", "null", ")", "{", "returnValue", "=", "validator", ".", "validate", "(", "this", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "}", "return", "returnValue", ";", "}", "public", "String", "getValidatorMessage", "(", "int", "i", ")", "{", "String", "returnValue", "=", "null", ";", "try", "{", "ValidatorContainer", "container", "=", "getValidatorContainer", "(", "i", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "returnValue", "=", "container", ".", "getMessage", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "}", "return", "returnValue", ";", "}", "public", "int", "validatorSize", "(", ")", "{", "int", "size", "=", "0", ";", "if", "(", "validatorContainers", "!=", "null", ")", "{", "size", "=", "validatorContainers", ".", "size", "(", ")", ";", "}", "return", "size", ";", "}", "public", "ValidatorContainer", "getValidatorContainer", "(", ")", "{", "return", "getValidatorContainer", "(", "currentValidator", ")", ";", "}", "public", "ValidatorContainer", "getValidatorContainer", "(", "int", "i", ")", "{", "ValidatorContainer", "container", "=", "null", ";", "try", "{", "container", "=", "validatorContainers", ".", "get", "(", "i", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "container", "=", "null", ";", "}", "return", "container", ";", "}", "@", "Override", "public", "boolean", "hasParams", "(", ")", "{", "return", "hasParams", "(", "currentValidator", ")", ";", "}", "public", "boolean", "hasParams", "(", "int", "i", ")", "{", "boolean", "returnValue", "=", "false", ";", "try", "{", "ValidatorContainer", "container", "=", "getValidatorContainer", "(", "i", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "returnValue", "=", "container", ".", "hasParams", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "}", "return", "returnValue", ";", "}", "@", "Override", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "getValidatorParams", "(", "currentValidator", ")", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", "int", "i", ")", "{", "Map", "<", "String", ",", "String", ">", "returnValue", "=", "null", ";", "try", "{", "ValidatorContainer", "container", "=", "getValidatorContainer", "(", "i", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "returnValue", "=", "container", ".", "getValidatorParams", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "}", "return", "returnValue", ";", "}", "@", "Override", "public", "String", "getText", "(", ")", "{", "return", "getValidatorMessage", "(", "currentValidator", ")", ";", "}", "public", "void", "setModifiedPassword", "(", "String", "value", ")", "{", "modifiedPassword", "=", "value", ";", "}", "public", "String", "getPassword", "(", ")", "{", "String", "returnValue", "=", "\"\"", ";", "if", "(", "modifiedPassword", "!=", "null", ")", "{", "returnValue", "=", "modifiedPassword", ";", "if", "(", "processor", "!=", "null", ")", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "}", "}", "else", "if", "(", "processor", "!=", "null", ")", "{", "returnValue", "=", "processor", ".", "process", "(", "this", ")", ";", "}", "else", "if", "(", "fields", ".", "size", "(", ")", ">", "0", ")", "{", "returnValue", "=", "new", "String", "(", "fields", ".", "get", "(", "0", ")", ".", "getPassword", "(", ")", ")", ";", "}", "return", "returnValue", ";", "}", "}", "</s>" ]
10,679
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "javax", ".", "swing", ".", "*", ";", "public", "class", "RadioButtonUIElement", "extends", "UIElement", "{", "public", "RadioButtonUIElement", "(", ")", "{", "super", "(", ")", ";", "}", "ButtonGroup", "buttonGroup", ";", "public", "ButtonGroup", "getButtonGroup", "(", ")", "{", "return", "buttonGroup", ";", "}", "public", "void", "setButtonGroup", "(", "ButtonGroup", "buttonGroup", ")", "{", "this", ".", "buttonGroup", "=", "buttonGroup", ";", "}", "}", "</s>" ]
10,680
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "awt", ".", "GridBagConstraints", ";", "import", "java", ".", "awt", ".", "GridBagLayout", ";", "import", "java", ".", "awt", ".", "Insets", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionListener", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JButton", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "javax", ".", "swing", ".", "JOptionPane", ";", "import", "javax", ".", "swing", ".", "JPanel", ";", "import", "javax", ".", "swing", ".", "JTextField", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "ButtonFactory", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "InstallerFrame", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "StringInputProcessingClient", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "ValidatorContainer", ";", "public", "class", "FileInputField", "extends", "JPanel", "implements", "ActionListener", "{", "private", "static", "final", "long", "serialVersionUID", "=", "4673684743657328492L", ";", "private", "static", "final", "transient", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "FileInputField", ".", "class", ".", "getName", "(", ")", ")", ";", "InstallerFrame", "parentFrame", ";", "IzPanel", "parent", ";", "List", "<", "ValidatorContainer", ">", "validators", ";", "JTextField", "filetxt", ";", "JButton", "browseBtn", ";", "String", "set", ";", "int", "size", ";", "GUIInstallData", "installDataGUI", ";", "String", "fileExtension", ";", "String", "fileExtensionDescription", ";", "boolean", "allowEmpty", ";", "protected", "static", "final", "int", "INVALID", "=", "0", ",", "EMPTY", "=", "1", ";", "public", "FileInputField", "(", "IzPanel", "parent", ",", "GUIInstallData", "installDataGUI", ",", "boolean", "directory", ",", "String", "set", ",", "int", "size", ",", "List", "<", "ValidatorContainer", ">", "validatorConfig", ")", "{", "this", "(", "parent", ",", "installDataGUI", ",", "directory", ",", "set", ",", "size", ",", "validatorConfig", ",", "null", ",", "null", ")", ";", "}", "public", "FileInputField", "(", "IzPanel", "parent", ",", "GUIInstallData", "installDataGUI", ",", "boolean", "directory", ",", "String", "set", ",", "int", "size", ",", "List", "<", "ValidatorContainer", ">", "validatorConfig", ",", "String", "fileExt", ",", "String", "fileExtDesc", ")", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "parentFrame", "=", "parent", ".", "getInstallerFrame", "(", ")", ";", "this", ".", "installDataGUI", "=", "installDataGUI", ";", "this", ".", "validators", "=", "validatorConfig", ";", "this", ".", "set", "=", "set", ";", "this", ".", "size", "=", "size", ";", "this", ".", "fileExtension", "=", "fileExt", ";", "this", ".", "fileExtensionDescription", "=", "fileExtDesc", ";", "this", ".", "initialize", "(", ")", ";", "}", "private", "void", "initialize", "(", ")", "{", "filetxt", "=", "new", "JTextField", "(", "set", ",", "size", ")", ";", "filetxt", ".", "setCaretPosition", "(", "0", ")", ";", "GridBagLayout", "layout", "=", "new", "GridBagLayout", "(", ")", ";", "setLayout", "(", "layout", ")", ";", "GridBagConstraints", "fileTextConstraint", "=", "new", "GridBagConstraints", "(", ")", ";", "GridBagConstraints", "fileButtonConstraint", "=", "new", "GridBagConstraints", "(", ")", ";", "fileTextConstraint", ".", "gridx", "=", "0", ";", "fileTextConstraint", ".", "gridy", "=", "0", ";", "fileTextConstraint", ".", "anchor", "=", "GridBagConstraints", ".", "WEST", ";", "fileTextConstraint", ".", "insets", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "5", ")", ";", "fileButtonConstraint", ".", "gridx", "=", "1", ";", "fileButtonConstraint", ".", "gridy", "=", "0", ";", "fileButtonConstraint", ".", "anchor", "=", "GridBagConstraints", ".", "WEST", ";", "browseBtn", "=", "ButtonFactory", ".", "createButton", "(", "installDataGUI", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ",", "installDataGUI", ".", "buttonsHColor", ")", ";", "browseBtn", ".", "addActionListener", "(", "this", ")", ";", "this", ".", "add", "(", "filetxt", ",", "fileTextConstraint", ")", ";", "this", ".", "add", "(", "browseBtn", ",", "fileButtonConstraint", ")", ";", "}", "public", "void", "setFile", "(", "String", "filename", ")", "{", "filetxt", ".", "setText", "(", "filename", ")", ";", "}", "@", "Override", "public", "void", "actionPerformed", "(", "ActionEvent", "arg0", ")", "{", "if", "(", "arg0", ".", "getSource", "(", ")", "==", "browseBtn", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "String", "initialPath", "=", "\".\"", ";", "if", "(", "filetxt", ".", "getText", "(", ")", "!=", "null", ")", "{", "initialPath", "=", "filetxt", ".", "getText", "(", ")", ";", "}", "JFileChooser", "filechooser", "=", "new", "JFileChooser", "(", "initialPath", ")", ";", "prepareFileChooser", "(", "filechooser", ")", ";", "if", "(", "filechooser", ".", "showOpenDialog", "(", "parentFrame", ")", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "String", "selectedFile", "=", "filechooser", ".", "getSelectedFile", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "filetxt", ".", "setText", "(", "selectedFile", ")", ";", "logger", ".", "fine", "(", "\"\"", "+", "selectedFile", ")", ";", "}", "}", "}", "protected", "void", "prepareFileChooser", "(", "JFileChooser", "filechooser", ")", "{", "filechooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "FILES_ONLY", ")", ";", "if", "(", "(", "fileExtension", "!=", "null", ")", "&&", "(", "fileExtensionDescription", "!=", "null", ")", ")", "{", "UserInputFileFilter", "fileFilter", "=", "new", "UserInputFileFilter", "(", ")", ";", "fileFilter", ".", "setFileExt", "(", "fileExtension", ")", ";", "fileFilter", ".", "setFileExtDesc", "(", "fileExtensionDescription", ")", ";", "filechooser", ".", "setFileFilter", "(", "fileFilter", ")", ";", "}", "}", "public", "File", "getSelectedFile", "(", ")", "{", "File", "result", "=", "null", ";", "if", "(", "filetxt", ".", "getText", "(", ")", "!=", "null", ")", "{", "result", "=", "new", "File", "(", "filetxt", ".", "getText", "(", ")", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "showMessage", "(", "int", "k", ")", "{", "if", "(", "k", "==", "INVALID", ")", "{", "showMessage", "(", "\"file.notfile\"", ")", ";", "}", "else", "if", "(", "k", "==", "EMPTY", ")", "{", "showMessage", "(", "\"file.nofile\"", ")", ";", "}", "}", "protected", "void", "showMessage", "(", "String", "messageType", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parentFrame", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", "+", "messageType", "+", "\".message\"", ")", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", "+", "messageType", "+", "\".caption\"", ")", ",", "JOptionPane", ".", "WARNING_MESSAGE", ")", ";", "}", "public", "boolean", "validateField", "(", ")", "{", "boolean", "result", "=", "false", ";", "String", "input", "=", "filetxt", ".", "getText", "(", ")", ";", "boolean", "empty", "=", "(", "input", "==", "null", ")", "||", "(", "input", ".", "length", "(", ")", "==", "0", ")", ";", "if", "(", "empty", "&&", "allowEmpty", ")", "{", "result", "=", "true", ";", "}", "else", "if", "(", "!", "empty", ")", "{", "if", "(", "input", ".", "startsWith", "(", "\"~\"", ")", ")", "{", "String", "home", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "input", "=", "home", "+", "input", ".", "substring", "(", "1", ")", ";", "}", "File", "file", "=", "new", "File", "(", "input", ")", ".", "getAbsoluteFile", "(", ")", ";", "input", "=", "file", ".", "toString", "(", ")", ";", "filetxt", ".", "setText", "(", "input", ")", ";", "if", "(", "!", "_validate", "(", "file", ")", ")", "{", "result", "=", "false", ";", "showMessage", "(", "INVALID", ")", ";", "}", "else", "{", "StringInputProcessingClient", "processingClient", "=", "new", "StringInputProcessingClient", "(", "input", ",", "validators", ")", ";", "boolean", "success", "=", "processingClient", ".", "validate", "(", ")", ";", "if", "(", "!", "success", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parentFrame", ",", "processingClient", ".", "getValidationMessage", "(", ")", ",", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ",", "JOptionPane", ".", "WARNING_MESSAGE", ")", ";", "}", "result", "=", "success", ";", "}", "}", "else", "{", "showMessage", "(", "EMPTY", ")", ";", "}", "return", "result", ";", "}", "protected", "boolean", "_validate", "(", "File", "file", ")", "{", "return", "file", ".", "isFile", "(", ")", ";", "}", "public", "boolean", "isAllowEmptyInput", "(", ")", "{", "return", "allowEmpty", ";", "}", "public", "void", "setAllowEmptyInput", "(", "boolean", "allowEmpty", ")", "{", "this", ".", "allowEmpty", "=", "allowEmpty", ";", "}", "}", "</s>" ]
10,681
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStreamReader", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "adaptator", ".", "IXMLElement", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "data", ".", "InstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "resource", ".", "Resources", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "substitutor", ".", "VariableSubstitutorImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ".", "ConsolePanels", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ".", "PanelConsole", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "console", ".", "PanelConsoleHelper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processor", ".", "Processor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Console", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "OsVersion", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "helper", ".", "SpecHelper", ";", "public", "class", "UserInputPanelConsoleHelper", "extends", "PanelConsoleHelper", "implements", "PanelConsole", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "UserInputPanelConsoleHelper", ".", "class", ".", "getName", "(", ")", ")", ";", "protected", "int", "instanceNumber", "=", "0", ";", "private", "static", "int", "instanceCount", "=", "0", ";", "private", "static", "final", "String", "SPEC_FILE_NAME", "=", "\"\"", ";", "private", "static", "final", "String", "NODE_ID", "=", "\"panel\"", ";", "private", "static", "final", "String", "INSTANCE_IDENTIFIER", "=", "\"order\"", ";", "protected", "static", "final", "String", "PANEL_IDENTIFIER", "=", "\"id\"", ";", "private", "static", "final", "String", "FIELD_NODE_ID", "=", "\"field\"", ";", "protected", "static", "final", "String", "ATTRIBUTE_CONDITIONID_NAME", "=", "\"conditionid\"", ";", "private", "static", "final", "String", "VARIABLE", "=", "\"variable\"", ";", "private", "static", "final", "String", "SET", "=", "\"set\"", ";", "private", "static", "final", "String", "TEXT", "=", "\"txt\"", ";", "private", "static", "final", "String", "SPEC", "=", "\"spec\"", ";", "private", "static", "final", "String", "PWD", "=", "\"pwd\"", ";", "private", "static", "final", "String", "TYPE_ATTRIBUTE", "=", "\"type\"", ";", "private", "static", "final", "String", "TEXT_FIELD", "=", "\"text\"", ";", "private", "static", "final", "String", "COMBO_FIELD", "=", "\"combo\"", ";", "private", "static", "final", "String", "STATIC_TEXT", "=", "\"staticText\"", ";", "private", "static", "final", "String", "CHOICE", "=", "\"choice\"", ";", "private", "static", "final", "String", "DIR", "=", "\"dir\"", ";", "private", "static", "final", "String", "FILE", "=", "\"file\"", ";", "private", "static", "final", "String", "PASSWORD", "=", "\"password\"", ";", "private", "static", "final", "String", "VALUE", "=", "\"value\"", ";", "private", "static", "final", "String", "RADIO_FIELD", "=", "\"radio\"", ";", "private", "static", "final", "String", "TITLE_FIELD", "=", "\"title\"", ";", "private", "static", "final", "String", "CHECK_FIELD", "=", "\"check\"", ";", "private", "static", "final", "String", "RULE_FIELD", "=", "\"rule\"", ";", "private", "static", "final", "String", "SPACE", "=", "\"space\"", ";", "private", "static", "final", "String", "DIVIDER", "=", "\"divider\"", ";", "static", "final", "String", "DISPLAY_FORMAT", "=", "\"\"", ";", "static", "final", "String", "PLAIN_STRING", "=", "\"plainString\"", ";", "static", "final", "String", "SPECIAL_SEPARATOR", "=", "\"\"", ";", "static", "final", "String", "LAYOUT", "=", "\"layout\"", ";", "static", "final", "String", "RESULT_FORMAT", "=", "\"resultFormat\"", ";", "private", "static", "final", "String", "DESCRIPTION", "=", "\"description\"", ";", "private", "static", "final", "String", "TRUE", "=", "\"true\"", ";", "private", "static", "final", "String", "NAME", "=", "\"name\"", ";", "private", "static", "final", "String", "FAMILY", "=", "\"family\"", ";", "private", "static", "final", "String", "OS", "=", "\"os\"", ";", "private", "static", "final", "String", "SELECTEDPACKS", "=", "\"\"", ";", "private", "static", "Input", "SPACE_INTPUT_FIELD", "=", "new", "Input", "(", "SPACE", ",", "null", ",", "null", ",", "SPACE", ",", "\"r\"", ",", "0", ")", ";", "private", "static", "Input", "DIVIDER_INPUT_FIELD", "=", "new", "Input", "(", "DIVIDER", ",", "null", ",", "null", ",", "DIVIDER", ",", "\"\"", ",", "0", ")", ";", "public", "List", "<", "Input", ">", "listInputs", ";", "private", "final", "Resources", "resources", ";", "private", "final", "ConsolePanels", "panels", ";", "public", "UserInputPanelConsoleHelper", "(", "Resources", "resources", ",", "ConsolePanels", "panels", ")", "{", "instanceNumber", "=", "instanceCount", "++", ";", "listInputs", "=", "new", "ArrayList", "<", "Input", ">", "(", ")", ";", "this", ".", "resources", "=", "resources", ";", "this", ".", "panels", "=", "panels", ";", "}", "@", "Override", "public", "boolean", "runConsoleFromProperties", "(", "InstallData", "installData", ",", "Properties", "properties", ")", "{", "collectInputs", "(", "installData", ")", ";", "for", "(", "Input", "listInput", ":", "listInputs", ")", "{", "String", "strVariableName", "=", "listInput", ".", "strVariableName", ";", "if", "(", "strVariableName", "!=", "null", ")", "{", "String", "strVariableValue", "=", "properties", ".", "getProperty", "(", "strVariableName", ")", ";", "if", "(", "strVariableValue", "!=", "null", ")", "{", "installData", ".", "setVariable", "(", "strVariableName", ",", "strVariableValue", ")", ";", "}", "}", "}", "return", "true", ";", "}", "@", "Override", "public", "boolean", "runGeneratePropertiesFile", "(", "InstallData", "installData", ",", "PrintWriter", "printWriter", ")", "{", "collectInputs", "(", "installData", ")", ";", "for", "(", "Input", "input", ":", "listInputs", ")", "{", "if", "(", "input", ".", "strVariableName", "!=", "null", ")", "{", "printWriter", ".", "println", "(", "input", ".", "strVariableName", "+", "\"=\"", ")", ";", "}", "}", "return", "true", ";", "}", "@", "Override", "public", "boolean", "runConsole", "(", "InstallData", "installData", ",", "Console", "console", ")", "{", "boolean", "processpanel", "=", "collectInputs", "(", "installData", ")", ";", "if", "(", "!", "processpanel", ")", "{", "return", "true", ";", "}", "boolean", "status", "=", "true", ";", "for", "(", "Input", "field", ":", "listInputs", ")", "{", "if", "(", "TEXT_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "FILE", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "RULE_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "DIR", ".", "equals", "(", "field", ".", "strFieldType", ")", ")", "{", "status", "=", "status", "&&", "processTextField", "(", "field", ",", "installData", ")", ";", "}", "else", "if", "(", "COMBO_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "RADIO_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", ")", "{", "status", "=", "status", "&&", "processComboRadioField", "(", "field", ",", "installData", ")", ";", "}", "else", "if", "(", "CHECK_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", ")", "{", "status", "=", "status", "&&", "processCheckField", "(", "field", ",", "installData", ")", ";", "}", "else", "if", "(", "STATIC_TEXT", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "TITLE_FIELD", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "DIVIDER", ".", "equals", "(", "field", ".", "strFieldType", ")", "||", "SPACE", ".", "equals", "(", "field", ".", "strFieldType", ")", ")", "{", "status", "=", "status", "&&", "processSimpleField", "(", "field", ",", "installData", ")", ";", "}", "else", "if", "(", "PASSWORD", ".", "equals", "(", "field", ".", "strFieldType", ")", ")", "{", "status", "=", "status", "&&", "processPasswordField", "(", "field", ",", "installData", ")", ";", "}", "}", "return", "promptEndPanel", "(", "installData", ",", "console", ")", ";", "}", "public", "boolean", "collectInputs", "(", "InstallData", "installData", ")", "{", "listInputs", ".", "clear", "(", ")", ";", "IXMLElement", "spec", "=", "null", ";", "List", "<", "IXMLElement", ">", "specElements", ";", "String", "attribute", ";", "String", "dataID", ";", "String", "panelid", "=", "panels", ".", "getPanel", "(", ")", ".", "getPanelId", "(", ")", ";", "String", "instance", "=", "Integer", ".", "toString", "(", "instanceNumber", ")", ";", "SpecHelper", "specHelper", "=", "new", "SpecHelper", "(", "resources", ")", ";", "try", "{", "specHelper", ".", "readSpec", "(", "specHelper", ".", "getResource", "(", "SPEC_FILE_NAME", ")", ")", ";", "}", "catch", "(", "Exception", "e1", ")", "{", "e1", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "specElements", "=", "specHelper", ".", "getSpec", "(", ")", ".", "getChildrenNamed", "(", "NODE_ID", ")", ";", "for", "(", "IXMLElement", "data", ":", "specElements", ")", "{", "attribute", "=", "data", ".", "getAttribute", "(", "INSTANCE_IDENTIFIER", ")", ";", "dataID", "=", "data", ".", "getAttribute", "(", "PANEL_IDENTIFIER", ")", ";", "if", "(", "(", "(", "attribute", "!=", "null", ")", "&&", "instance", ".", "equals", "(", "attribute", ")", ")", "||", "(", "(", "dataID", "!=", "null", ")", "&&", "(", "panelid", "!=", "null", ")", "&&", "(", "panelid", ".", "equals", "(", "dataID", ")", ")", ")", ")", "{", "List", "<", "IXMLElement", ">", "forPacks", "=", "data", ".", "getChildrenNamed", "(", "SELECTEDPACKS", ")", ";", "List", "<", "IXMLElement", ">", "forOs", "=", "data", ".", "getChildrenNamed", "(", "OS", ")", ";", "if", "(", "itemRequiredFor", "(", "forPacks", ",", "installData", ")", "&&", "itemRequiredForOs", "(", "forOs", ")", ")", "{", "spec", "=", "data", ";", "break", ";", "}", "}", "}", "if", "(", "spec", "==", "null", ")", "{", "return", "false", ";", "}", "List", "<", "IXMLElement", ">", "fields", "=", "spec", ".", "getChildrenNamed", "(", "FIELD_NODE_ID", ")", ";", "for", "(", "IXMLElement", "field", ":", "fields", ")", "{", "List", "<", "IXMLElement", ">", "forPacks", "=", "field", ".", "getChildrenNamed", "(", "SELECTEDPACKS", ")", ";", "List", "<", "IXMLElement", ">", "forOs", "=", "field", ".", "getChildrenNamed", "(", "OS", ")", ";", "if", "(", "itemRequiredFor", "(", "forPacks", ",", "installData", ")", "&&", "itemRequiredForOs", "(", "forOs", ")", ")", "{", "String", "conditionid", "=", "field", ".", "getAttribute", "(", "ATTRIBUTE_CONDITIONID_NAME", ")", ";", "if", "(", "conditionid", "!=", "null", ")", "{", "if", "(", "!", "installData", ".", "getRules", "(", ")", ".", "isConditionTrue", "(", "conditionid", ",", "installData", ")", ")", "{", "continue", ";", "}", "}", "Input", "in", "=", "getInputFromField", "(", "field", ",", "installData", ")", ";", "if", "(", "in", "!=", "null", ")", "{", "listInputs", ".", "add", "(", "in", ")", ";", "}", "}", "}", "return", "true", ";", "}", "boolean", "processSimpleField", "(", "Input", "input", ",", "InstallData", "idata", ")", "{", "VariableSubstitutor", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "try", "{", "System", ".", "out", ".", "println", "(", "variableSubstitutor", ".", "substitute", "(", "input", ".", "strText", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "input", ".", "strText", ")", ";", "}", "return", "true", ";", "}", "boolean", "processPasswordField", "(", "Input", "input", ",", "InstallData", "idata", ")", "{", "Password", "pwd", "=", "(", "Password", ")", "input", ";", "boolean", "rtn", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pwd", ".", "input", ".", "length", ";", "i", "++", ")", "{", "rtn", "=", "processTextField", "(", "pwd", ".", "input", "[", "i", "]", ",", "idata", ")", ";", "if", "(", "!", "rtn", ")", "{", "return", "rtn", ";", "}", "}", "return", "rtn", ";", "}", "boolean", "processTextField", "(", "Input", "input", ",", "InstallData", "idata", ")", "{", "String", "variable", "=", "input", ".", "strVariableName", ";", "String", "set", ";", "String", "fieldText", ";", "if", "(", "(", "variable", "==", "null", ")", "||", "(", "variable", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "false", ";", "}", "if", "(", "input", ".", "listChoices", ".", "size", "(", ")", "==", "0", ")", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "return", "false", ";", "}", "set", "=", "idata", ".", "getVariable", "(", "variable", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "input", ".", "strDefaultValue", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "\"\"", ";", "}", "}", "if", "(", "!", "\"\"", ".", "equals", "(", "set", ")", ")", "{", "VariableSubstitutor", "vs", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "try", "{", "set", "=", "vs", ".", "substitute", "(", "set", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "}", "fieldText", "=", "input", ".", "listChoices", ".", "get", "(", "0", ")", ".", "strText", ";", "System", ".", "out", ".", "println", "(", "fieldText", "+", "\"", "[\"", "+", "set", "+", "\"]", "\"", ")", ";", "try", "{", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "System", ".", "in", ")", ")", ";", "String", "strIn", "=", "br", ".", "readLine", "(", ")", ";", "if", "(", "!", "strIn", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "idata", ".", "setVariable", "(", "variable", ",", "strIn", ")", ";", "}", "else", "{", "idata", ".", "setVariable", "(", "variable", ",", "set", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "true", ";", "}", "boolean", "processComboRadioField", "(", "Input", "input", ",", "InstallData", "idata", ")", "{", "String", "variable", "=", "input", ".", "strVariableName", ";", "if", "(", "(", "variable", "==", "null", ")", "||", "(", "variable", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "false", ";", "}", "String", "currentvariablevalue", "=", "idata", ".", "getVariable", "(", "variable", ")", ";", "input", ".", "iSelectedChoice", "=", "-", "1", ";", "boolean", "userinput", "=", "false", ";", "if", "(", "input", ".", "strText", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "input", ".", "strText", ")", ";", "}", "List", "<", "Choice", ">", "lisChoices", "=", "input", ".", "listChoices", ";", "if", "(", "lisChoices", ".", "size", "(", ")", "==", "0", ")", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "return", "false", ";", "}", "if", "(", "currentvariablevalue", "!=", "null", ")", "{", "userinput", "=", "true", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lisChoices", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Choice", "choice", "=", "lisChoices", ".", "get", "(", "i", ")", ";", "String", "value", "=", "choice", ".", "strValue", ";", "if", "(", "userinput", ")", "{", "if", "(", "(", "value", "!=", "null", ")", "&&", "(", "value", ".", "length", "(", ")", ">", "0", ")", "&&", "(", "currentvariablevalue", ".", "equals", "(", "value", ")", ")", ")", "{", "input", ".", "iSelectedChoice", "=", "i", ";", "}", "}", "else", "{", "String", "set", "=", "choice", ".", "strSet", ";", "if", "(", "set", "!=", "null", ")", "{", "if", "(", "set", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "set", ")", ")", "{", "VariableSubstitutor", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "set", "=", "variableSubstitutor", ".", "substitute", "(", "set", ")", ";", "}", "if", "(", "set", ".", "equals", "(", "TRUE", ")", ")", "{", "input", ".", "iSelectedChoice", "=", "i", ";", "}", "}", "}", "System", ".", "out", ".", "println", "(", "i", "+", "\"", "[\"", "+", "(", "input", ".", "iSelectedChoice", "==", "i", "?", "\"x\"", ":", "\"", "\"", ")", "+", "\"]", "\"", "+", "(", "choice", ".", "strText", "!=", "null", "?", "choice", ".", "strText", ":", "\"\"", ")", ")", ";", "}", "try", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "System", ".", "in", ")", ")", ";", "boolean", "bKeepAsking", "=", "true", ";", "while", "(", "bKeepAsking", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "String", "strIn", "=", "reader", ".", "readLine", "(", ")", ";", "if", "(", "strIn", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", "&&", "input", ".", "iSelectedChoice", "!=", "-", "1", ")", "{", "bKeepAsking", "=", "false", ";", "}", "int", "j", "=", "-", "1", ";", "try", "{", "j", "=", "Integer", ".", "valueOf", "(", "strIn", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "}", "if", "(", "j", ">=", "0", "&&", "j", "<", "lisChoices", ".", "size", "(", ")", ")", "{", "input", ".", "iSelectedChoice", "=", "j", ";", "bKeepAsking", "=", "false", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "idata", ".", "setVariable", "(", "variable", ",", "input", ".", "listChoices", ".", "get", "(", "input", ".", "iSelectedChoice", ")", ".", "strValue", ")", ";", "return", "true", ";", "}", "boolean", "processCheckField", "(", "Input", "input", ",", "InstallData", "idata", ")", "{", "String", "variable", "=", "input", ".", "strVariableName", ";", "if", "(", "(", "variable", "==", "null", ")", "||", "(", "variable", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "false", ";", "}", "String", "currentvariablevalue", "=", "idata", ".", "getVariable", "(", "variable", ")", ";", "if", "(", "currentvariablevalue", "==", "null", ")", "{", "currentvariablevalue", "=", "\"\"", ";", "}", "List", "<", "Choice", ">", "lisChoices", "=", "input", ".", "listChoices", ";", "if", "(", "lisChoices", ".", "size", "(", ")", "==", "0", ")", "{", "logger", ".", "warning", "(", "\"\"", ")", ";", "return", "false", ";", "}", "Choice", "choice", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lisChoices", ".", "size", "(", ")", ";", "i", "++", ")", "{", "choice", "=", "lisChoices", ".", "get", "(", "i", ")", ";", "String", "value", "=", "choice", ".", "strValue", ";", "if", "(", "(", "value", "!=", "null", ")", "&&", "(", "value", ".", "length", "(", ")", ">", "0", ")", "&&", "(", "currentvariablevalue", ".", "equals", "(", "value", ")", ")", ")", "{", "input", ".", "iSelectedChoice", "=", "i", ";", "}", "else", "{", "String", "set", "=", "input", ".", "strDefaultValue", ";", "if", "(", "set", "!=", "null", ")", "{", "if", "(", "set", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "set", ")", ")", "{", "VariableSubstitutor", "vs", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "try", "{", "set", "=", "vs", ".", "substitute", "(", "set", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "if", "(", "set", ".", "equals", "(", "TRUE", ")", ")", "{", "input", ".", "iSelectedChoice", "=", "1", ";", "}", "}", "}", "}", "System", ".", "out", ".", "println", "(", "\"", "[\"", "+", "(", "input", ".", "iSelectedChoice", "==", "1", "?", "\"x\"", ":", "\"", "\"", ")", "+", "\"]", "\"", "+", "(", "choice", ".", "strText", "!=", "null", "?", "choice", ".", "strText", ":", "\"\"", ")", ")", ";", "try", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "System", ".", "in", ")", ")", ";", "boolean", "bKeepAsking", "=", "true", ";", "while", "(", "bKeepAsking", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "String", "strIn", "=", "reader", ".", "readLine", "(", ")", ";", "if", "(", "strIn", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "bKeepAsking", "=", "false", ";", "}", "int", "j", "=", "-", "1", ";", "try", "{", "j", "=", "Integer", ".", "valueOf", "(", "strIn", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "}", "if", "(", "(", "j", "==", "0", ")", "||", "j", "==", "1", ")", "{", "input", ".", "iSelectedChoice", "=", "j", ";", "bKeepAsking", "=", "false", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "idata", ".", "setVariable", "(", "variable", ",", "input", ".", "listChoices", ".", "get", "(", "input", ".", "iSelectedChoice", ")", ".", "strValue", ")", ";", "return", "true", ";", "}", "public", "Input", "getInputFromField", "(", "IXMLElement", "field", ",", "InstallData", "idata", ")", "{", "String", "strVariableName", "=", "field", ".", "getAttribute", "(", "VARIABLE", ")", ";", "String", "strFieldType", "=", "field", ".", "getAttribute", "(", "TYPE_ATTRIBUTE", ")", ";", "if", "(", "TITLE_FIELD", ".", "equals", "(", "strFieldType", ")", ")", "{", "String", "strText", "=", "null", ";", "strText", "=", "field", ".", "getAttribute", "(", "TEXT", ")", ";", "return", "new", "Input", "(", "strVariableName", ",", "null", ",", "null", ",", "TITLE_FIELD", ",", "strText", ",", "0", ")", ";", "}", "if", "(", "STATIC_TEXT", ".", "equals", "(", "strFieldType", ")", ")", "{", "String", "strText", "=", "null", ";", "strText", "=", "field", ".", "getAttribute", "(", "TEXT", ")", ";", "return", "new", "Input", "(", "strVariableName", ",", "null", ",", "null", ",", "STATIC_TEXT", ",", "strText", ",", "0", ")", ";", "}", "if", "(", "TEXT_FIELD", ".", "equals", "(", "strFieldType", ")", "||", "FILE", ".", "equals", "(", "strFieldType", ")", "||", "DIR", ".", "equals", "(", "strFieldType", ")", ")", "{", "List", "<", "Choice", ">", "choicesList", "=", "new", "ArrayList", "<", "Choice", ">", "(", ")", ";", "String", "strFieldText", "=", "null", ";", "String", "strSet", "=", "null", ";", "String", "strText", "=", "null", ";", "IXMLElement", "spec", "=", "field", ".", "getFirstChildNamed", "(", "SPEC", ")", ";", "IXMLElement", "description", "=", "field", ".", "getFirstChildNamed", "(", "DESCRIPTION", ")", ";", "if", "(", "spec", "!=", "null", ")", "{", "strText", "=", "spec", ".", "getAttribute", "(", "TEXT", ")", ";", "strSet", "=", "spec", ".", "getAttribute", "(", "SET", ")", ";", "}", "if", "(", "description", "!=", "null", ")", "{", "strFieldText", "=", "description", ".", "getAttribute", "(", "TEXT", ")", ";", "}", "choicesList", ".", "add", "(", "new", "Choice", "(", "strText", ",", "null", ",", "strSet", ")", ")", ";", "return", "new", "Input", "(", "strVariableName", ",", "strSet", ",", "choicesList", ",", "strFieldType", ",", "strFieldText", ",", "0", ")", ";", "}", "if", "(", "RULE_FIELD", ".", "equals", "(", "strFieldType", ")", ")", "{", "List", "<", "Choice", ">", "choicesList", "=", "new", "ArrayList", "<", "Choice", ">", "(", ")", ";", "String", "strFieldText", "=", "null", ";", "String", "strSet", "=", "null", ";", "String", "strText", "=", "null", ";", "IXMLElement", "spec", "=", "field", ".", "getFirstChildNamed", "(", "SPEC", ")", ";", "IXMLElement", "description", "=", "field", ".", "getFirstChildNamed", "(", "DESCRIPTION", ")", ";", "if", "(", "spec", "!=", "null", ")", "{", "strText", "=", "spec", ".", "getAttribute", "(", "TEXT", ")", ";", "strSet", "=", "spec", ".", "getAttribute", "(", "SET", ")", ";", "}", "if", "(", "description", "!=", "null", ")", "{", "strFieldText", "=", "description", ".", "getAttribute", "(", "TEXT", ")", ";", "}", "if", "(", "strSet", "!=", "null", "&&", "spec", ".", "getAttribute", "(", "LAYOUT", ")", "!=", "null", ")", "{", "StringTokenizer", "layoutTokenizer", "=", "new", "StringTokenizer", "(", "spec", ".", "getAttribute", "(", "LAYOUT", ")", ")", ";", "List", "<", "String", ">", "listSet", "=", "Arrays", ".", "asList", "(", "new", "String", "[", "layoutTokenizer", ".", "countTokens", "(", ")", "]", ")", ";", "StringTokenizer", "setTokenizer", "=", "new", "StringTokenizer", "(", "strSet", ")", ";", "String", "token", ";", "while", "(", "setTokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "setTokenizer", ".", "nextToken", "(", ")", ";", "if", "(", "token", ".", "contains", "(", "\":\"", ")", ")", "{", "listSet", ".", "set", "(", "new", "Integer", "(", "token", ".", "substring", "(", "0", ",", "token", ".", "indexOf", "(", "\":\"", ")", ")", ")", ",", "token", ".", "substring", "(", "token", ".", "indexOf", "(", "\":\"", ")", "+", "1", ")", ")", ";", "}", "}", "int", "iCounter", "=", "0", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "String", "strRusultFormat", "=", "spec", ".", "getAttribute", "(", "RESULT_FORMAT", ")", ";", "String", "strSpecialSeparator", "=", "spec", ".", "getAttribute", "(", "SPECIAL_SEPARATOR", ")", ";", "while", "(", "layoutTokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "layoutTokenizer", ".", "nextToken", "(", ")", ";", "if", "(", "token", ".", "matches", "(", "\".*:.*:.*\"", ")", ")", "{", "buffer", ".", "append", "(", "listSet", ".", "get", "(", "iCounter", ")", "!=", "null", "?", "listSet", ".", "get", "(", "iCounter", ")", ":", "\"\"", ")", ";", "iCounter", "++", ";", "}", "else", "{", "if", "(", "SPECIAL_SEPARATOR", ".", "equals", "(", "strRusultFormat", ")", ")", "{", "buffer", ".", "append", "(", "strSpecialSeparator", ")", ";", "}", "else", "if", "(", "PLAIN_STRING", ".", "equals", "(", "strRusultFormat", ")", ")", "{", "}", "else", "{", "buffer", ".", "append", "(", "token", ")", ";", "}", "}", "}", "strSet", "=", "buffer", ".", "toString", "(", ")", ";", "}", "choicesList", ".", "add", "(", "new", "Choice", "(", "strText", ",", "null", ",", "strSet", ")", ")", ";", "return", "new", "Input", "(", "strVariableName", ",", "strSet", ",", "choicesList", ",", "TEXT_FIELD", ",", "strFieldText", ",", "0", ")", ";", "}", "if", "(", "COMBO_FIELD", ".", "equals", "(", "strFieldType", ")", "||", "RADIO_FIELD", ".", "equals", "(", "strFieldType", ")", ")", "{", "List", "<", "Choice", ">", "choicesList", "=", "new", "ArrayList", "<", "Choice", ">", "(", ")", ";", "String", "strFieldText", "=", "null", ";", "int", "selection", "=", "-", "1", ";", "IXMLElement", "spec", "=", "field", ".", "getFirstChildNamed", "(", "SPEC", ")", ";", "IXMLElement", "description", "=", "field", ".", "getFirstChildNamed", "(", "DESCRIPTION", ")", ";", "List", "<", "IXMLElement", ">", "choices", "=", "null", ";", "if", "(", "spec", "!=", "null", ")", "{", "choices", "=", "spec", ".", "getChildrenNamed", "(", "CHOICE", ")", ";", "}", "if", "(", "description", "!=", "null", ")", "{", "strFieldText", "=", "description", ".", "getAttribute", "(", "TEXT", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "choices", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IXMLElement", "choice", "=", "choices", ".", "get", "(", "i", ")", ";", "String", "processorClass", "=", "choice", ".", "getAttribute", "(", "\"processor\"", ")", ";", "if", "(", "processorClass", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "processorClass", ")", ")", "{", "String", "choiceValues", "=", "\"\"", ";", "try", "{", "choiceValues", "=", "(", "(", "Processor", ")", "Class", ".", "forName", "(", "processorClass", ")", ".", "newInstance", "(", ")", ")", ".", "process", "(", "null", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "t", ".", "printStackTrace", "(", ")", ";", "}", "String", "set", "=", "choice", ".", "getAttribute", "(", "SET", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "\"\"", ";", "}", "if", "(", "set", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "set", ")", ")", "{", "VariableSubstitutor", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "set", "=", "variableSubstitutor", ".", "substitute", "(", "set", ")", ";", "}", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "choiceValues", ",", "\":\"", ")", ";", "int", "counter", "=", "0", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "String", "choiceSet", "=", "null", ";", "if", "(", "token", ".", "equals", "(", "set", ")", ")", "{", "choiceSet", "=", "\"true\"", ";", "selection", "=", "counter", ";", "}", "choicesList", ".", "add", "(", "new", "Choice", "(", "token", ",", "token", ",", "choiceSet", ")", ")", ";", "counter", "++", ";", "}", "}", "else", "{", "String", "value", "=", "choice", ".", "getAttribute", "(", "VALUE", ")", ";", "String", "set", "=", "choice", ".", "getAttribute", "(", "SET", ")", ";", "if", "(", "set", "!=", "null", ")", "{", "if", "(", "set", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "set", ")", ")", "{", "VariableSubstitutor", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "set", "=", "variableSubstitutor", ".", "substitute", "(", "set", ")", ";", "}", "if", "(", "set", ".", "equalsIgnoreCase", "(", "TRUE", ")", ")", "{", "selection", "=", "i", ";", "}", "}", "choicesList", ".", "add", "(", "new", "Choice", "(", "choice", ".", "getAttribute", "(", "TEXT", ")", ",", "value", ",", "set", ")", ")", ";", "}", "}", "if", "(", "choicesList", ".", "size", "(", ")", "==", "1", ")", "{", "selection", "=", "0", ";", "}", "return", "new", "Input", "(", "strVariableName", ",", "null", ",", "choicesList", ",", "strFieldType", ",", "strFieldText", ",", "selection", ")", ";", "}", "if", "(", "CHECK_FIELD", ".", "equals", "(", "strFieldType", ")", ")", "{", "List", "<", "Choice", ">", "choicesList", "=", "new", "ArrayList", "<", "Choice", ">", "(", ")", ";", "String", "strFieldText", "=", "null", ";", "String", "strSet", "=", "null", ";", "String", "strText", "=", "null", ";", "int", "iSelectedChoice", "=", "0", ";", "IXMLElement", "spec", "=", "field", ".", "getFirstChildNamed", "(", "SPEC", ")", ";", "IXMLElement", "description", "=", "field", ".", "getFirstChildNamed", "(", "DESCRIPTION", ")", ";", "if", "(", "spec", "!=", "null", ")", "{", "strText", "=", "spec", ".", "getAttribute", "(", "TEXT", ")", ";", "strSet", "=", "spec", ".", "getAttribute", "(", "SET", ")", ";", "choicesList", ".", "add", "(", "new", "Choice", "(", "strText", ",", "spec", ".", "getAttribute", "(", "\"false\"", ")", ",", "null", ")", ")", ";", "choicesList", ".", "add", "(", "new", "Choice", "(", "strText", ",", "spec", ".", "getAttribute", "(", "\"true\"", ")", ",", "null", ")", ")", ";", "if", "(", "strSet", "!=", "null", ")", "{", "if", "(", "strSet", ".", "equalsIgnoreCase", "(", "TRUE", ")", ")", "{", "iSelectedChoice", "=", "1", ";", "}", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "if", "(", "description", "!=", "null", ")", "{", "strFieldText", "=", "description", ".", "getAttribute", "(", "TEXT", ")", ";", "}", "return", "new", "Input", "(", "strVariableName", ",", "strSet", ",", "choicesList", ",", "CHECK_FIELD", ",", "strFieldText", ",", "iSelectedChoice", ")", ";", "}", "if", "(", "SPACE", ".", "equals", "(", "strFieldType", ")", ")", "{", "return", "SPACE_INTPUT_FIELD", ";", "}", "if", "(", "DIVIDER", ".", "equals", "(", "strFieldType", ")", ")", "{", "return", "DIVIDER_INPUT_FIELD", ";", "}", "if", "(", "PASSWORD", ".", "equals", "(", "strFieldType", ")", ")", "{", "List", "<", "Choice", ">", "choicesList", "=", "new", "ArrayList", "<", "Choice", ">", "(", ")", ";", "String", "strFieldText", "=", "null", ";", "String", "strSet", "=", "null", ";", "String", "strText", "=", "null", ";", "IXMLElement", "spec", "=", "field", ".", "getFirstChildNamed", "(", "SPEC", ")", ";", "if", "(", "spec", "!=", "null", ")", "{", "List", "<", "IXMLElement", ">", "pwds", "=", "spec", ".", "getChildrenNamed", "(", "PWD", ")", ";", "if", "(", "pwds", "==", "null", "||", "pwds", ".", "size", "(", ")", "==", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "return", "null", ";", "}", "Input", "[", "]", "inputs", "=", "new", "Input", "[", "pwds", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pwds", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IXMLElement", "pwde", "=", "pwds", ".", "get", "(", "i", ")", ";", "strText", "=", "pwde", ".", "getAttribute", "(", "TEXT", ")", ";", "strSet", "=", "pwde", ".", "getAttribute", "(", "SET", ")", ";", "choicesList", ".", "add", "(", "new", "Choice", "(", "strText", ",", "null", ",", "strSet", ")", ")", ";", "inputs", "[", "i", "]", "=", "new", "Input", "(", "strVariableName", ",", "strSet", ",", "choicesList", ",", "strFieldType", ",", "strFieldText", ",", "0", ")", ";", "}", "return", "new", "Password", "(", "strFieldType", ",", "inputs", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "return", "null", ";", "}", "System", ".", "out", ".", "println", "(", "strFieldType", "+", "\"\"", ")", ";", "return", "null", ";", "}", "private", "boolean", "itemRequiredFor", "(", "List", "<", "IXMLElement", ">", "packs", ",", "InstallData", "idata", ")", "{", "String", "selected", ";", "String", "required", ";", "if", "(", "packs", ".", "size", "(", ")", "==", "0", ")", "{", "return", "(", "true", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idata", ".", "getSelectedPacks", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "selected", "=", "idata", ".", "getSelectedPacks", "(", ")", ".", "get", "(", "i", ")", ".", "getName", "(", ")", ";", "for", "(", "IXMLElement", "pack", ":", "packs", ")", "{", "required", "=", "pack", ".", "getAttribute", "(", "NAME", ",", "\"\"", ")", ";", "if", "(", "selected", ".", "equals", "(", "required", ")", ")", "{", "return", "(", "true", ")", ";", "}", "}", "}", "return", "(", "false", ")", ";", "}", "public", "boolean", "itemRequiredForOs", "(", "List", "<", "IXMLElement", ">", "os", ")", "{", "if", "(", "os", ".", "size", "(", ")", "==", "0", ")", "{", "return", "true", ";", "}", "for", "(", "IXMLElement", "osElement", ":", "os", ")", "{", "String", "family", "=", "osElement", ".", "getAttribute", "(", "FAMILY", ")", ";", "boolean", "match", "=", "false", ";", "if", "(", "\"windows\"", ".", "equals", "(", "family", ")", ")", "{", "match", "=", "OsVersion", ".", "IS_WINDOWS", ";", "}", "else", "if", "(", "\"mac\"", ".", "equals", "(", "family", ")", ")", "{", "match", "=", "OsVersion", ".", "IS_OSX", ";", "}", "else", "if", "(", "\"unix\"", ".", "equals", "(", "family", ")", ")", "{", "match", "=", "OsVersion", ".", "IS_UNIX", ";", "}", "if", "(", "match", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "static", "class", "Input", "{", "public", "Input", "(", "String", "strFieldType", ")", "{", "this", ".", "strFieldType", "=", "strFieldType", ";", "}", "public", "Input", "(", "String", "strVariableName", ",", "String", "strDefaultValue", ",", "List", "<", "Choice", ">", "listChoices", ",", "String", "strFieldType", ",", "String", "strFieldText", ",", "int", "iSelectedChoice", ")", "{", "this", ".", "strVariableName", "=", "strVariableName", ";", "this", ".", "strDefaultValue", "=", "strDefaultValue", ";", "this", ".", "listChoices", "=", "listChoices", ";", "this", ".", "strFieldType", "=", "strFieldType", ";", "this", ".", "strText", "=", "strFieldText", ";", "this", ".", "iSelectedChoice", "=", "iSelectedChoice", ";", "}", "String", "strVariableName", ";", "String", "strDefaultValue", ";", "List", "<", "Choice", ">", "listChoices", ";", "String", "strFieldType", ";", "String", "strText", ";", "int", "iSelectedChoice", "=", "-", "1", ";", "}", "public", "static", "class", "Choice", "{", "public", "Choice", "(", "String", "strText", ",", "String", "strValue", ",", "String", "strSet", ")", "{", "this", ".", "strText", "=", "strText", ";", "this", ".", "strValue", "=", "strValue", ";", "this", ".", "strSet", "=", "strSet", ";", "}", "String", "strText", ";", "String", "strValue", ";", "String", "strSet", ";", "}", "public", "static", "class", "Password", "extends", "Input", "{", "public", "Password", "(", "String", "strFieldType", ",", "Input", "[", "]", "input", ")", "{", "super", "(", "strFieldType", ")", ";", "this", ".", "input", "=", "input", ";", "}", "Input", "[", "]", "input", ";", "}", "}", "</s>" ]
10,682
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "public", "enum", "UIElementType", "{", "LABEL", ",", "TEXT", ",", "CHECKBOX", ",", "MULTIPLE_FILE", ",", "FILE", ",", "DIRECTORY", ",", "RULE", ",", "COMBOBOX", ",", "RADIOBUTTON", ",", "PASSWORD", ",", "SEARCH", ",", "SEARCHBUTTON", ",", "SPACE", ",", "DIVIDER", ",", "DESCRIPTION", "}", "</s>" ]
10,683
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "javax", ".", "swing", ".", "JTextField", ";", "import", "javax", ".", "swing", ".", "text", ".", "AttributeSet", ";", "import", "javax", ".", "swing", ".", "text", ".", "BadLocationException", ";", "import", "javax", ".", "swing", ".", "text", ".", "Document", ";", "import", "javax", ".", "swing", ".", "text", ".", "PlainDocument", ";", "import", "java", ".", "awt", ".", "Toolkit", ";", "public", "class", "RuleTextField", "extends", "JTextField", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3976731454594365493L", ";", "public", "static", "final", "int", "N", "=", "1", ";", "public", "static", "final", "int", "H", "=", "2", ";", "public", "static", "final", "int", "A", "=", "3", ";", "public", "static", "final", "int", "O", "=", "4", ";", "public", "static", "final", "int", "AN", "=", "5", ";", "private", "int", "columns", ";", "private", "int", "editLength", ";", "private", "boolean", "unlimitedEdit", ";", "private", "Toolkit", "toolkit", ";", "public", "RuleTextField", "(", "int", "digits", ",", "int", "editLength", ",", "int", "type", ",", "boolean", "unlimitedEdit", ",", "Toolkit", "toolkit", ")", "{", "super", "(", "digits", "+", "1", ")", ";", "setColumns", "(", "digits", ")", ";", "this", ".", "toolkit", "=", "toolkit", ";", "this", ".", "editLength", "=", "editLength", ";", "this", ".", "unlimitedEdit", "=", "unlimitedEdit", ";", "Rule", "rule", "=", "new", "Rule", "(", ")", ";", "rule", ".", "setRuleType", "(", "type", ",", "editLength", ",", "unlimitedEdit", ")", ";", "setDocument", "(", "rule", ")", ";", "}", "protected", "Document", "createDefaultModel", "(", ")", "{", "Rule", "rule", "=", "new", "Rule", "(", ")", ";", "return", "(", "rule", ")", ";", "}", "public", "int", "getColumns", "(", ")", "{", "return", "(", "columns", ")", ";", "}", "public", "int", "getEditLength", "(", ")", "{", "return", "(", "editLength", ")", ";", "}", "public", "boolean", "unlimitedEdit", "(", ")", "{", "return", "(", "unlimitedEdit", ")", ";", "}", "public", "void", "setColumns", "(", "int", "columns", ")", "{", "super", ".", "setColumns", "(", "columns", "+", "1", ")", ";", "this", ".", "columns", "=", "columns", ";", "}", "class", "Rule", "extends", "PlainDocument", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3258134643651063862L", ";", "private", "int", "editLength", ";", "private", "int", "type", ";", "private", "boolean", "unlimitedEdit", ";", "public", "void", "setRuleType", "(", "int", "type", ",", "int", "editLength", ",", "boolean", "unlimitedEdit", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "editLength", "=", "editLength", ";", "this", ".", "unlimitedEdit", "=", "unlimitedEdit", ";", "}", "public", "void", "insertString", "(", "int", "offs", ",", "String", "str", ",", "AttributeSet", "a", ")", "throws", "BadLocationException", "{", "if", "(", "str", "==", "null", ")", "{", "return", ";", "}", "int", "totalSize", "=", "getLength", "(", ")", "+", "str", ".", "length", "(", ")", ";", "if", "(", "(", "totalSize", "<=", "editLength", ")", "||", "(", "unlimitedEdit", ")", ")", "{", "boolean", "error", "=", "false", ";", "if", "(", "type", "==", "N", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isDigit", "(", "str", ".", "charAt", "(", "i", ")", ")", ")", "{", "error", "=", "true", ";", "}", "}", "}", "else", "if", "(", "type", "==", "H", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "focusChar", "=", "Character", ".", "toUpperCase", "(", "str", ".", "charAt", "(", "i", ")", ")", ";", "if", "(", "!", "Character", ".", "isDigit", "(", "focusChar", ")", "&&", "(", "focusChar", "!=", "'A'", ")", "&&", "(", "focusChar", "!=", "'B'", ")", "&&", "(", "focusChar", "!=", "'C'", ")", "&&", "(", "focusChar", "!=", "'D'", ")", "&&", "(", "focusChar", "!=", "'E'", ")", "&&", "(", "focusChar", "!=", "'F'", ")", ")", "{", "error", "=", "true", ";", "}", "}", "}", "else", "if", "(", "type", "==", "A", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isLetter", "(", "str", ".", "charAt", "(", "i", ")", ")", ")", "{", "error", "=", "true", ";", "}", "}", "}", "else", "if", "(", "type", "==", "AN", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isLetterOrDigit", "(", "str", ".", "charAt", "(", "i", ")", ")", ")", "{", "error", "=", "true", ";", "}", "}", "}", "else", "if", "(", "type", "==", "O", ")", "{", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"type", "=", "\"", "+", "type", ")", ";", "}", "if", "(", "!", "error", ")", "{", "super", ".", "insertString", "(", "offs", ",", "str", ",", "a", ")", ";", "}", "else", "{", "toolkit", ".", "beep", "(", ")", ";", "}", "}", "else", "{", "toolkit", ".", "beep", "(", ")", ";", "}", "}", "}", "}", "</s>" ]
10,684
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "Validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "ValidatorContainer", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "StringInputProcessingClient", "implements", "ProcessingClient", "{", "private", "String", "input", ";", "private", "List", "<", "ValidatorContainer", ">", "validators", ";", "private", "ValidatorContainer", "currentValidator", ";", "private", "String", "message", ";", "public", "StringInputProcessingClient", "(", "String", "input", ",", "List", "<", "ValidatorContainer", ">", "validators", ")", "{", "this", ".", "input", "=", "input", ";", "this", ".", "validators", "=", "validators", ";", "}", "public", "String", "getFieldContents", "(", "int", "index", ")", "{", "return", "input", ";", "}", "public", "int", "getNumFields", "(", ")", "{", "return", "1", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "this", ".", "input", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "(", "currentValidator", "!=", "null", ")", "?", "currentValidator", ".", "getValidatorParams", "(", ")", ":", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "public", "boolean", "hasParams", "(", ")", "{", "return", "(", "currentValidator", "!=", "null", ")", "?", "currentValidator", ".", "hasParams", "(", ")", ":", "false", ";", "}", "public", "boolean", "validate", "(", ")", "{", "boolean", "success", "=", "true", ";", "if", "(", "validators", "!=", "null", ")", "{", "for", "(", "ValidatorContainer", "validator", ":", "validators", ")", "{", "currentValidator", "=", "validator", ";", "Validator", "validatorInstance", "=", "currentValidator", ".", "getValidator", "(", ")", ";", "if", "(", "validatorInstance", "!=", "null", ")", "{", "success", "=", "validatorInstance", ".", "validate", "(", "this", ")", ";", "if", "(", "!", "success", ")", "{", "message", "=", "currentValidator", ".", "getMessage", "(", ")", ";", "break", ";", "}", "}", "}", "}", "return", "success", ";", "}", "public", "String", "getValidationMessage", "(", ")", "{", "return", "message", ";", "}", "}", "</s>" ]
10,685
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JComponent", ";", "import", "javax", ".", "swing", ".", "JTextField", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "Validator", ";", "public", "class", "TextInputField", "extends", "JComponent", "implements", "ProcessingClient", "{", "private", "static", "final", "long", "serialVersionUID", "=", "8611515659787697087L", ";", "private", "static", "final", "transient", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "TextInputField", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "Map", "<", "String", ",", "String", ">", "validatorParams", ";", "private", "Validator", "validationService", ";", "private", "JTextField", "field", ";", "private", "boolean", "hasParams", "=", "false", ";", "public", "TextInputField", "(", "String", "set", ",", "int", "size", ",", "String", "validator", ",", "Map", "<", "String", ",", "String", ">", "validatorParams", ")", "{", "this", "(", "set", ",", "size", ",", "validator", ")", ";", "this", ".", "validatorParams", "=", "validatorParams", ";", "this", ".", "hasParams", "=", "true", ";", "}", "public", "TextInputField", "(", "String", "set", ",", "int", "size", ",", "String", "validator", ")", "{", "try", "{", "if", "(", "validator", "!=", "null", ")", "{", "logger", ".", "fine", "(", "\"\"", "+", "validator", ")", ";", "validationService", "=", "(", "Validator", ")", "Class", ".", "forName", "(", "validator", ")", ".", "newInstance", "(", ")", ";", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "validationService", "=", "null", ";", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", "layout", "=", "new", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", "(", ")", ";", "layout", ".", "setAlignment", "(", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", ".", "LEADING", ")", ";", "layout", ".", "setVgap", "(", "0", ")", ";", "setLayout", "(", "layout", ")", ";", "field", "=", "new", "JTextField", "(", "set", ",", "size", ")", ";", "field", ".", "setCaretPosition", "(", "0", ")", ";", "add", "(", "field", ")", ";", "}", "@", "Override", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "validatorParams", ";", "}", "@", "Override", "public", "String", "getText", "(", ")", "{", "return", "(", "field", ".", "getText", "(", ")", ")", ";", "}", "public", "void", "setText", "(", "String", "value", ")", "{", "field", ".", "setText", "(", "value", ")", ";", "}", "@", "Override", "public", "String", "getFieldContents", "(", "int", "index", ")", "{", "return", "field", ".", "getText", "(", ")", ";", "}", "@", "Override", "public", "int", "getNumFields", "(", ")", "{", "return", "1", ";", "}", "public", "boolean", "validateContents", "(", ")", "{", "if", "(", "validationService", "!=", "null", ")", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "return", "(", "validationService", ".", "validate", "(", "this", ")", ")", ";", "}", "else", "{", "logger", ".", "fine", "(", "\"\"", ")", ";", "return", "(", "true", ")", ";", "}", "}", "@", "Override", "public", "boolean", "hasParams", "(", ")", "{", "return", "hasParams", ";", "}", "}", "</s>" ]
10,686
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ";", "import", "java", ".", "awt", ".", "Toolkit", ";", "import", "java", ".", "awt", ".", "event", ".", "FocusEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "FocusListener", ";", "import", "java", ".", "awt", ".", "event", ".", "KeyEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "KeyListener", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "java", ".", "util", ".", "Vector", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JComponent", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JTextField", ";", "import", "javax", ".", "swing", ".", "event", ".", "CaretEvent", ";", "import", "javax", ".", "swing", ".", "event", ".", "CaretListener", ";", "import", "org", ".", "apache", ".", "regexp", ".", "RE", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "core", ".", "substitutor", ".", "VariableSubstitutorImpl", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "RuleTextField", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processor", ".", "Processor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "Validator", ";", "public", "class", "RuleInputField", "extends", "JComponent", "implements", "KeyListener", ",", "FocusListener", ",", "CaretListener", ",", "ProcessingClient", "{", "private", "static", "final", "long", "serialVersionUID", "=", "3832616275124958257L", ";", "private", "static", "final", "transient", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "RuleInputField", ".", "class", ".", "getName", "(", ")", ")", ";", "public", "static", "final", "int", "PLAIN_STRING", "=", "1", ";", "public", "static", "final", "int", "DISPLAY_FORMAT", "=", "2", ";", "public", "static", "final", "int", "SPECIAL_SEPARATOR", "=", "3", ";", "public", "static", "final", "int", "ENCRYPTED", "=", "4", ";", "private", "static", "int", "DEFAULT", "=", "DISPLAY_FORMAT", ";", "private", "Vector", "<", "Serializable", ">", "items", "=", "new", "Vector", "<", "Serializable", ">", "(", ")", ";", "private", "Vector", "<", "JTextField", ">", "inputFields", "=", "new", "Vector", "<", "JTextField", ">", "(", ")", ";", "private", "boolean", "hasParams", "=", "false", ";", "private", "Map", "<", "String", ",", "String", ">", "validatorParams", ";", "private", "RuleTextField", "activeField", ";", "private", "boolean", "backstep", "=", "false", ";", "private", "Toolkit", "toolkit", ";", "private", "String", "separator", ";", "private", "int", "resultFormat", "=", "DEFAULT", ";", "private", "Validator", "validationService", ";", "private", "Processor", "encryptionService", ";", "private", "VariableSubstitutor", "variableSubstitutor", ";", "@", "Override", "public", "boolean", "hasParams", "(", ")", "{", "return", "hasParams", ";", "}", "public", "RuleInputField", "(", "String", "format", ",", "String", "preset", ",", "String", "separator", ",", "String", "validator", ",", "Map", "<", "String", ",", "String", ">", "validatorParams", ",", "String", "processor", ",", "int", "resultFormat", ",", "Toolkit", "toolkit", ",", "GUIInstallData", "idata", ")", "{", "this", "(", "format", ",", "preset", ",", "separator", ",", "validator", ",", "processor", ",", "resultFormat", ",", "toolkit", ",", "idata", ")", ";", "this", ".", "validatorParams", "=", "validatorParams", ";", "this", ".", "hasParams", "=", "true", ";", "}", "public", "RuleInputField", "(", "String", "format", ",", "String", "preset", ",", "String", "separator", ",", "String", "validator", ",", "String", "processor", ",", "int", "resultFormat", ",", "Toolkit", "toolkit", ",", "GUIInstallData", "idata", ")", "{", "this", ".", "toolkit", "=", "toolkit", ";", "this", ".", "separator", "=", "separator", ";", "this", ".", "resultFormat", "=", "resultFormat", ";", "variableSubstitutor", "=", "new", "VariableSubstitutorImpl", "(", "idata", ".", "getVariables", "(", ")", ")", ";", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", "layout", "=", "new", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", "(", ")", ";", "layout", ".", "setAlignment", "(", "com", ".", "izforge", ".", "izpack", ".", "gui", ".", "FlowLayout", ".", "LEFT", ")", ";", "setLayout", "(", "layout", ")", ";", "try", "{", "if", "(", "validator", "!=", "null", ")", "{", "validationService", "=", "(", "Validator", ")", "Class", ".", "forName", "(", "validator", ")", ".", "newInstance", "(", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "validationService", "=", "null", ";", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "t", ".", "toString", "(", ")", ",", "t", ")", ";", "}", "try", "{", "if", "(", "processor", "!=", "null", ")", "{", "encryptionService", "=", "(", "Processor", ")", "Class", ".", "forName", "(", "processor", ")", ".", "newInstance", "(", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "encryptionService", "=", "null", ";", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "t", ".", "toString", "(", ")", ",", "t", ")", ";", "}", "createItems", "(", "format", ")", ";", "if", "(", "(", "preset", "!=", "null", ")", "&&", "(", "preset", ".", "length", "(", ")", ">", "0", ")", ")", "{", "setFields", "(", "preset", ")", ";", "}", "activeField", "=", "(", "RuleTextField", ")", "inputFields", ".", "elementAt", "(", "0", ")", ";", "activeField", ".", "grabFocus", "(", ")", ";", "}", "@", "Override", "public", "int", "getNumFields", "(", ")", "{", "return", "(", "inputFields", ".", "size", "(", ")", ")", ";", "}", "@", "Override", "public", "String", "getFieldContents", "(", "int", "index", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "(", "index", "<", "0", ")", "||", "(", "index", ">", "(", "inputFields", ".", "size", "(", ")", "-", "1", ")", ")", ")", "{", "throw", "(", "new", "IndexOutOfBoundsException", "(", ")", ")", ";", "}", "return", "inputFields", ".", "elementAt", "(", "index", ")", ".", "getText", "(", ")", ";", "}", "@", "Override", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "validatorParams", ";", "}", "@", "Override", "public", "String", "getText", "(", ")", "{", "Object", "item", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "int", "size", "=", "inputFields", ".", "size", "(", ")", ";", "if", "(", "resultFormat", "==", "ENCRYPTED", ")", "{", "if", "(", "encryptionService", "!=", "null", ")", "{", "buffer", ".", "append", "(", "encryptionService", ".", "process", "(", "this", ")", ")", ";", "}", "else", "{", "resultFormat", "=", "DEFAULT", ";", "}", "}", "else", "if", "(", "resultFormat", "==", "PLAIN_STRING", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputFields", ".", "size", "(", ")", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "inputFields", ".", "elementAt", "(", "i", ")", ".", "getText", "(", ")", ")", ";", "}", "}", "else", "if", "(", "resultFormat", "==", "DISPLAY_FORMAT", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "size", "(", ")", ";", "i", "++", ")", "{", "item", "=", "items", ".", "elementAt", "(", "i", ")", ";", "if", "(", "item", "instanceof", "JTextField", ")", "{", "buffer", ".", "append", "(", "(", "(", "JTextField", ")", "item", ")", ".", "getText", "(", ")", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "(", "String", ")", "item", ")", ";", "}", "}", "}", "else", "if", "(", "resultFormat", "==", "SPECIAL_SEPARATOR", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "(", "inputFields", ".", "elementAt", "(", "i", ")", ")", ".", "getText", "(", ")", ")", ";", "if", "(", "i", "<", "(", "size", "-", "1", ")", ")", "{", "buffer", ".", "append", "(", "separator", ")", ";", "}", "}", "}", "return", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "private", "void", "createItems", "(", "String", "format", ")", "{", "Object", "item", ";", "JTextField", "field", ";", "String", "token", ";", "FieldSpec", "spec", ";", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "format", ")", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "try", "{", "spec", "=", "new", "FieldSpec", "(", "token", ")", ";", "field", "=", "new", "RuleTextField", "(", "spec", ".", "getColumns", "(", ")", ",", "spec", ".", "getEditLength", "(", ")", ",", "spec", ".", "getType", "(", ")", ",", "spec", ".", "getUnlimitedEdit", "(", ")", ",", "toolkit", ")", ";", "if", "(", "items", ".", "size", "(", ")", ">", "0", ")", "{", "item", "=", "items", ".", "lastElement", "(", ")", ";", "if", "(", "item", "instanceof", "JTextField", ")", "{", "items", ".", "add", "(", "\"", "\"", ")", ";", "}", "}", "items", ".", "add", "(", "field", ")", ";", "inputFields", ".", "add", "(", "field", ")", ";", "field", ".", "addFocusListener", "(", "this", ")", ";", "field", ".", "addKeyListener", "(", "this", ")", ";", "field", ".", "addCaretListener", "(", "this", ")", ";", "}", "catch", "(", "Throwable", "exception", ")", "{", "if", "(", "items", ".", "size", "(", ")", "==", "0", ")", "{", "items", ".", "add", "(", "token", ")", ";", "}", "else", "{", "item", "=", "items", ".", "lastElement", "(", ")", ";", "if", "(", "item", "instanceof", "String", ")", "{", "items", ".", "setElementAt", "(", "item", "+", "\"", "\"", "+", "token", ",", "(", "items", ".", "size", "(", ")", "-", "1", ")", ")", ";", "}", "else", "{", "items", ".", "add", "(", "token", ")", ";", "}", "}", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "size", "(", ")", ";", "i", "++", ")", "{", "item", "=", "items", ".", "elementAt", "(", "i", ")", ";", "if", "(", "item", "instanceof", "String", ")", "{", "add", "(", "new", "JLabel", "(", "(", "String", ")", "item", ")", ")", ";", "}", "else", "{", "add", "(", "(", "JTextField", ")", "item", ")", ";", "}", "}", "}", "private", "void", "setFields", "(", "String", "data", ")", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "data", ")", ";", "String", "token", ";", "String", "indexString", ";", "int", "index", ";", "boolean", "process", "=", "false", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "indexString", "=", "token", ".", "substring", "(", "0", ",", "token", ".", "indexOf", "(", "':'", ")", ")", ";", "try", "{", "index", "=", "Integer", ".", "parseInt", "(", "indexString", ")", ";", "if", "(", "index", "<", "inputFields", ".", "size", "(", ")", ")", "{", "String", "val", "=", "token", ".", "substring", "(", "(", "token", ".", "indexOf", "(", "':'", ")", "+", "1", ")", ",", "token", ".", "length", "(", ")", ")", ";", "String", "className", "=", "\"\"", ";", "if", "(", "val", ".", "contains", "(", "\":\"", ")", ")", "{", "className", "=", "val", ".", "substring", "(", "val", ".", "indexOf", "(", "\":\"", ")", "+", "1", ")", ";", "val", "=", "val", ".", "substring", "(", "0", ",", "val", ".", "indexOf", "(", "\":\"", ")", ")", ";", "}", "if", "(", "!", "\"\"", ".", "equals", "(", "className", ")", "&&", "!", "process", ")", "{", "process", "=", "true", ";", "}", "val", "=", "variableSubstitutor", ".", "substitute", "(", "val", ")", ";", "inputFields", ".", "elementAt", "(", "index", ")", ".", "setText", "(", "val", ")", ";", "}", "}", "catch", "(", "Throwable", "exception", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "}", "}", "if", "(", "process", ")", "{", "tokenizer", "=", "new", "StringTokenizer", "(", "data", ")", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "indexString", "=", "token", ".", "substring", "(", "0", ",", "token", ".", "indexOf", "(", "':'", ")", ")", ";", "try", "{", "index", "=", "Integer", ".", "parseInt", "(", "indexString", ")", ";", "if", "(", "index", "<", "inputFields", ".", "size", "(", ")", ")", "{", "String", "val", "=", "token", ".", "substring", "(", "(", "token", ".", "indexOf", "(", "':'", ")", "+", "1", ")", ",", "token", ".", "length", "(", ")", ")", ";", "String", "className", "=", "\"\"", ";", "String", "presult", "=", "\"\"", ";", "if", "(", "val", ".", "contains", "(", "\":\"", ")", ")", "{", "className", "=", "val", ".", "substring", "(", "val", ".", "indexOf", "(", "\":\"", ")", "+", "1", ")", ";", "}", "if", "(", "!", "\"\"", ".", "equals", "(", "className", ")", ")", "{", "Processor", "processor", "=", "(", "Processor", ")", "Class", ".", "forName", "(", "className", ")", ".", "newInstance", "(", ")", ";", "presult", "=", "processor", ".", "process", "(", "this", ")", ";", "}", "String", "[", "]", "td", "=", "new", "RE", "(", "\"\\\\*\"", ")", ".", "split", "(", "presult", ")", ";", "inputFields", ".", "elementAt", "(", "index", ")", ".", "setText", "(", "td", "[", "index", "]", ")", ";", "}", "}", "catch", "(", "Throwable", "exception", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "}", "}", "}", "}", "public", "boolean", "validateContents", "(", ")", "{", "if", "(", "validationService", "!=", "null", ")", "{", "return", "(", "validationService", ".", "validate", "(", "this", ")", ")", ";", "}", "else", "{", "return", "(", "true", ")", ";", "}", "}", "@", "Override", "public", "void", "keyTyped", "(", "KeyEvent", "event", ")", "{", "}", "@", "Override", "public", "void", "keyPressed", "(", "KeyEvent", "event", ")", "{", "if", "(", "event", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_BACK_SPACE", ")", "{", "int", "caretPosition", "=", "activeField", ".", "getCaretPosition", "(", ")", ";", "if", "(", "caretPosition", "==", "0", ")", "{", "int", "activeIndex", "=", "inputFields", ".", "indexOf", "(", "activeField", ")", ";", "if", "(", "activeIndex", ">", "0", ")", "{", "activeIndex", "--", ";", "backstep", "=", "true", ";", "activeField", "=", "(", "RuleTextField", ")", "inputFields", ".", "elementAt", "(", "activeIndex", ")", ";", "activeField", ".", "grabFocus", "(", ")", ";", "}", "}", "}", "}", "@", "Override", "public", "void", "keyReleased", "(", "KeyEvent", "event", ")", "{", "}", "@", "Override", "public", "void", "focusGained", "(", "FocusEvent", "event", ")", "{", "activeField", "=", "(", "RuleTextField", ")", "event", ".", "getSource", "(", ")", ";", "if", "(", "backstep", ")", "{", "activeField", ".", "setCaretPosition", "(", "activeField", ".", "getText", "(", ")", ".", "length", "(", ")", ")", ";", "backstep", "=", "false", ";", "}", "else", "{", "activeField", ".", "selectAll", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "focusLost", "(", "FocusEvent", "event", ")", "{", "}", "@", "Override", "public", "void", "caretUpdate", "(", "CaretEvent", "event", ")", "{", "if", "(", "activeField", "!=", "null", ")", "{", "String", "text", "=", "activeField", ".", "getText", "(", ")", ";", "int", "fieldSize", "=", "activeField", ".", "getEditLength", "(", ")", ";", "int", "caretPosition", "=", "activeField", ".", "getCaretPosition", "(", ")", ";", "int", "selection", "=", "activeField", ".", "getSelectionEnd", "(", ")", "-", "activeField", ".", "getSelectionStart", "(", ")", ";", "if", "(", "(", "!", "inputFields", ".", "lastElement", "(", ")", ".", "equals", "(", "activeField", ")", ")", "&&", "(", "!", "activeField", ".", "unlimitedEdit", "(", ")", ")", ")", "{", "if", "(", "(", "text", ".", "length", "(", ")", "==", "fieldSize", ")", "&&", "(", "selection", "==", "0", ")", "&&", "(", "caretPosition", "==", "fieldSize", ")", "&&", "!", "backstep", ")", "{", "activeField", ".", "transferFocus", "(", ")", ";", "}", "}", "}", "}", "private", "static", "class", "FieldSpec", "{", "private", "int", "MIN_TOKENS", "=", "2", ";", "private", "int", "MAX_TOKENS", "=", "3", ";", "private", "int", "type", ";", "private", "int", "columns", ";", "private", "int", "editLength", ";", "private", "boolean", "unlimitedEdit", "=", "false", ";", "public", "FieldSpec", "(", "String", "spec", ")", "throws", "Exception", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "spec", ",", "\":\"", ")", ";", "if", "(", "(", "tokenizer", ".", "countTokens", "(", ")", ">=", "MIN_TOKENS", ")", "&&", "(", "tokenizer", ".", "countTokens", "(", ")", "<=", "MAX_TOKENS", ")", ")", "{", "String", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "\"N\"", ".", "equals", "(", "token", ")", ")", "{", "type", "=", "RuleTextField", ".", "N", ";", "}", "else", "if", "(", "\"H\"", ".", "equals", "(", "token", ")", ")", "{", "type", "=", "RuleTextField", ".", "H", ";", "}", "else", "if", "(", "\"A\"", ".", "equals", "(", "token", ")", ")", "{", "type", "=", "RuleTextField", ".", "A", ";", "}", "else", "if", "(", "\"O\"", ".", "equals", "(", "token", ")", ")", "{", "type", "=", "RuleTextField", ".", "O", ";", "}", "else", "if", "(", "\"AN\"", ".", "equals", "(", "token", ")", ")", "{", "type", "=", "RuleTextField", ".", "AN", ";", "}", "else", "{", "throw", "(", "new", "Exception", "(", ")", ")", ";", "}", "try", "{", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "columns", "=", "Integer", ".", "parseInt", "(", "token", ")", ";", "}", "catch", "(", "Throwable", "exception", ")", "{", "throw", "(", "new", "Exception", "(", ")", ")", ";", "}", "try", "{", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ".", "toUpperCase", "(", ")", ";", "editLength", "=", "Integer", ".", "parseInt", "(", "token", ")", ";", "}", "catch", "(", "Throwable", "exception", ")", "{", "if", "(", "\"U\"", ".", "equals", "(", "token", ")", ")", "{", "unlimitedEdit", "=", "true", ";", "}", "else", "{", "throw", "(", "new", "Exception", "(", ")", ")", ";", "}", "}", "}", "else", "{", "throw", "(", "new", "Exception", "(", ")", ")", ";", "}", "}", "public", "int", "getColumns", "(", ")", "{", "return", "(", "columns", ")", ";", "}", "public", "int", "getEditLength", "(", ")", "{", "return", "(", "editLength", ")", ";", "}", "public", "int", "getType", "(", ")", "{", "return", "(", "type", ")", ";", "}", "public", "boolean", "getUnlimitedEdit", "(", ")", "{", "return", "(", "unlimitedEdit", ")", ";", "}", "}", "}", "</s>" ]
10,687
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "interface", "ProcessingClient", "{", "public", "int", "getNumFields", "(", ")", ";", "public", "String", "getFieldContents", "(", "int", "index", ")", ";", "public", "String", "getText", "(", ")", ";", "public", "boolean", "hasParams", "(", ")", ";", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", ";", "}", "</s>" ]
10,688
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "javax", ".", "swing", ".", "filechooser", ".", "FileFilter", ";", "import", "java", ".", "io", ".", "File", ";", "public", "class", "UserInputFileFilter", "extends", "FileFilter", "{", "String", "fileext", "=", "\"\"", ";", "String", "description", "=", "\"\"", ";", "public", "void", "setFileExt", "(", "String", "fileext", ")", "{", "this", ".", "fileext", "=", "fileext", ";", "}", "public", "void", "setFileExtDesc", "(", "String", "desc", ")", "{", "this", ".", "description", "=", "desc", ";", "}", "public", "boolean", "accept", "(", "File", "pathname", ")", "{", "if", "(", "pathname", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "pathname", ".", "getAbsolutePath", "(", ")", ".", "endsWith", "(", "this", ".", "fileext", ")", ";", "}", "}", "public", "String", "getDescription", "(", ")", "{", "return", "this", ".", "description", ";", "}", "}", "</s>" ]
10,689
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "data", ".", "GUIInstallData", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "installer", ".", "gui", ".", "IzPanel", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ".", "ValidatorContainer", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "IoHelper", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "OsVersion", ";", "public", "class", "DirInputField", "extends", "FileInputField", "{", "private", "static", "final", "long", "serialVersionUID", "=", "8494549823214831160L", ";", "private", "static", "final", "transient", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "DirInputField", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "final", "boolean", "mustExist", ";", "private", "final", "boolean", "canCreate", ";", "public", "DirInputField", "(", "IzPanel", "parent", ",", "GUIInstallData", "installDataGUI", ",", "boolean", "directory", ",", "String", "set", ",", "int", "size", ",", "List", "<", "ValidatorContainer", ">", "validatorConfig", ",", "boolean", "mustExist", ",", "boolean", "canCreate", ")", "{", "super", "(", "parent", ",", "installDataGUI", ",", "directory", ",", "set", ",", "size", ",", "validatorConfig", ",", "null", ",", "null", ")", ";", "this", ".", "mustExist", "=", "mustExist", ";", "this", ".", "canCreate", "=", "canCreate", ";", "}", "@", "Override", "protected", "void", "prepareFileChooser", "(", "JFileChooser", "filechooser", ")", "{", "filechooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}", "@", "Override", "protected", "boolean", "_validate", "(", "File", "dir", ")", "{", "System", ".", "err", ".", "println", "(", "dir", ".", "getAbsolutePath", "(", ")", "+", "\"", "-", "isDir:", "\"", "+", "dir", ".", "isDirectory", "(", ")", "+", "\"\"", "+", "mustExist", "+", "\"\"", "+", "canCreate", ")", ";", "if", "(", "dir", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "mustExist", ")", "{", "return", "false", ";", "}", "else", "if", "(", "canCreate", ")", "{", "return", "verifyCreateOK", "(", "dir", ")", ";", "}", "else", "{", "return", "true", ";", "}", "}", "@", "Override", "protected", "void", "showMessage", "(", "int", "k", ")", "{", "if", "(", "k", "==", "INVALID", ")", "{", "showMessage", "(", "\"\"", ")", ";", "}", "else", "if", "(", "k", "==", "EMPTY", ")", "{", "showMessage", "(", "\"\"", ")", ";", "}", "}", "private", "boolean", "verifyCreateOK", "(", "File", "path", ")", "{", "if", "(", "!", "path", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "parent", ".", "emitNotificationFeedback", "(", "parent", ".", "getI18nStringForClass", "(", "\"createdir\"", ",", "\"TargetPanel\"", ")", "+", "\"n\"", "+", "path", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "!", "isWriteable", "(", "path", ")", ")", "{", "parent", ".", "emitError", "(", "parentFrame", ".", "getMessages", "(", ")", ".", "get", "(", "\"\"", ")", ",", "parent", ".", "getI18nStringForClass", "(", "\"notwritable\"", ",", "\"TargetPanel\"", ")", ")", ";", "return", "false", ";", "}", "return", "path", ".", "mkdirs", "(", ")", ";", "}", "private", "static", "boolean", "isWriteable", "(", "File", "path", ")", "{", "File", "existParent", "=", "IoHelper", ".", "existingParent", "(", "path", ")", ";", "if", "(", "existParent", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "OsVersion", ".", "IS_WINDOWS", ")", "{", "File", "tmpFile", ";", "try", "{", "tmpFile", "=", "File", ".", "createTempFile", "(", "\"izWrTe\"", ",", "\".tmp\"", ",", "existParent", ")", ";", "tmpFile", ".", "deleteOnExit", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}", "return", "existParent", ".", "canWrite", "(", ")", ";", "}", "}", "</s>" ]
10,690
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "public", "class", "NotEmptyValidator", "implements", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "int", "numfields", "=", "client", ".", "getNumFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numfields", ";", "i", "++", ")", "{", "String", "value", "=", "client", ".", "getFieldContents", "(", "i", ")", ";", "if", "(", "(", "value", "==", "null", ")", "||", "(", "value", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "</s>" ]
10,691
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "PasswordGroup", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "public", "class", "RegularExpressionValidator", "implements", "Validator", "{", "public", "static", "final", "String", "STR_PATTERN_DEFAULT", "=", "\"\"", ";", "private", "static", "final", "String", "PATTERN_PARAM", "=", "\"pattern\"", ";", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "String", "patternString", ";", "if", "(", "client", ".", "hasParams", "(", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "paramMap", "=", "client", ".", "getValidatorParams", "(", ")", ";", "patternString", "=", "paramMap", ".", "get", "(", "PATTERN_PARAM", ")", ";", "}", "else", "{", "patternString", "=", "STR_PATTERN_DEFAULT", ";", "}", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "patternString", ")", ";", "return", "pattern", ".", "matcher", "(", "getString", "(", "client", ")", ")", ".", "matches", "(", ")", ";", "}", "private", "String", "getString", "(", "ProcessingClient", "client", ")", "{", "String", "returnValue", "=", "\"\"", ";", "if", "(", "client", "instanceof", "PasswordGroup", ")", "{", "int", "numFields", "=", "client", ".", "getNumFields", "(", ")", ";", "if", "(", "numFields", ">", "0", ")", "{", "returnValue", "=", "client", ".", "getFieldContents", "(", "0", ")", ";", "}", "else", "{", "returnValue", "=", "client", ".", "getText", "(", ")", ";", "}", "}", "else", "{", "returnValue", "=", "client", ".", "getText", "(", ")", ";", "}", "return", "returnValue", ";", "}", "}", "</s>" ]
10,692
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "public", "class", "IsPortValidator", "implements", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "int", "port", "=", "0", ";", "if", "(", "\"\"", ".", "equals", "(", "client", ".", "getFieldContents", "(", "0", ")", ")", ")", "{", "return", "false", ";", "}", "try", "{", "port", "=", "Integer", ".", "parseInt", "(", "client", ".", "getFieldContents", "(", "0", ")", ")", ";", "if", "(", "port", ">=", "0", "&&", "port", "<=", "65535", ")", "{", "return", "true", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "false", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
10,693
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "ServerSocket", ";", "public", "class", "PortValidator", "implements", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "InetAddress", "inet", "=", "null", ";", "String", "host", "=", "\"localhost\"", ";", "boolean", "retValue", "=", "false", ";", "int", "numfields", "=", "client", ".", "getNumFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numfields", ";", "i", "++", ")", "{", "String", "value", "=", "client", ".", "getFieldContents", "(", "i", ")", ";", "if", "(", "(", "value", "==", "null", ")", "||", "(", "value", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "false", ";", "}", "try", "{", "inet", "=", "InetAddress", ".", "getByName", "(", "host", ")", ";", "ServerSocket", "socket", "=", "new", "ServerSocket", "(", "Integer", ".", "parseInt", "(", "value", ")", ",", "0", ",", "inet", ")", ";", "retValue", "=", "socket", ".", "getLocalPort", "(", ")", ">", "0", ";", "if", "(", "!", "retValue", ")", "{", "break", ";", "}", "socket", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "retValue", "=", "false", ";", "}", "}", "return", "retValue", ";", "}", "}", "</s>" ]
10,694
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "ServerSocket", ";", "public", "class", "HostAddressValidator", "implements", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "InetAddress", "inet", "=", "null", ";", "String", "host", "=", "\"\"", ";", "int", "port", "=", "0", ";", "boolean", "retValue", "=", "false", ";", "try", "{", "host", "=", "client", ".", "getFieldContents", "(", "0", ")", ";", "port", "=", "Integer", ".", "parseInt", "(", "client", ".", "getFieldContents", "(", "1", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "try", "{", "inet", "=", "InetAddress", ".", "getByName", "(", "host", ")", ";", "ServerSocket", "socket", "=", "new", "ServerSocket", "(", "port", ",", "0", ",", "inet", ")", ";", "retValue", "=", "socket", ".", "getLocalPort", "(", ")", ">", "0", ";", "socket", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "retValue", "=", "false", ";", "}", "return", "retValue", ";", "}", "}", "</s>" ]
10,695
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "public", "interface", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", ";", "}", "</s>" ]
10,696
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "PasswordGroup", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "PasswordEqualityValidator", "implements", "Validator", "{", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "boolean", "returnValue", "=", "false", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "getParams", "(", "client", ")", ";", "try", "{", "returnValue", "=", "fieldsMatch", "(", "client", ")", ";", "if", "(", "returnValue", ")", "{", "if", "(", "params", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"Additional", "\"", "+", "params", ".", "size", "(", ")", "+", "\"\"", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "}", "return", "(", "returnValue", ")", ";", "}", "private", "Map", "<", "String", ",", "String", ">", "getParams", "(", "ProcessingClient", "client", ")", "{", "PasswordGroup", "group", "=", "null", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "null", ";", "try", "{", "group", "=", "(", "PasswordGroup", ")", "client", ";", "if", "(", "group", ".", "hasParams", "(", ")", ")", "{", "params", "=", "group", ".", "getValidatorParams", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "}", "return", "(", "params", ")", ";", "}", "private", "boolean", "fieldsMatch", "(", "ProcessingClient", "client", ")", "{", "boolean", "returnValue", "=", "true", ";", "int", "numFields", "=", "client", ".", "getNumFields", "(", ")", ";", "if", "(", "numFields", "<", "2", ")", "{", "returnValue", "=", "true", ";", "}", "else", "{", "String", "content", "=", "client", ".", "getFieldContents", "(", "0", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "numFields", ";", "i", "++", ")", "{", "if", "(", "!", "content", ".", "equals", "(", "client", ".", "getFieldContents", "(", "i", ")", ")", ")", "{", "returnValue", "=", "false", ";", "}", "}", "}", "return", "returnValue", ";", "}", "}", "</s>" ]
10,697
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "java", ".", "security", ".", "SecureRandom", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "crypto", ".", "Cipher", ";", "import", "javax", ".", "crypto", ".", "KeyGenerator", ";", "import", "javax", ".", "crypto", ".", "spec", ".", "SecretKeySpec", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "PasswordGroup", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "util", ".", "Base64", ";", "public", "class", "PasswordEncryptionValidator", "implements", "Validator", "{", "private", "static", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "PasswordEncryptionValidator", ".", "class", ".", "getName", "(", ")", ")", ";", "private", "Cipher", "encryptCipher", ";", "@", "Override", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "boolean", "returnValue", "=", "true", ";", "String", "encryptedPassword", "=", "null", ";", "String", "key", "=", "null", ";", "String", "algorithm", "=", "null", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "getParams", "(", "client", ")", ";", "try", "{", "key", "=", "params", ".", "get", "(", "\"\"", ")", ";", "algorithm", "=", "params", ".", "get", "(", "\"algorithm\"", ")", ";", "if", "(", "key", "!=", "null", "&&", "algorithm", "!=", "null", ")", "{", "initialize", "(", "key", ",", "algorithm", ")", ";", "encryptedPassword", "=", "encryptString", "(", "client", ".", "getFieldContents", "(", "0", ")", ")", ";", "if", "(", "encryptedPassword", "!=", "null", ")", "{", "PasswordGroup", "group", "=", "(", "PasswordGroup", ")", "client", ";", "group", ".", "setModifiedPassword", "(", "encryptedPassword", ")", ";", "}", "else", "{", "returnValue", "=", "false", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "returnValue", "=", "false", ";", "}", "return", "(", "returnValue", ")", ";", "}", "private", "Map", "<", "String", ",", "String", ">", "getParams", "(", "ProcessingClient", "client", ")", "{", "PasswordGroup", "group", "=", "null", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "null", ";", "try", "{", "group", "=", "(", "PasswordGroup", ")", "client", ";", "if", "(", "group", ".", "hasParams", "(", ")", ")", "{", "params", "=", "group", ".", "getValidatorParams", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "}", "return", "params", ";", "}", "private", "void", "initialize", "(", "String", "key", ",", "String", "algorithm", ")", "throws", "Exception", "{", "try", "{", "KeyGenerator", "keygen", "=", "KeyGenerator", ".", "getInstance", "(", "algorithm", ")", ";", "keygen", ".", "init", "(", "new", "SecureRandom", "(", "key", ".", "getBytes", "(", ")", ")", ")", ";", "byte", "[", "]", "keyBytes", "=", "keygen", ".", "generateKey", "(", ")", ".", "getEncoded", "(", ")", ";", "SecretKeySpec", "specKey", "=", "new", "SecretKeySpec", "(", "keyBytes", ",", "algorithm", ")", ";", "encryptCipher", "=", "Cipher", ".", "getInstance", "(", "algorithm", ")", ";", "encryptCipher", ".", "init", "(", "Cipher", ".", "ENCRYPT_MODE", ",", "specKey", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "throw", "e", ";", "}", "}", "public", "String", "encryptString", "(", "String", "string", ")", "throws", "Exception", "{", "String", "result", "=", "null", ";", "try", "{", "byte", "[", "]", "cryptedbytes", "=", "null", ";", "cryptedbytes", "=", "encryptCipher", ".", "doFinal", "(", "string", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "result", "=", "Base64", ".", "encodeBytes", "(", "cryptedbytes", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", "+", "e", ",", "e", ")", ";", "throw", "e", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
10,698
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "api", ".", "substitutor", ".", "VariableSubstitutor", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "PasswordGroup", ";", "import", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "processorclient", ".", "ProcessingClient", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "security", ".", "KeyStore", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "PasswordKeystoreValidator", "implements", "Validator", "{", "private", "VariableSubstitutor", "variableSubstitutor", ";", "public", "PasswordKeystoreValidator", "(", "VariableSubstitutor", "variableSubstitutor", ")", "{", "this", ".", "variableSubstitutor", "=", "variableSubstitutor", ";", "}", "public", "boolean", "validate", "(", "ProcessingClient", "client", ")", "{", "boolean", "returnValue", "=", "false", ";", "String", "keystorePassword", "=", "null", ";", "String", "keystoreFile", "=", "null", ";", "String", "keystoreType", "=", "\"JKS\"", ";", "String", "skipValidation", "=", "null", ";", "String", "alias", "=", "null", ";", "String", "aliasPassword", "=", "null", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "getParams", "(", "client", ")", ";", "try", "{", "if", "(", "params", "!=", "null", ")", "{", "skipValidation", "=", "params", ".", "get", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "skipValidation", ")", ";", "if", "(", "skipValidation", "!=", "null", "&&", "skipValidation", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "return", "true", ";", "}", "keystorePassword", "=", "params", ".", "get", "(", "\"\"", ")", ";", "if", "(", "keystorePassword", "==", "null", ")", "{", "keystorePassword", "=", "getPassword", "(", "client", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "else", "if", "(", "keystorePassword", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "keystorePassword", "=", "getPassword", "(", "client", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "aliasPassword", "=", "params", ".", "get", "(", "\"\"", ")", ";", "if", "(", "aliasPassword", "==", "null", ")", "{", "aliasPassword", "=", "getPassword", "(", "client", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "else", "if", "(", "aliasPassword", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "aliasPassword", "=", "getPassword", "(", "client", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "keystoreType", "=", "params", ".", "get", "(", "\"keystoreType\"", ")", ";", "if", "(", "keystoreType", "==", "null", ")", "{", "keystoreType", "=", "\"JKS\"", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "else", "if", "(", "keystoreType", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "keystoreType", "=", "\"JKS\"", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "keystoreFile", "=", "params", ".", "get", "(", "\"keystoreFile\"", ")", ";", "if", "(", "keystoreFile", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "keystoreFile", ")", ";", "KeyStore", "keyStore", "=", "getKeyStore", "(", "keystoreFile", ",", "keystoreType", ",", "keystorePassword", ".", "toCharArray", "(", ")", ")", ";", "if", "(", "keyStore", "!=", "null", ")", "{", "returnValue", "=", "true", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "alias", "=", "params", ".", "get", "(", "\"\"", ")", ";", "if", "(", "alias", "!=", "null", ")", "{", "returnValue", "=", "keyStore", ".", "containsAlias", "(", "alias", ")", ";", "if", "(", "returnValue", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "alias", "+", "\"\"", ")", ";", "try", "{", "keyStore", ".", "getKey", "(", "alias", ",", "aliasPassword", ".", "toCharArray", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "alias", "+", "\"'", "validated\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "returnValue", "=", "false", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "alias", "+", "\"'", "not", "found\"", ")", ";", "}", "}", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "}", "return", "(", "returnValue", ")", ";", "}", "private", "Map", "<", "String", ",", "String", ">", "getParams", "(", "ProcessingClient", "client", ")", "{", "Map", "<", "String", ",", "String", ">", "returnValue", "=", "null", ";", "PasswordGroup", "group", "=", "null", ";", "try", "{", "group", "=", "(", "PasswordGroup", ")", "client", ";", "if", "(", "group", ".", "hasParams", "(", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "group", ".", "getValidatorParams", "(", ")", ";", "returnValue", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "String", "key", ":", "params", ".", "keySet", "(", ")", ")", "{", "String", "value", "=", "variableSubstitutor", ".", "substitute", "(", "params", ".", "get", "(", "key", ")", ")", ";", "returnValue", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "}", "return", "returnValue", ";", "}", "private", "String", "getPassword", "(", "ProcessingClient", "client", ")", "{", "return", "client", ".", "getFieldContents", "(", "0", ")", ";", "}", "public", "static", "KeyStore", "getKeyStore", "(", "String", "fileName", ",", "String", "type", ",", "char", "[", "]", "password", ")", "{", "KeyStore", "keyStore", "=", "null", ";", "try", "{", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "type", ")", ";", "keyStore", ".", "load", "(", "new", "FileInputStream", "(", "fileName", ")", ",", "password", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "keyStore", "=", "null", ";", "}", "return", "keyStore", ";", "}", "}", "</s>" ]
10,699
[ "<s>", "package", "com", ".", "izforge", ".", "izpack", ".", "panels", ".", "userinput", ".", "validator", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "ValidatorContainer", "{", "private", "Validator", "validator", "=", "null", ";", "private", "String", "message", ";", "private", "boolean", "hasParams", "=", "false", ";", "private", "Map", "<", "String", ",", "String", ">", "validatorParams", "=", "null", ";", "public", "ValidatorContainer", "(", "String", "validator", ",", "String", "message", ",", "Map", "<", "String", ",", "String", ">", "validatorParams", ")", "{", "try", "{", "this", ".", "validator", "=", "(", "Validator", ")", "Class", ".", "forName", "(", "validator", ")", ".", "newInstance", "(", ")", ";", "this", ".", "message", "=", "message", ";", "this", ".", "validatorParams", "=", "validatorParams", ";", "if", "(", "validatorParams", "!=", "null", ")", "{", "if", "(", "validatorParams", ".", "size", "(", ")", ">", "0", ")", "{", "hasParams", "=", "true", ";", "}", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ")", ";", "this", ".", "validator", "=", "null", ";", "this", ".", "message", "=", "null", ";", "hasParams", "=", "false", ";", "validatorParams", "=", "null", ";", "}", "}", "public", "boolean", "hasParams", "(", ")", "{", "return", "hasParams", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getValidatorParams", "(", ")", "{", "return", "validatorParams", ";", "}", "public", "Validator", "getValidator", "(", ")", "{", "return", "validator", ";", "}", "public", "String", "getMessage", "(", ")", "{", "return", "message", ";", "}", "}", "</s>" ]