2013-04-18 sources upload tizen_2.1 2.1b_release
authordonghee yang <donghee.yang@samsung.com>
Thu, 18 Apr 2013 02:16:08 +0000 (11:16 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Thu, 18 Apr 2013 02:16:08 +0000 (11:16 +0900)
Change-Id: Ic2228e0d717283a4e6ba14d37f1c6f68b7f8c043

32 files changed:
InstallManager_java/src/org/tizen/installmanager/core/Config.java
InstallManager_java/src/org/tizen/installmanager/core/DistributionController.java
InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java
InstallManager_java/src/org/tizen/installmanager/core/InstallManagerNoUI.java
InstallManager_java/src/org/tizen/installmanager/core/Installer.java
InstallManager_java/src/org/tizen/installmanager/core/Options.java
InstallManager_java/src/org/tizen/installmanager/core/SDKExtensionInfo.java
InstallManager_java/src/org/tizen/installmanager/core/SnapshotLog.java
InstallManager_java/src/org/tizen/installmanager/core/UpdateInstallManager.java
InstallManager_java/src/org/tizen/installmanager/lib/Downloader.java
InstallManager_java/src/org/tizen/installmanager/lib/Log.java
InstallManager_java/src/org/tizen/installmanager/lib/Registry.java
InstallManager_java/src/org/tizen/installmanager/lib/SDKPackageFormat.java
InstallManager_java/src/org/tizen/installmanager/lib/linux/LinuxSDKPackageFormat.java
InstallManager_java/src/org/tizen/installmanager/lib/linux/LinuxShellInstalledListParser.java
InstallManager_java/src/org/tizen/installmanager/lib/mac/MacFileSystemInfo.java
InstallManager_java/src/org/tizen/installmanager/lib/win/WindowsProgramController.java
InstallManager_java/src/org/tizen/installmanager/lib/win/WindowsSDKPackageFormat.java
InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager.java
InstallManager_java/src/org/tizen/installmanager/pkg/lib/PropertyParser.java
InstallManager_java/src/org/tizen/installmanager/pkg/model/ConfigFile.java
InstallManager_java/src/org/tizen/installmanager/pkg/model/PackageSet.java
InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java
InstallManager_java/src/org/tizen/installmanager/ui/dialog/ConfigurationDialog.java
InstallManager_java/src/org/tizen/installmanager/ui/dialog/UnzipImageDialog.java
InstallManager_java/src/org/tizen/installmanager/ui/model/Item.java
InstallManager_java/src/org/tizen/installmanager/ui/page/InstallableListPage.java
InstallManager_java/src/org/tizen/installmanager/ui/page/PackageListPage.java
InstallManager_java/src/org/tizen/installmanager/ui/page/SetInstallDirectoryPage.java
InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java
InstallManager_java/src/org/tizen/installmanager/util/PathUtil.java
InstallManager_java/src/res/COPYING

index 27531cb..733cbfe 100644 (file)
@@ -505,7 +505,9 @@ public class Config {
                if (bResult) {
                        File configDirFile = new File(
                                        PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY));
-                       configDirFile.mkdir();
+                       if (!configDirFile.mkdir()) {
+                               Log.err("Fail to create file ==> " + configDirFile);
+                       }
                } else {
                        return false;
                }
index 81873bd..dc90fb5 100644 (file)
@@ -163,7 +163,9 @@ public class DistributionController {
                        
                        // temp file cleanup
                        if (tmp.exists()) {
-                               tmp.delete();
+                               if (!tmp.delete()) {
+                                       Log.err("Fail to delete file ==> " + tmp);
+                               }
                        }
                }
        }
index f37563b..e879890 100644 (file)
@@ -212,9 +212,13 @@ public class InstallManager {
                                return found;
                        }
                });
-
-               for (File f : tmpFiles) {
-                       f.delete();
+               
+               if (tmpFiles != null) {
+                       for (File f : tmpFiles) {
+                               if (!f.delete()) {
+                                       Log.err("Fail to delete file ==> " + f);
+                               }
+                       }
                }
        }
 
