ICU-5605 various fixes as discussed at the code review
X-SVN-Rev: 21408
This commit is contained in:
parent
5ef52d7773
commit
48f4e9f664
3829
icu4j/build.xml
3829
icu4j/build.xml
File diff suppressed because it is too large
Load Diff
@ -144,7 +144,7 @@ public class CLILoader {
|
||||
+ " Mode Started ***********");
|
||||
logger.printlnToScreen("");
|
||||
logger.printlnToScreen("\'Discover Only\' Mode:");
|
||||
logger.printlnToScreen("\tIn this mode, "
|
||||
logger.printlnToScreen("In this mode, "
|
||||
+ "the tool will search for ICU4J jars"
|
||||
+ " in the directories specified in DirectorySearch.txt"
|
||||
+ " and print the ICU4J jars detected and their respective"
|
||||
@ -162,7 +162,11 @@ public class CLILoader {
|
||||
// searching all subdirectories of the included path, using the backup
|
||||
// directory specified, and without using a status bar (since this is
|
||||
// command-line)
|
||||
logger.printlnToScreen("");
|
||||
logger.printlnToScreen("Search started.");
|
||||
pathModel.searchAll(resultModel, true, curDir, backupDir);
|
||||
logger.printlnToScreen("Search ended.");
|
||||
logger.printlnToScreen("");
|
||||
|
||||
// save the results in PathModel.RESULTLIST_FILENAME
|
||||
resultModel.saveResults();
|
||||
@ -191,7 +195,7 @@ public class CLILoader {
|
||||
+ " Mode Started ***********");
|
||||
logger.printlnToScreen("");
|
||||
logger.printlnToScreen("\'Patch\' Mode:");
|
||||
logger.printlnToScreen("\tIn this mode, the tool patches each of the"
|
||||
logger.printlnToScreen("In this mode, the tool patches each of the"
|
||||
+ " ICU4J jars listed in ICUList.txt with the new time zone"
|
||||
+ " information.");
|
||||
logger.printlnToScreen("");
|
||||
|
@ -1,10 +1,11 @@
|
||||
# *******************************************************************************
|
||||
# *******************************************************************************
|
||||
# * Copyright (C) 2007, International Business Machines Corporation and *
|
||||
# * others. All Rights Reserved. *
|
||||
# *******************************************************************************
|
||||
#
|
||||
# This file contains the list of directories in the file system that ICUTZU will
|
||||
# use to search for updatable icu4j jar files.
|
||||
# use to search for updatable icu4j jar files. It must be saved in UTF-8 (with
|
||||
# or without the BOM).
|
||||
#
|
||||
# To include all roots of the file system (ie. 'c:\', 'd:\', 'e:\', etc. in Windows
|
||||
# or '/' in Unix-based systems), insert the following:
|
||||
|
@ -21,7 +21,13 @@ public class ICUJarFinder {
|
||||
* The delay in milliseconds between showing directories to the command line
|
||||
* user.
|
||||
*/
|
||||
public static final int DELAY = 5000; // 5 seconds
|
||||
public static final long DELAY = 5000; // 5 seconds
|
||||
|
||||
/**
|
||||
* The delay in milliseconds between showing directories to the command line
|
||||
* user.
|
||||
*/
|
||||
public static long lastShowtime = 0; // 5 seconds
|
||||
|
||||
/**
|
||||
* Searchs the directories / files represented in <code>paths</code> for
|
||||
@ -94,7 +100,7 @@ public class ICUJarFinder {
|
||||
// search each of the included files/directories
|
||||
for (int i = 0; i < included.size(); i++)
|
||||
search(resultModel, logger, (File) included.get(i), excluded,
|
||||
subdirs, 0, 0);
|
||||
subdirs, 0);
|
||||
|
||||
// chain the result model
|
||||
return resultModel;
|
||||
@ -124,8 +130,8 @@ public class ICUJarFinder {
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private static ResultModel search(ResultModel resultModel, Logger logger,
|
||||
File file, List excluded, boolean subdirs, int depth,
|
||||
long lastShowtime) throws InterruptedException {
|
||||
File file, List excluded, boolean subdirs, int depth)
|
||||
throws InterruptedException {
|
||||
// ensure that the file is in canonical form
|
||||
try {
|
||||
file = file.getCanonicalFile();
|
||||
@ -159,7 +165,7 @@ public class ICUJarFinder {
|
||||
// recurse
|
||||
for (int i = 0; i < dirlist.length; i++)
|
||||
search(resultModel, logger, dirlist[i], excluded, subdirs,
|
||||
depth + 1, lastShowtime);
|
||||
depth + 1);
|
||||
}
|
||||
} else {
|
||||
// attempt to create an ICUFile object on the current file and add
|
||||
@ -168,7 +174,7 @@ public class ICUJarFinder {
|
||||
// if the file/directory is an ICU jar file that we can
|
||||
// update, add it to the results
|
||||
resultModel.add(new ICUFile(file, logger));
|
||||
logger.loglnToBoth("Added " + file.getPath() + ".");
|
||||
logger.printlnToBoth("Added " + file.getPath());
|
||||
} catch (IOException ex) {
|
||||
// if it's not an ICU jar file that we can update, ignore it
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
package com.ibm.icu.dev.tool.tzu;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -72,39 +73,50 @@ public class ICUTZUMain {
|
||||
|
||||
if (args.length == 0) {
|
||||
// in the case of running without commandline options
|
||||
new GUILoader(new File(".").getAbsoluteFile(), new File("Temp")
|
||||
.getAbsoluteFile(), new File("DirectoryList.txt")
|
||||
.getAbsoluteFile(), new File("ICUList.txt")
|
||||
.getAbsoluteFile(), new File("zoneinfo.res")
|
||||
.getAbsoluteFile(), new File("icu.gif")
|
||||
.getAbsoluteFile());
|
||||
return;
|
||||
}
|
||||
File curDir = new File(".");
|
||||
try {
|
||||
curDir = curDir.getCanonicalFile();
|
||||
} catch (IOException ex) {
|
||||
curDir = curDir.getAbsoluteFile();
|
||||
}
|
||||
|
||||
if (args.length != NUM_ARGS) {
|
||||
new GUILoader(curDir, new File("Temp").getAbsoluteFile(),
|
||||
new File("DirectoryList.txt").getAbsoluteFile(),
|
||||
new File("ICUList.txt").getAbsoluteFile(), new File(
|
||||
"zoneinfo.res").getAbsoluteFile(), new File(
|
||||
"icu.gif").getAbsoluteFile());
|
||||
return;
|
||||
} else if (args.length != NUM_ARGS) {
|
||||
System.err.println("Incorrect number of arguments.");
|
||||
System.err
|
||||
.println("Syntax: ICUTZUMain <cur dir> <path file> <result file> <tz file> <backup dir>");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
|
||||
File curDir = new File(args[CUR_DIR]);
|
||||
try {
|
||||
curDir = curDir.getCanonicalFile();
|
||||
} catch (IOException ex) {
|
||||
curDir = curDir.getAbsoluteFile();
|
||||
}
|
||||
|
||||
File backupDir = new File(curDir, args[BACKUP_DIR])
|
||||
.getAbsoluteFile();
|
||||
File pathFile = new File(curDir, args[PATH_FILE])
|
||||
.getAbsoluteFile();
|
||||
File resultFile = new File(curDir, args[RESULT_FILE])
|
||||
.getAbsoluteFile();
|
||||
File tzFile = new File(curDir, args[TZ_FILE]).getAbsoluteFile();
|
||||
File iconFile = new File(curDir, args[ICON_FILE])
|
||||
.getAbsoluteFile();
|
||||
|
||||
if ("true".equalsIgnoreCase(System.getProperty("nogui")))
|
||||
new CLILoader(curDir, backupDir, pathFile, resultFile,
|
||||
tzFile);
|
||||
else
|
||||
new GUILoader(curDir, backupDir, pathFile, resultFile,
|
||||
tzFile, iconFile);
|
||||
}
|
||||
|
||||
File curDir = new File(args[CUR_DIR]).getAbsoluteFile();
|
||||
File backupDir = new File(args[CUR_DIR], args[BACKUP_DIR])
|
||||
.getAbsoluteFile();
|
||||
File pathFile = new File(args[CUR_DIR], args[PATH_FILE])
|
||||
.getAbsoluteFile();
|
||||
File resultFile = new File(args[CUR_DIR], args[RESULT_FILE])
|
||||
.getAbsoluteFile();
|
||||
File tzFile = new File(args[CUR_DIR], args[TZ_FILE])
|
||||
.getAbsoluteFile();
|
||||
File iconFile = new File(args[CUR_DIR], args[ICON_FILE])
|
||||
.getAbsoluteFile();
|
||||
|
||||
if ("true".equalsIgnoreCase(System.getProperty("nogui")))
|
||||
new CLILoader(curDir, backupDir, pathFile, resultFile, tzFile);
|
||||
else
|
||||
new GUILoader(curDir, backupDir, pathFile, resultFile, tzFile,
|
||||
iconFile);
|
||||
} catch (Throwable ex) {
|
||||
// should any unexplained exception occur, we should exit
|
||||
// abnormally. ideally, this should never happen.
|
||||
|
@ -327,7 +327,7 @@ class ResultModel extends AbstractTableModel {
|
||||
icuFile = (ICUFile) iter.next();
|
||||
String line = icuFile.getFile().getPath() + '\t'
|
||||
+ icuFile.getTZVersion() + "\n";
|
||||
logger.printlnToScreen(line);
|
||||
logger.printToScreen(line);
|
||||
writer.write(line);
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user