@@ -358,7 +362,9 @@ public class InstallManager {
                File currentInfoDir = new File(
                                PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY));
                if (!currentInfoDir.exists()) {
-                       currentInfoDir.mkdirs();
+                       if (!currentInfoDir.mkdirs()) {
+                               Log.err("Fail to delete file ==> " + currentInfoDir);
+                       }
                }
 
                File oldInstalledList = new File(PathUtil.get(
@@ -374,35 +380,43 @@ public class InstallManager {
                        return;
                }
 
-               File[] oldPackageDir = new File(Config.OLD_INFO_REMOVESCRIPT_PATH)
-                               .listFiles();
-               for (File childFile : oldPackageDir) {
-                       File currentPackageDir = new File(PathUtil.get(
-                                       PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY),
-                                       childFile.getName()));
+               File[] oldPackageDir = new File(Config.OLD_INFO_REMOVESCRIPT_PATH).listFiles();
+               
+               if (oldPackageDir != null) {
+                       for (File childFile : oldPackageDir) {
+                               File currentPackageDir = new File(PathUtil.get(
+                                               PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY),
+                                               childFile.getName()));
+
+                               File parentDir = currentPackageDir.getParentFile();
+                               if (!parentDir.exists()) {
+                                       if (!parentDir.mkdirs()) {
+                                               Log.err("Fail to create file ==> " + parentDir);
+                                       }
+                               }
 
-                       File parentDir = currentPackageDir.getParentFile();
-                       if (!parentDir.exists()) {
-                               parentDir.mkdirs();
+                               PathUtil.move(childFile, currentPackageDir);
                        }
-
-                       PathUtil.move(childFile, currentPackageDir);
                }
 
-               File[] oldInstalledFileList = new File(
-                               Config.OLD_INSTALLED_FILE_LIST_DIRECTORY_PATH).listFiles();
-               for (File childFile : oldInstalledFileList) {
-                       File currentInstalledFile = new File(PathUtil.get(PathUtil
-                                       .getFromInstalledPath(Config.INFO_DIRECTORY), PathUtil
-                                       .getFileNameWithOutExtension(childFile.getAbsolutePath()),
-                                       childFile.getName()));
-
-                       File parentDir = currentInstalledFile.getParentFile();
-                       if (!parentDir.exists()) {
-                               parentDir.mkdirs();
-                       }
+               File[] oldInstalledFileList = new File(Config.OLD_INSTALLED_FILE_LIST_DIRECTORY_PATH).listFiles();
+               
+               if (oldInstalledFileList != null) {
+                       for (File childFile : oldInstalledFileList) {
+                               File currentInstalledFile = new File(PathUtil.get(PathUtil
+                                               .getFromInstalledPath(Config.INFO_DIRECTORY), PathUtil
+                                               .getFileNameWithOutExtension(childFile.getAbsolutePath()),
+                                               childFile.getName()));
+
+                               File parentDir = currentInstalledFile.getParentFile();
+                               if (!parentDir.exists()) {
+                                       if (!parentDir.mkdirs()) {
+                                               Log.err("Fail to create file ==> " + parentDir);
+                                       }
+                               }
 
-                       PathUtil.move(childFile, currentInstalledFile);
+                               PathUtil.move(childFile, currentInstalledFile);
+                       }                       
                }
 
                PathUtil.remove(oldInfoDir);
@@ -570,7 +584,11 @@ public class InstallManager {
                }
 
                if (Options.doPackageValidation) {
-                       return checkFileChecksum(pkg, Checksum.getSHA256(filePath));
+                       if (Checksum.getSHA256(filePath) != null) {
+                               return checkFileChecksum(pkg, Checksum.getSHA256(filePath));                            
+                       } else {
+                               return false;
+                       }
                } else {
                        return true;
                }
@@ -852,7 +870,9 @@ public class InstallManager {
                // Make target directory
                File targetDirFile = new File(targetDir);
                if (!targetDirFile.exists()) {
-                       targetDirFile.mkdirs();
+                       if (!targetDirFile.mkdirs()) {
+                               Log.err("Fail to create file ==> " + targetDirFile);
+                       }
                }
 
                // Keep target path in system
@@ -1026,7 +1046,9 @@ public class InstallManager {
                File targetDir = new File(Registry.getInstalledPath() + File.separator
                                + Config.INSTALL_MANAGER_DIRECTORY);
                if (!targetDir.exists()) {
-                       targetDir.mkdirs();
+                       if (!targetDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + targetDir);
+                       }
                }
 
                String to = targetDir.getAbsolutePath();
@@ -1101,7 +1123,9 @@ public class InstallManager {
 
                File toFile = getInstalledAppPath();
                if (!toFile.exists()) {
-                       toFile.mkdirs();
+                       if (!toFile.mkdirs()) {
+                               Log.err("Fail to create file ==> " + toFile);
+                       }
                }
 
                if (fromFile.getAbsolutePath().equals(toFile.getAbsolutePath())) {
index adae8de..04c74f3 100644 (file)
@@ -433,7 +433,7 @@ public class InstallManagerNoUI {
  
            long usableSpace = file.getUsableSpace();
            
-           if (usableSpace == 0) {
+           if (usableSpace == 0 && root != null) {
                usableSpace = root.getUsableSpace();
            } 
            
index fc5e2da..bc25067 100644 (file)
@@ -125,7 +125,9 @@ public class Installer {
                                return false;
                        } else {
                                if (removeScriptTo.exists()) {
-                                       removeScriptTo.delete();
+                                       if (!removeScriptTo.delete()) {
+                                               Log.err("Fail to delete file ==> " + removeScriptTo);
+                                       }
                                }
                                if (!PathUtil.moveFile(removeScriptFrom, removeScriptTo)) {
                                        Log.err("Cannot move removeScript to targetDir => "
index 8b4dd69..dbebfed 100644 (file)
@@ -191,7 +191,7 @@ public class Options {
                                                        + distribution + ", packages : " + packages);
                                        System.out.println("-install option must have some arguements"
                                                                        + " you can see usage using '-help'");
-                                       System.exit(0);
+                                       throw new IMFatalException(ErrorCode.WRONG_OPTION);
                                }
                                break;
                        } else if (arg.equals("-remove")) {
@@ -210,7 +210,7 @@ public class Options {
                                                " [-r repository] [-d distribution] [-l SDK target directory(optional)]" +
                                                " [-p meta package ....]");
                                System.out.println("Usage : InstallManager.bin(exe, sh) [-remove] [-p meta package... | all]");
-                               System.exit(0);
+                               throw new IMFatalException(ErrorCode.WRONG_OPTION);
                        } else if(arg.equals("-conf")) {
                                if(iter.hasNext()) {
                                        userConfPath = iter.next();
index 856cae6..1bf2313 100644 (file)
@@ -119,6 +119,7 @@ public class SDKExtensionInfo {
         */
        public void remove(String name, String packageRepo) {
                uninstallExtraPackages(packageRepo);
+               removeExtensionPackagesInRepoPackages(packageRepo);
                if (contains(packageRepo)) {
                        userExtensionRepositories.remove(packageRepo);
                }
@@ -127,6 +128,25 @@ public class SDKExtensionInfo {
        }
        
        /**
+        * Remove extension packages in repository packages by extension repository
+        * which is selected for removing on 'Add Extras' dialog.
+        * @param repo specific extension repository for removing.
+        */
+       private void removeExtensionPackagesInRepoPackages(String repo) {
+               PackageManager pm = InstallManager.getInstance().getPackageManager();
+               PackageSet repoPkgs = pm.getRepoPackages();
+               PackageSet clone = (PackageSet) repoPkgs.clone();
+
+               for (Package pkg : repoPkgs) {
+                       if (pkg.getExtensionServer().equalsIgnoreCase(repo)) {
+                               clone.remove(pkg);
+                       }
+               }
+               
+               pm.setRepoPackages(clone);
+       }
+       
+       /**
         * Uninstall extra packages which belong to selected extra repository. 
         * @param repo Selected extra repository for removing.
         */
@@ -199,7 +219,9 @@ public class SDKExtensionInfo {
        private void makeCacheDir() {
                File cacheDir = new File(CACHING_FULL_PATH);
                if (!cacheDir.exists()) {
-                       cacheDir.mkdirs();                      
+                       if (!cacheDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + cacheDir);
+                       }
                }
        }
        
@@ -209,7 +231,9 @@ public class SDKExtensionInfo {
        private void writeExtraRepoToCache() {
                File cacheFile = new File(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME));
                if (cacheFile.exists()) {
-                       cacheFile.delete();
+                       if (!cacheFile.delete()) {
+                               Log.err("Fail to delete file ==> " + cacheFile);
+                       }
                } else {
                        try {
                                cacheFile.createNewFile();
@@ -296,7 +320,9 @@ public class SDKExtensionInfo {
                if (size > 0) {// success to download extra package list from repository.
                        Log.log("Success to download extra package list. ==> " + tmp.getAbsolutePath());
                        if (extraPkgList.exists()) {
-                               extraPkgList.delete();
+                               if (!extraPkgList.delete()) {
+                                       Log.err("Fail to delete file ==> " + extraPkgList);
+                               }
                        }
                        return PathUtil.move(tmp, extraPkgList);
                } else {  // fail to download extra package list from repository.
index 4bcd525..41cd1e9 100644 (file)
@@ -108,7 +108,9 @@ public class SnapshotLog {
 
                // temp file cleanup
                if (tmp.exists()) {
-                       tmp.delete();
+                       if (!tmp.delete()) {
+                               Log.err("Fail to delete file ==> " + tmp);
+                       }
                }
                
                return true;
index 870d925..b9db7cb 100644 (file)
@@ -148,12 +148,16 @@ public class UpdateInstallManager {
 
                File downloadInstallManagerFile = new File(downloadInstallManagerPath);
                if (downloadInstallManagerFile.exists()) {
-                       downloadInstallManagerFile.delete();
+                       if (!downloadInstallManagerFile.delete()) {
+                               Log.err("Fail to delete file ==> " + downloadInstallManagerFile);
+                       }
                }
 
                File parentDir = downloadInstallManagerFile.getParentFile();
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (!parentDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + parentDir);
+                       }
                }
 
                URL serverIntallManager = null;
@@ -191,12 +195,16 @@ public class UpdateInstallManager {
                File file = new File(path);
                
                if (file.exists()) {
-                       file.delete();
+                       if (!file.delete()) {
+                               Log.err("Fail to delete file ==> " + file);
+                       }
                }
 
                File parentDir = file.getParentFile();
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (!parentDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + parentDir);
+                       }
                }
 
                URL url = null;
index 98029b8..da01a4b 100644 (file)
@@ -66,6 +66,7 @@ import org.tizen.installmanager.lib.exception.IMNetworkConnectException;
 import org.tizen.installmanager.lib.exception.IMNetworkDownloadException;
 import org.tizen.installmanager.ui.dialog.LoginDlg;
 import org.tizen.installmanager.util.PathUtil;
+import org.tizen.installmanager.util.ResourceHandler;
 
 /**
  * Manages downloading from url.
@@ -177,7 +178,9 @@ public class Downloader {
                
                File parentDir = destFile.getParentFile();
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (!parentDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + parentDir);
+                       }
                }
                
                RandomAccessFile output = null;
@@ -359,7 +362,7 @@ public class Downloader {
                } catch (IOException e) {
                        ErrorController.setErrorMessage(e.getMessage());
                        Log.ExceptionLog(e);
-                       return null;
+                       ResourceHandler.closeObjectSilently(raFile);
                }
                
                return raFile;
index 3f21541..0f9e66f 100644 (file)
@@ -83,7 +83,9 @@ public class Log {
                                                                .format(startTime) + ".log"));
                File parentDir = mLogFile.getParentFile();
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (!parentDir.mkdirs()) {
+                               Log.err("Fail to create directory ==> " + parentDir);
+                       }
                }
 
                try {
@@ -131,7 +133,9 @@ public class Log {
                });
 
                for (int i = 0; i < logs.length - 5; i++) {
-                       logs[i].delete();
+                       if (!logs[i].delete()) {
+                               Log.err("Fail to delete file ==> " + logs[i]);
+                       }
                }
 
        }
index cfa63e4..ff1bf1a 100644 (file)
@@ -189,7 +189,11 @@ public class Registry {
                File file = new File(REGISTRY_FILE_PATH);
 
                if (file.exists()) {
-                       file.delete();
+                       if (file.delete()) {
+                               Log.log("Success to delete file ==> " + file);
+                       } else {
+                               Log.err("Fail to delete file ==> " + file);
+                       }
                }
                
                removeOldFiles();
index baf41dd..af64a70 100644 (file)
@@ -123,12 +123,20 @@ public abstract class SDKPackageFormat {
                }
 
                if (installedListFile.exists()) {
-                       installedListFile.delete();
+                       if (installedListFile.delete()) {
+                               Log.log("Success to delete file ==> " + installedListFile);
+                       } else {
+                               Log.err("Fail to delete file ==> " + installedListFile);
+                       }
                }
 
                File installedListDir = installedListFile.getParentFile();
                if (!installedListDir.exists()) {
-                       installedListDir.mkdirs();
+                       if (installedListDir.mkdirs()) {
+                               Log.log("Success to create directory ==> " + installedListDir);
+                       } else {
+                               Log.err("Fail to create directory ==> " + installedListDir);
+                       }
                }
 
                try {
index 364225c..0e434b5 100644 (file)
@@ -67,7 +67,11 @@ public class LinuxSDKPackageFormat extends SDKPackageFormat{
         }
 
         if (!targetDir.exists()) {
-               targetDir.mkdirs();
+               if (targetDir.mkdirs()) {
+                       Log.log("Success to create directory ==> " + targetDir);
+               } else {
+                       Log.err("Fail to create directory ==> " + targetDir);
+               }
         }
 
         int exitValue;
index 918aecb..620949a 100644 (file)
@@ -213,11 +213,19 @@ public class LinuxShellInstalledListParser extends ShellParser {
        File parentFile = filePath.getParentFile();
        
        if (!parentFile.exists()) {
-               parentFile.mkdirs();
+               if (parentFile.mkdirs()) {
+                       Log.log("Success to create directory ==> " + parentFile);
+               } else {
+                       Log.err("Fail to create directory ==> " + parentFile);
+               }
        }
        
        if (filePath.exists()) {
-               filePath.delete();
+               if (filePath.delete()) {
+                       Log.log("Success to delete directory ==> " + filePath);
+               } else {
+                       Log.err("Fail to delete directory ==> " + filePath);
+               }
        }
        
        
index 9d25f30..f37d063 100644 (file)
@@ -30,6 +30,7 @@ package org.tizen.installmanager.lib.mac;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
@@ -56,7 +57,7 @@ public class MacFileSystemInfo implements IFileSystemInformation {
                { 
                        Process p=Runtime.getRuntime().exec("df -k"); 
                        p.waitFor(); 
-                       ipStream = new InputStreamReader(p.getInputStream());
+                       ipStream = new InputStreamReader(p.getInputStream(), "UTF-8");
                        reader = new BufferedReader(ipStream); 
                        
                        String line = reader.readLine();
index 71af6d8..90e81f2 100644 (file)
@@ -60,20 +60,25 @@ public class WindowsProgramController extends ProgramController{
        public void terminateRunningProgram() {
                List<Integer> pidList = getSDKPidList();
                
-               for (Integer pid : pidList) {
-                       String command = "TASKKILL /F /PID " + pid;
-                       try {
-                               ShellUtil.execute(command);
-                       } catch (IMShellCommandFail e) {
-                               Log.err("Failed to kill "+pid);
-                               Log.ExceptionLog(e);
-                               // ignore kill failure
-                       }
+               if (pidList != null) {
+                       for (Integer pid : pidList) {
+                               String command = "TASKKILL /F /PID " + pid;
+                               try {
+                                       ShellUtil.execute(command);
+                               } catch (IMShellCommandFail e) {
+                                       Log.err("Failed to kill "+pid);
+                                       Log.ExceptionLog(e);
+                                       // ignore kill failure
+                               }
+                       }                       
                }
                
-               List<Integer> confirmPidList = getSDKPidList();
-               if (confirmPidList.size() > 0) {
-                       ErrorController.setInfoCode(InfoCode.CANNOT_KILL_PROCESS);
+               List<Integer> afterPidList = getSDKPidList();
+               
+               if (afterPidList != null) {
+                       if (afterPidList.size() > 0) {
+                               ErrorController.setInfoCode(InfoCode.CANNOT_KILL_PROCESS);
+                       }
                }
        }
 
@@ -122,8 +127,12 @@ public class WindowsProgramController extends ProgramController{
        public boolean runningProgramExists() {
                List<Integer> pidList = getSDKPidList();
                
-               if (pidList.size() > 0) {
-                       return true;
+               if (pidList != null) {
+                       if (pidList.size() > 0) {
+                               return true;
+                       } else {
+                               return false;
+                       }
                } else {
                        return false;
                }
index ae06d03..9dc01f9 100644 (file)
@@ -73,7 +73,11 @@ public class WindowsSDKPackageFormat extends SDKPackageFormat{
                }
                
                if (!targetDir.exists()) {
-                       targetDir.mkdirs();
+                       if (targetDir.mkdirs()) {
+                               Log.log("Success to create directory ==> " + targetDir);
+                       } else {
+                               Log.err("Fail to create directory ==> " + targetDir);
+                       }
                }
 
                unZipPackage(fileFullPath, targetDir, monitor);
@@ -113,11 +117,20 @@ public class WindowsSDKPackageFormat extends SDKPackageFormat{
 
                                File parentFile = targetFile.getParentFile();
                                if (!parentFile.exists()) {
-                                       parentFile.mkdirs();
+                                       if (parentFile.mkdirs()) {
+                                               Log.log("Success to create directory ==> " + parentFile);
+                                       } else {
+                                               Log.err("Fail to create directory ==> " + parentFile);
+                                       }
                                }
 
                                if (targetPath.endsWith("/")) {// zipEntry.isDirectory()) {
-                                       new File(targetPath).mkdir();
+                                       File target = new File(targetPath);
+                                       if (target.mkdir()) {
+                                               Log.log("Success to create directory ==> " + target);
+                                       } else {
+                                               Log.err("Fail to create directory ==> " + target);
+                                       }
                                        zipInStream.closeEntry();
                                        writeFileList(zipEntry.getName());
                                        zipEntry = zipInStream.getNextEntry();
index c385535..d0e12c1 100644 (file)
@@ -323,7 +323,9 @@ public abstract class PackageManager {
                        sectionsInstalled= new LinkedList<PropertySection>();
                }
                
-               setInstalledPackageList(sectionsInstalled);
+               if (sectionsInstalled != null) {
+                       setInstalledPackageList(sectionsInstalled);                     
+               }
        }
        
        /**
@@ -436,9 +438,28 @@ public abstract class PackageManager {
        }
        
        /**
+        * Set repository packages.
+        * @param packageSet
+        */
+       public void setRepoPackages(PackageSet packageSet) {
+               repoPackages = packageSet;
+       }
+       
+       /**
         * @return root meta packages of repository
         */
        public PackageSet getRootMetaPackagesOfRepository() {
+               PackageSet clone = (PackageSet) repoPackages.clone();
+               
+               // Repository packages should not have extension packages.
+               for (Package pkg : repoPackages) {
+                       if (pkg.isExtensionPackage()) {
+                               clone.remove(pkg);
+                       }
+               }
+               
+               repoPackages = clone;
+               
                return rootMeta(repoPackages);
        }
        
@@ -484,9 +505,11 @@ public abstract class PackageManager {
                                }
                        }
                        
-                       for(Package rp : repoPackages) {
-                               if(!recentPackages.contains(rp)) {
-                                       recentPackages.add(rp);
+                       if (repoPackages != null) {
+                               for(Package rp : repoPackages) {
+                                       if(!recentPackages.contains(rp)) {
+                                               recentPackages.add(rp);
+                                       }
                                }
                        }
                }
@@ -1416,7 +1439,7 @@ public abstract class PackageManager {
                PackageSet packageList = repoPackages;
                packageList.addAll(extensionPackages);
                
-               if(packageList.hasPackageByName(pkgName)) {
+               if (packageList.hasPackageByName(pkgName)) {
                        return packageList.getPackageByName(pkgName);
                } else {
                        return null;
@@ -1428,6 +1451,17 @@ public abstract class PackageManager {
 //                     return null;
 //             }
        }
+       
+       public void removePackageFromPackageManager(String pkgName) {
+               PackageSet clone = (PackageSet) repoPackages.clone();
+               Package pkg = clone.getPackageByName(pkgName);
+               
+               if (clone.hasPackage(pkg)) {
+                       clone.remove(pkg);
+               }
+               
+               repoPackages = clone;
+       }
        /**
         * @param packageNames
         * @return packages collected by the given package names
index 3b01739..c86f6e8 100644 (file)
@@ -237,7 +237,11 @@ public class PropertyParser {
                }
                
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (parentDir.mkdirs()) {
+                               Log.log("Success to create parent directory ==> " + parentDir);
+                       } else {
+                               Log.err("Fail to create parent directory ==> " + parentDir);
+                       }
                }
                
                if (!targetFile.exists()) {
@@ -256,10 +260,16 @@ public class PropertyParser {
                        fWriter =       new     FileWriter(targetPath);
                        
                        if (properties.size() == 0) {
-                               targetFile.delete();
+                               if (targetFile.delete()) {
+                                       Log.log("Success to remove file ==> " + targetFile);
+                               } else {
+                                       Log.err("Fail to remove file ==> " + targetFile);
+                               }
                                
                                if (parentDir.getName().equals(".sdkconfig")) {
-                                       parentDir.delete();
+                                       if (!parentDir.delete()) {
+                                               Log.err("Fail to delete file ==> " + parentDir);
+                                       }
                                }
                        } else {
                                for (int        i=0;i<properties.size();i++) {
index 0f3d6fa..8107db7 100644 (file)
@@ -484,12 +484,20 @@ public class ConfigFile {
 
                File configFile = new File(configFilePath);
                if (configFile.exists()) {
-                       configFile.delete();
+                       if (configFile.delete()) {
+                               Log.log("Success to delete configuration file ==> " + configFile);
+                       } else {
+                               Log.err("Fail to delete configuration file ==> " + configFile);
+                       }
                }
 
                File parentDir = configFile.getParentFile();
                if (!parentDir.exists()) {
-                       parentDir.mkdirs();
+                       if (parentDir.mkdirs()) {
+                               Log.log("Success to create parent directory of configuration file ==> " + parentDir);
+                       } else {
+                               Log.err("Fail to create parent directory of configuration file ==> " + parentDir);
+                       }
                }
 
                try {
index 1c83b3f..c46986d 100644 (file)
@@ -120,12 +120,6 @@ public class PackageSet extends LinkedHashSet<Package>{
        }
        
        public int getSize() {
-               int cnt = 0;
-               
-               for (Package pkg : this) {
-                       cnt++;
-               }
-               
-               return cnt;
+               return this.size();
        }
 }
index a12e91d..c9fe708 100644 (file)
@@ -34,6 +34,7 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 
@@ -100,7 +101,7 @@ import org.tizen.installmanager.util.PathUtil;
  * @author Taeyoung Son <taeyoung2.son@samsung.com>
  */
 public class InstallManagerWindow extends ApplicationWindow {
-       public static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);
+       private static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);
 
        private static final Point POINT_MAIN_WINDOW = new Point(628, 478);
        private static Image IMAGE_WINDOW_ICON;
@@ -131,7 +132,6 @@ public class InstallManagerWindow extends ApplicationWindow {
        protected static ViewController controller;
        private SelectionAdapter cancelBtnSelectionAdapter = null;
        private SelectionAdapter closeBtnSelectionAdapter = null;
-       protected boolean cancelButtonClicked;
 
        /**
         * Create the application window.
@@ -590,9 +590,9 @@ public class InstallManagerWindow extends ApplicationWindow {
                                extraDialog.open();
                                
                                if (sl_composite.topControl == compositeInstallablePage) {
-                                       compositeInstallablePage.addExtensionPackagesToExtra(extraDialog.getPackagesFromExtraRepository());
+                                       compositeInstallablePage.loadPage(controller);
                                } else if (sl_composite.topControl == compositeUpdatableListPage) {
-                                       compositeUpdatableListPage.addExtensionPackagesToExtra(extraDialog.getPackagesFromExtraRepository());
+                                       compositeUpdatableListPage.loadPage(controller);
                                }
                        }
                });
@@ -761,7 +761,7 @@ public class InstallManagerWindow extends ApplicationWindow {
 
                while (iter.hasNext()) {
                        String key = (String) iter.next();
-                       String value = env.get(key);
+                       Set<Entry<String, String>> value = env.entrySet();
                        Log.log(key + " = " + value);
                }
                Log.log("=============================================");
index f2d1a0a..c3da1fb 100644 (file)
@@ -582,13 +582,21 @@ public class ConfigurationDialog extends Dialog {
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
                                Point point = new Point(e.x, e.y);
-                               TableItem item = snapshotTable.getItem(point);
-                               
                                String repo = Config.getInstance().getConfigFile().getRepository();
                                String dist = distributionCombo.getItem(distributionCombo.getSelectionIndex());
-
+                               
                                SnapshotLog snapshotLog = new SnapshotLog(PathUtil.addURLPath(repo, dist));
-                               String log = snapshotLog.getSnapshotLog(item.getText(TABLE_NAME));
+                               
+                               TableItem item = snapshotTable.getItem(point);
+                               String snapshot = null;
+                               if (item != null) {
+                                       snapshot = item.getText(TABLE_NAME);    
+                               }
+                               
+                               String log = null;
+                               if (snapshot != null) {
+                                       log = snapshotLog.getSnapshotLog(item.getText(TABLE_NAME));     
+                               }
                                
                                if (log == null) {
                                        MessageBoxDlg.showDlg(
@@ -679,35 +687,35 @@ public class ConfigurationDialog extends Dialog {
                Snapshot latestSnapshot = controller.getLatestSnapshot(distribution);
                if (latestSnapshot != null) {
                        addLatestItemToSnapshotTable(latestSnapshot);
-               }
-               
-               if (buttonSnapshotFilter.getSelection()) {
-                       SnapshotList allSnapshots = controller.getSnapshotList(distribution);
-                       
-                       if (allSnapshots == null) {
-                               Log.log("Selected distribution(" + distribution + ") does not exist in repository");
-                               return;
-                       }
                        
-                       for (Snapshot snapshot : allSnapshots) {
-                               if (!latestSnapshot.equals(snapshot)) {
-                                       addItemToSnapshotTable(snapshot);
+                       if (buttonSnapshotFilter.getSelection()) {
+                               SnapshotList allSnapshots = controller.getSnapshotList(distribution);
+                               
+                               if (allSnapshots == null) {
+                                       Log.log("Selected distribution(" + distribution + ") does not exist in repository");
+                                       return;
                                }
-                       }
-               } else {
-                       //add snapshots to table
-                       SnapshotList snapshots = controller.getManualSnapshotList(distribution);
-                       
-                       if (snapshots == null) {
-                               Log.log("Selected distribution(" + distribution + ") does not exist in repository");
-                               return;
-                       }
-                       
-                       for (Snapshot snapshot : snapshots) {
-                               if (!latestSnapshot.equals(snapshot)) {
-                                       addItemToSnapshotTable(snapshot);
+                               
+                               for (Snapshot snapshot : allSnapshots) {
+                                       if (!latestSnapshot.equals(snapshot)) {
+                                               addItemToSnapshotTable(snapshot);
+                                       }
                                }
-                       }                       
+                       } else {
+                               //add snapshots to table
+                               SnapshotList snapshots = controller.getManualSnapshotList(distribution);
+                               
+                               if (snapshots == null) {
+                                       Log.log("Selected distribution(" + distribution + ") does not exist in repository");
+                                       return;
+                               }
+                               
+                               for (Snapshot snapshot : snapshots) {
+                                       if (!latestSnapshot.equals(snapshot)) {
+                                               addItemToSnapshotTable(snapshot);
+                                       }
+                               }                       
+                       }
                }
        }
 
@@ -766,6 +774,7 @@ public class ConfigurationDialog extends Dialog {
                                        if (strDir.endsWith(SDK_IMAGE_ZIP_EXTENSION)) {
                                                imageFile = new File(strDir);
                                                if (validation(strDir)) {
+                                                       Log.log("Package list file found in SDK image => " + strDir);
                                                        textLocalServerUrl.setText(strDir);
                                                        localErrLabel.setText("");
                                                        UNZIP_RESULT unzipResult = unzipSDKImageFile(imageFile);
@@ -774,6 +783,7 @@ public class ConfigurationDialog extends Dialog {
                                                        }
                                                        Config.fromWhere = Config.ConfDialog.LOCAL_IMAGE; // it means data from file dialog.
                                                } else {
+                                                       Log.err("Package list file not found is SDK image => " + strDir);
                                                        MessageBoxDlg.showDlg(Display.getCurrent().getShells()[0], 
                                                           "Error", 
                                                           "No package list file is found in the image file. Check the image file.", 
@@ -826,8 +836,10 @@ public class ConfigurationDialog extends Dialog {
                }
 
                if (zipFile != null) {
+                       String packageList = PackageManager.getInstance().getPackageListFileName();
+                       Log.log("This platform must have package list file as '" + packageList + "'");
                        
-                       entry = zipFile.getEntry(PackageManager.getInstance().getPackageListFileName());
+                       entry = zipFile.getEntry(packageList);
                        
                        try {
                                zipFile.close();
@@ -879,11 +891,18 @@ public class ConfigurationDialog extends Dialog {
                File uselessFile = new File(PathUtil.get(unzipTargetDir, Config.BINARY_DIRECTORY));
                if (uselessFile.exists()) {
                        if (uselessFile.isDirectory()) {
-                               for (File useless : uselessFile.listFiles()) {
-                                       useless.delete();
+                               File[] files = uselessFile.listFiles();
+                               if (files != null) {
+                                       for (File useless : files) {
+                                               if (!useless.delete()) {
+                                                       Log.err("Fail to delete useless file ==> " + useless);
+                                               }
+                                       }
                                }
                        }
-                       uselessFile.delete();
+                       if (!uselessFile.delete()) {
+                               Log.err("Fail to delete file ==> " + uselessFile);
+                       }
                }
                
                UNZIP_RESULT unzipResult = null;
index 79c7918..0885fa1 100644 (file)
@@ -245,7 +245,11 @@ public class UnzipImageDialog extends Dialog {
     private long unzipImageFile(Composite composite) {
                final File sdkTempDirFile = new File(sdkTempDir);
                if (!sdkTempDirFile.exists()) {
-                       sdkTempDirFile.mkdirs();
+                       if (sdkTempDirFile.mkdirs()) {
+                               Log.log("Success to create SDK temporary directory " + sdkTempDirFile);
+                       } else {
+                               Log.err("Fail to create SDK temporary directory " + sdkTempDirFile);
+                       }
                }
                
                File targetDir = sdkTempDirFile;
@@ -264,11 +268,15 @@ public class UnzipImageDialog extends Dialog {
                                File targetFile = new File(targetDir, fileNameToUnzip);
 
                                if (zipEntry.isDirectory()) {// Directory case
-                                       targetFile.mkdir(); // Make directory
+                                       if (!targetFile.mkdir()) { // Make directory
+                                               Log.err("Fail to create file ==> " + targetFile);
+                                       }
                                } else { // File case
                                        // Make parent directory
                                        File parent = new File(targetFile.getParent());
-                                       parent.mkdir();
+                                       if (!parent.mkdir()) {
+                                               Log.err("Fail to create file ==> " + parent);
+                                       }
                                        setProgress(++i, composite, zipEntry.getName()); // Increase progress bar.
                                        unzipEntry(zis, targetFile);
                                }
index 34301a0..704e097 100644 (file)
@@ -490,7 +490,7 @@ public class Item implements Comparable<Item> {
                        for (Item childItem : getChildren()) {
                                childItem.getTerminalPackages(installList, checked);
                        }
-               } 
+               }
                
                if (getChildren().size() <= 0) {
                        if (getCheckState() == CheckState.CHECKED) {
index da44401..8760844 100644 (file)
@@ -309,20 +309,14 @@ public class InstallableListPage extends PackageListPage {
                
                if (instType == InstallType.TYPICAL) {
                        iType = TYPICAL_PACKAGE_NAME;
-                       installType = InstallType.TYPICAL;
                } else if (instType == InstallType.MINIMAL) {
                        iType = MINIMAL_PACKAGE_NAME;
-                       installType = InstallType.MINIMAL;
                } else if (instType == InstallType.WEB_MINIMAL) {
                        iType = WEB_MINIMAL_PACKAGE_NAME;
-                       installType = InstallType.WEB_MINIMAL;
                } else if (instType == InstallType.NATIVE_MINIMAL) {
                        iType = NATIVE_MINIMAL_PACKAGE_NAME;
-                       installType = InstallType.NATIVE_MINIMAL;
-               } else {
-                       installType = InstallType.CUSTOM;
                }
-               
+
                setCheckedByType(iType);
                checkboxTreeViewer.refresh();
                checkboxTreeViewer.getTree().setEnabled(false);
@@ -331,8 +325,7 @@ public class InstallableListPage extends PackageListPage {
                                + convertToVolumeSize(getCheckedPackageSize(false)));
                lblUncompressedSize.setText("Install size : "
                                + convertToVolumeSize(getCheckedPackageSize(true)));
-               
-               setNextBtnEnabledAboutCheckedPackageCount();    
+               setNextBtnEnabledAboutCheckedPackageCount();
        }
 
        /**
@@ -342,6 +335,7 @@ public class InstallableListPage extends PackageListPage {
                if (installType == null || installType.isEmpty()) {
                        Log.err("Install type is empty. check install type or package server is old.");
                }
+
                Package pkg = InstallManager.getInstance().getPackageManager().getPackageByName(installType);
 
                if (pkg == null) {
index 6c7b34d..29abc84 100644 (file)
@@ -96,8 +96,6 @@ public abstract class PackageListPage extends PageTemplate {
                TYPICAL, MINIMAL, WEB_MINIMAL, NATIVE_MINIMAL, CUSTOM
        }
        
-       protected InstallType installType;
-       
        /**
         * Set environments for packagelist page, such as style, adding listener.
         * 
@@ -244,10 +242,11 @@ public abstract class PackageListPage extends PageTemplate {
                        msg = "test";
                } else {
                        msg = "This package is conflict package of\n";
-                       
+                       List<String> causePkgs = new ArrayList<String>();
                        for (Package pkg : causePackages) {
-                               msg += "'" + pkg.getPackageName() + "'\n";
+                               causePkgs.add(pkg.getPackageName());
                        }
+                       msg = "'" + causePkgs + "'\n";
                }
                                
                MessageBoxDlg.showDlg(Display.getCurrent().getShells()[0], 
@@ -572,11 +571,14 @@ public abstract class PackageListPage extends PageTemplate {
        private void removeChildrenOfExtra() {
                Item extraItem = getExtraTreeItem();
                
-               for (Item childItem : extraItem.getChildren()) {
-                       removeTreeItem(childItem);
+               if (extraItem != null) {
+                       if (extraItem.getChildren() != null) {
+                               for (Item childItem : extraItem.getChildren()) {
+                                       removeTreeItem(childItem);
+                               }
+                       }
+                       extraItem.clearChildrenItems();
                }
-               
-               extraItem.clearChildrenItems();
        }
        
        private void removeTreeItem(Item item) {
index 3964844..220dd0d 100644 (file)
@@ -77,7 +77,6 @@ public class SetInstallDirectoryPage extends PageTemplate {
        private Label spaceRequiredLabel;
        private Label spaceAvailableLabel;
        private Button selectPathBtn;
-       public ViewController viewController = null;
        private long requiredSpace = 0;
        private File selectedDisk = null;
 
@@ -236,7 +235,6 @@ public class SetInstallDirectoryPage extends PageTemplate {
         */
        public boolean loadPage(ViewController controller, long requiredSize) {
                boolean result = true;
-               viewController = controller;
                requiredSpace = requiredSize;
                
                InstallManagerWindow.setNextBtnEnabled(checkAvailablePath());
@@ -358,7 +356,7 @@ public class SetInstallDirectoryPage extends PageTemplate {
  
            long usableSpace = file.getUsableSpace();
            
-           if (usableSpace == 0) {
+           if (usableSpace == 0 && root != null) {
                usableSpace = root.getUsableSpace();
            } 
            
index 9054baf..4c25419 100644 (file)
@@ -414,7 +414,7 @@ public class ViewController {
                
                //get all meta packages (installable packages)
                //TODO : show all packages. (installable, installed)
-               PackageSet metaPackageSet = packageManager.getRootMetaPackagesOfRepository();           
+               PackageSet metaPackageSet = packageManager.getRootMetaPackagesOfRepository();   
                
                return makeTreeItem(metaPackageSet);
        }
@@ -528,7 +528,14 @@ public class ViewController {
         * @return There are packages to install or remove, return true. if not false.
         */
        public boolean existInstallableOrRemovablePackages() {
-               return (getRemovablePackageList().size() > 0 || getInstallableOrUpdatableMetaPackages().size() > 0);
+               PackageSet rmPkgs = getRemovablePackageList();
+               PackageSet insPkgs = getInstallableOrUpdatableMetaPackages();
+               
+               if (rmPkgs != null || insPkgs != null) {
+                       return (getRemovablePackageList().size() > 0 || getInstallableOrUpdatableMetaPackages().size() > 0);                    
+               } else {
+                       return false;
+               }
        }
        
        /**
@@ -536,10 +543,16 @@ public class ViewController {
         * @return There are packages to install or remove, return true. if not false.
         */
        public boolean existInstallableOrUpdatablePackages() {
-               if (Options.snapshot || Config.fromWhere == Config.ConfDialog.LOCAL_IMAGE) {
-                       return (getInstallablePackageListInSnapshot().size() > 0);
+               PackageSet ps = getInstallablePackageListInSnapshot();
+               
+               if (ps != null) {
+                       if (Options.snapshot || Config.fromWhere == Config.ConfDialog.LOCAL_IMAGE) {
+                               return (ps.size() > 0);
+                       } else {
+                               return (ps.size() > 0);
+                       }
                } else {
-                       return (getInstallableOrUpdatableMetaPackages().size() > 0);
+                       return false;
                }
        }
 
index c20dab7..875f956 100644 (file)
@@ -148,10 +148,15 @@ public class PathUtil {
         * @return
         */
        public static String getParentDirectory(String path, int parentDepth) {
-               for (int i=parentDepth; i>0; i--) {
-                       path = PathUtil.getParentDirectory(path);
+               String parentPath = null;
+               
+               if (path != null) {
+                       for (int i = parentDepth; i > 0; i--) {
+                               parentPath = PathUtil.getParentDirectory(path);
+                       }
                }
-               return path;
+               
+               return parentPath;
        }
 
        /**
@@ -221,14 +226,22 @@ public class PathUtil {
                
                if (!fromFile.isDirectory()) {
                        if (toFile.isDirectory() && !toFile.exists()) {
-                               toFile.mkdirs();
-                               toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
+                               if (toFile.mkdirs()) {
+                                       toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
+                                       Log.log("Success to create " + toFile);
+                               } else {
+                                       Log.err("Fail to create " + toFile);
+                               }
                        } else if (toFile.isDirectory() && toFile.exists()) {
                                toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
                        }
                        
                        if (toFile.exists()) {
-                               toFile.delete();
+                               if (toFile.delete()) {
+                                       Log.log("Success to delete " + toFile);
+                               } else {
+                                       Log.err("Fail to create " + toFile);
+                               }
                        }
                        
                        return copyFile(fromFile, toFile);
@@ -240,7 +253,9 @@ public class PathUtil {
                                return false;
                        } else {
                                if (!toFile.exists()) {
-                                       toFile.mkdirs();
+                                       if (!toFile.mkdirs()) {
+                                               Log.err("Fail to create file ==> " + toFile);
+                                       }
                                }
                                
                                File[] fileList = fromFile.listFiles();
@@ -269,7 +284,11 @@ public class PathUtil {
                }
                
                if (!to.exists()) {
-                       to.createNewFile();
+                       if (to.createNewFile()) {
+                               Log.log("Success to create " + to);
+                       } else {
+                               Log.err("Fail to create " + to);
+                       }
                }
                
                FileInputStream fInput = null;
@@ -319,13 +338,17 @@ public class PathUtil {
         * @throws IOException
         */
        public static void writeFileFromInputStream(InputStream is, File to) throws IOException {
-               Log.log("write file from input stream to : "+to);
+               Log.log("write file from input stream to : " + to);
                
                if (is == null) {
                        return;
                }
                if (!to.exists()) {
-                       to.createNewFile();
+                       if (to.createNewFile()) {
+                               Log.log("Success to create " + to + ".");
+                       } else {
+                               Log.err("Fail to create " + to + ".");
+                       }
                }
                FileOutputStream os = null;
                try {
@@ -369,7 +392,11 @@ public class PathUtil {
                
        File parentDir = toFile.getParentFile();
        if (!parentDir.exists()) {
-               parentDir.mkdirs();
+               if (parentDir.mkdirs()) {
+                       Log.log("Success to create parent directory ==> " + parentDir);
+               } else {
+                       Log.err("Fail to create parent directory ==> " + parentDir);
+               }
        }
        return move(fromFile, toFile);
     }
@@ -389,7 +416,11 @@ public class PathUtil {
        
         if (toFile.exists()) {
                if (toFile.isFile()) {
-                       toFile.delete();
+                       if (toFile.delete()) {
+                               Log.log("Success to delete " + toFile);
+                       } else {
+                               Log.log("Fail to delete " + toFile);
+                       }
                        return fromFile.renameTo(toFile);
                } else {
                    File[] files = fromFile.listFiles();
@@ -462,11 +493,11 @@ public class PathUtil {
 
                if (filePath.isDirectory()) {
                        File[] listFile = filePath.listFiles();
-                       
-                       for (File childFile : listFile) {
-                               ret = removeForWindows(childFile) && ret;
+                       if (listFile != null) {
+                               for (File childFile : listFile) {
+                                       ret = removeForWindows(childFile) && ret;
+                               }
                        }
-
                }
                
                System.gc(); // delete() method does not work exactly sometimes. so, there is gc() before delete().
index e5d0c8b..35fe5b2 100644 (file)
@@ -12,6 +12,6 @@ https://developer.tizen.org/tizen-sdk-license
 The licenses of all proprietary components contributed from companies other than Samsung will be either displayed as part of their respective installers or accessed inside installation package archive of each component.
 
 You may access and download Tizen SDK Open Source Software at:
-http://developer.tizen.org/download/tizenopensdk.tar.gz
+https://developer.tizen.org/downloads/tizen-sdk
 
 BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS, THE SAMSUNG TIZEN SDK LICENSE AGREEMENT AND THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG. If you do not agree with the Open Source Software license terms or the SAMSUNG TIZEN SDK LICENSE AGREEMENT or THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED  FROM COMPANIES OTHER THAN SAMSUNG, you may not download or use Tizen SDK.
\ No newline at end of file