[tranche] r288 committed - Ability to set temporary file directory from the preferences frame....

17 views
Skip to first unread message

tra...@googlecode.com

unread,
Aug 18, 2010, 2:19:54 PM8/18/10
to tranche-d...@googlegroups.com
Revision: 288
Author: augman85
Date: Wed Aug 18 11:19:06 2010
Log: Ability to set temporary file directory from the preferences frame.
Fixed loading preferences from configuration by default.
http://code.google.com/p/tranche/source/detail?r=288

Modified:
/src/org/tranche/tasks/TaskUtil.java
/src/org/tranche/util/PreferencesUtil.java
/src/org/tranche/util/TempFileUtil.java
/subprojects/GUI/src/org/tranche/gui/PreferencesFrame.java
/subprojects/GUI/src/org/tranche/gui/default.conf
/test/org/tranche/util/TempFileUtilTest.java

=======================================
--- /src/org/tranche/tasks/TaskUtil.java Wed Aug 11 12:13:53 2010
+++ /src/org/tranche/tasks/TaskUtil.java Wed Aug 18 11:19:06 2010
@@ -25,6 +25,7 @@
import java.util.Set;
import org.tranche.commons.Tertiary;
import org.tranche.TrancheServer;
+import org.tranche.commons.DebugUtil;
import org.tranche.configuration.Configuration;
import org.tranche.exceptions.AssertionFailedException;
import org.tranche.exceptions.TodoException;
@@ -181,8 +182,7 @@

ConnectionUtil.unlockConnection(strategy.getHostReceivingRequest());
}
} catch (Exception e) {
- out.println(e.getClass().getSimpleName() + ": " +
e.getMessage());
- e.printStackTrace(out);
+ DebugUtil.debugErr(TaskUtil.class, e);
}
out.println();
}
@@ -354,8 +354,7 @@

ConnectionUtil.unlockConnection(strategy.getHostReceivingRequest());
}
} catch (Exception e) {
- out.println(e.getClass().getSimpleName() + ": " +
e.getMessage());
- e.printStackTrace(out);
+ DebugUtil.debugErr(TaskUtil.class, e);
}
out.println();
}
@@ -437,8 +436,7 @@
out.println("Finished checking for meta data to delete
from " + host + " <attempt #" + attempt + ">. Deleted?: " +
(deleted ? "yes" : "no"));
break ATTEMPTS;
} catch (Exception e) {
- out.println(e.getClass().getSimpleName() + " occured
while attempting (#" + attempt + " of " + MAX_ATTEMPTS + ") to find meta
data to delete from " + host + ": " + e.getMessage());
- e.printStackTrace(out);
+ DebugUtil.debugErr(TaskUtil.class, e);

// Don't waste time -- the user cannot delete, so
throw exception immediately
if (e instanceof GeneralSecurityException) {
=======================================
--- /src/org/tranche/util/PreferencesUtil.java Tue Apr 27 10:26:55 2010
+++ /src/org/tranche/util/PreferencesUtil.java Wed Aug 18 11:19:06 2010
@@ -35,6 +35,7 @@

public static final File PREFERENCES_FILE = new
File(FlatFileTrancheServer.getDefaultHomeDir() + File.separator
+ "preferences");
public static final String PREF_DOWNLOAD_FILE = "download.file";
+ public static final String PREF_TEMPORARY_FILE_DIRECTORY = "temp.dir";
public static final String PREF_USER_FILE_LOCATION = "user.file";
public static final String PREF_UPLOAD_LOCATION = "uploader.file";
private static final Map<String, String> preferences = new
HashMap<String, String>();
@@ -170,20 +171,29 @@
}

/**
- *
+ *
* @param name
* @return String value of the given preference. <i>null</i> if
preference does not exist.
*/
- public static String get(String name) {
+ public static String get(String category, String name) {
waitForStartup();
String value = null;
synchronized (preferences) {
value = preferences.get(name);
}
if (value == null || value.equals("")) {
- value =
ConfigureTranche.get(ConfigureTranche.CATEGORY_GENERAL, name);
+ value = ConfigureTranche.get(category, name);
}
return value;
+ }
+
+ /**
+ *
+ * @param name
+ * @return String value of the given preference. <i>null</i> if
preference does not exist.
+ */
+ public static String get(String name) {
+ return get(ConfigureTranche.CATEGORY_GENERAL, name);

}

@@ -200,6 +210,15 @@
}
return 0;
}
+
+ public static boolean getBoolean(String category, String name) {
+ try {
+ return Boolean.valueOf(get(category, name));
+ } catch (Exception e) {
+ DebugUtil.debugErr(PreferencesUtil.class, e);
+ }
+ return false;
+ }

/**
*
=======================================
--- /src/org/tranche/util/TempFileUtil.java Fri Jun 18 11:09:32 2010
+++ /src/org/tranche/util/TempFileUtil.java Wed Aug 18 11:19:06 2010
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import org.tranche.commons.DebugUtil;

/**
* <p>This utility class creates a clean working temporary directory for
storing files during runtime.
@@ -49,7 +50,7 @@
// default location that data is saved
private static final String DEFAULT_TEMP_SUB_DIR = ".tranche-temp";
// the max attempts to make when creating direcoties
- private static final int maxTempDirAttempts = 20;
+ private static final int maxTempDirAttempts = 50;
// to track temp files made
private static int count = 0;
// To track temp directories made!
@@ -58,74 +59,7 @@
private static File tempDirectory;

static {
- // load the temp directory attribute
- try {
-
- // check for temp dir variable
- if (System.getProperty(JAVA_TEMP_DIR) != null
&& !System.getProperty(JAVA_TEMP_DIR).equals("")) {
-
- // May change to not be a hidden directory for
non-privileged Windows users
- String subdir = DEFAULT_TEMP_SUB_DIR;
-
- // try to lock on the 'trache-temp' directory
- if (!tryLock(new File(System.getProperty(JAVA_TEMP_DIR),
subdir))) {
- for (int i = 1; i < maxTempDirAttempts; i++) {
- File fileToTry = new
File(System.getProperty(JAVA_TEMP_DIR), subdir + "-" + i);
- if (tryLock(fileToTry)) {
- break;
- }
- // if on the last, throw exception
- if (i == 19) {
-
- // Try to use a non-hidden file.
- // Should only happen once.
- if (subdir.startsWith(".")) {
- System.out.println("Cannot write to " +
subdir);
- subdir = subdir.substring(1);
- System.out.println("Trying " + subdir);
- i = 1;
- continue;
- }
-
- throw new RuntimeException("Can't acquire a
temporary directory lock! Tried 20 times.");
- }
- }
- }
- } // fall back on the default home directory for a file lock
- else {
- // May change to not be a hidden directory for
non-privileged Windows users
- String subdir = DEFAULT_TEMP_SUB_DIR;
-
- if (!tryLock(new File(System.getProperty(JAVA_USER_HOME),
subdir))) {
- for (int i = 1; i < maxTempDirAttempts; i++) {
- File fileToTry = new
File(System.getProperty(JAVA_TEMP_DIR), subdir + "-" + i);
- if (tryLock(fileToTry)) {
- break;
- }
- // if on the last, throw exception
- if (i == maxTempDirAttempts - 1) {
-
- // Try to use a non-hidden file.
- // Should only happen once.
- if (subdir.startsWith(".")) {
- System.out.println("Cannot write to " +
subdir);
- subdir = subdir.substring(1);
- System.out.println("Trying " + subdir);
- i = 1;
- continue;
- }
-
- throw new RuntimeException("Can't acquire a
temporary directory lock! Tried 20 times.");
- }
- }
- }
- }
- } catch (RuntimeException e) {
- e.printStackTrace();
- throw e;
- } finally {
- System.out.println("Temporary directory: " + tempDirectory);
- }
+ loadTemporaryDirectory();
}

/**
@@ -133,7 +67,7 @@
* @param lockToTry
* @return
*/
- private static boolean tryLock(File lockToTry) {
+ private static synchronized boolean tryLock(File lockToTry) {
try {
// make if the file doesn't exist
if (!lockToTry.exists()) {
@@ -189,7 +123,7 @@
* @return
* @throws Exception
*/
- private static boolean canLockFile(File lockFile, boolean
isReleaseLockAfterTest) throws Exception {
+ private static synchronized boolean canLockFile(File lockFile, boolean
isReleaseLockAfterTest) throws Exception {
FileChannel fc = new RandomAccessFile(lockFile, "rw").getChannel();
FileLock lock = null;
try {
@@ -222,7 +156,7 @@
// Happens on file system that does not support file locking.
(Distributed? E.g., work/ volume on Queen Bee)
// Instead, see whether work around lock,
lock-workaround.file, exists
//
----------------------------------------------------------------------------------------------
- File workAround = new
File(lockFile.getParentFile(),"lock-workaround.file");
+ File workAround = new
File(lockFile.getParentFile(), "lock-workaround.file");

if (workAround.exists()) {
// Work around used by other process, so can't secure
@@ -247,7 +181,7 @@
* <p>Helper method to clean up old directories.</p>
* @param directoryToDelete
*/
- private static void recursiveDeleteSkipLockFiles(final File
directoryToDelete) {
+ private static synchronized void recursiveDeleteSkipLockFiles(final
File directoryToDelete) {
// delete everything but the lock file
ArrayList<File> filesToDelete = new ArrayList();
filesToDelete.add(directoryToDelete);
@@ -433,7 +367,7 @@
* @param f
* @return
*/
- private static boolean tryToMakeFile(File f) {
+ private synchronized static boolean tryToMakeFile(File f) {
try {
// make the parent if needed
File parent = f.getParentFile();
@@ -508,22 +442,78 @@
* @param directory
* @throws java.io.IOException
*/
- public static void setTemporaryDirectory(File directory) throws
IOException {
+ public synchronized static void setTemporaryDirectory(File directory)
throws IOException {
if (!directory.isDirectory()) {
throw new IOException(directory.getAbsolutePath() + " is not a
directory. Cannot set as temp directory.");
}
if (!directory.canWrite() || !directory.canRead()) {
throw new IOException(directory.getAbsolutePath() + " has
constricting permissions (readable?=" + directory.canRead() + ",
writeable?=" + directory.canWrite() + "). Cannot set as temp directory.");
}
+ if
(tempDirectory.getAbsolutePath().equals(directory.getAbsolutePath())) {
+ return;
+ }
+ // clear out the old temp dir
+ if (tempDirectory != null) {
+ clear();
+ }
tempDirectory = directory;
}
+
+ /**
+ *
+ */
+ public static synchronized void loadTemporaryDirectory() {
+ if (tempDirectory != null) {
+ clear();
+ }
+ try {
+ boolean success = false;
+ if
(PreferencesUtil.get(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY) !=
null) {
+ success = loadTemporaryDirectory(new
File(PreferencesUtil.get(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY)));
+ }
+ if (!success && System.getProperty(JAVA_TEMP_DIR) != null
&& !System.getProperty(JAVA_TEMP_DIR).equals("")) {
+ success = loadTemporaryDirectory(new
File(System.getProperty(JAVA_TEMP_DIR), DEFAULT_TEMP_SUB_DIR));
+ }
+ if (!success) {
+ success = loadTemporaryDirectory(new
File(System.getProperty(JAVA_USER_HOME), DEFAULT_TEMP_SUB_DIR));
+ }
+ if (!success && DEFAULT_TEMP_SUB_DIR.startsWith(".")) {
+ success = loadTemporaryDirectory(new
File(System.getProperty(JAVA_USER_HOME),
DEFAULT_TEMP_SUB_DIR.substring(1)));
+ }
+ if (!success) {
+ tempDirectory = null;
+ }
+ } catch (Exception e) {
+ DebugUtil.debugErr(TempFileUtil.class, e);
+ }
+ }
+
+ /**
+ *
+ * @param startWith
+ * @return
+ */
+ private static final boolean loadTemporaryDirectory(File startWith) {
+ if (tryLock(startWith)) {
+ return true;
+ }
+ for (int i = 1; i < maxTempDirAttempts; i++) {
+ if (tryLock(new File(startWith.getParent(),
startWith.getName() + "-" + i))) {
+ return true;
+ }
+ }
+ return false;
+ }

/**
* <p>Returns the root temporary directory.</p>
* <p>Note that the client should not attempt to create files from
this directory directly, but instead should use methods in this class.</p>
* @return
*/
- public static String getTemporaryDirectory() {
+ public synchronized static String getTemporaryDirectory() {
+ if (tempDirectory == null) {
+ loadTemporaryDirectory();
+ }
return tempDirectory.getAbsolutePath();
}

=======================================
--- /subprojects/GUI/src/org/tranche/gui/PreferencesFrame.java Mon Feb 15
16:57:45 2010
+++ /subprojects/GUI/src/org/tranche/gui/PreferencesFrame.java Wed Aug 18
11:19:06 2010
@@ -39,6 +39,7 @@
import org.tranche.LocalDataServer;
import org.tranche.gui.get.DownloadPool;
import org.tranche.gui.add.UploadPool;
+import org.tranche.util.TempFileUtil;

/**
* Panel meant for use with GenericPopupFrame.
@@ -250,6 +251,7 @@

private class GeneralPreferencesPanel extends JPanel {

+ private GenericTextField temporaryLocationField = new
GenericTextField();
private GenericCheckBox useHashComplete = new
GenericCheckBox("Open Hash Auto-Completion Window");

public GeneralPreferencesPanel() {
@@ -268,18 +270,73 @@
gbc.insets = new Insets(6, 0, 0, 0);
add(hashAutoCompleteLabel, gbc);

- DisplayTextArea hashAutoCompleteDescription = new
DisplayTextArea("We keep a list of Tranche projects in the background. As
you are " +
- "typing a Tranche hash, we can pop up a window with a
list of projects that match what you are typing. Typing as few as 3 " +
- "characters will give you a unique project.");
+ DisplayTextArea hashAutoCompleteDescription = new
DisplayTextArea("We keep a list of Tranche projects in the background. As
you are "
+ + "typing a Tranche hash, we can pop up a window with
a list of projects that match what you are typing. Typing as few as 3 "
+ + "characters will give you a unique project.");
gbc.insets = new Insets(1, 5, 0, 0);
add(hashAutoCompleteDescription, gbc);

// hash auto complete checkbox
useHashComplete.setBackground(getBackground());
useHashComplete.addActionListener(PreferencesFrame.this);
- gbc.insets = new Insets(3, 5, 0, 0);
+ gbc.insets = new Insets(3, 5, 10, 0);
add(useHashComplete, gbc);

+ // temporary location
+ GenericLabel temporaryLocationLabel = new
GenericLabel("Temporary File Directory");
+ temporaryLocationLabel.setFont(Styles.FONT_14PT_BOLD);
+ gbc.insets = new Insets(6, 0, 0, 0);
+ add(temporaryLocationLabel, gbc);
+
+ DisplayTextArea temporaryDescription = new
DisplayTextArea("Set a default location for temporary files.");
+ gbc.insets = new Insets(1, 5, 0, 0);
+ add(temporaryDescription, gbc);
+
+ temporaryLocationField.setFont(Styles.FONT_11PT);
+ temporaryLocationField.addKeyListener(PreferencesFrame.this);
+ gbc.gridwidth = GridBagConstraints.RELATIVE;
+ gbc.weightx = 2;
+ gbc.insets = new Insets(3, 5, 0, 0);
+ add(temporaryLocationField, gbc);
+
+ GenericButton temporaryLocationButton = new
GenericButton("Change");
+ temporaryLocationButton.setFont(Styles.FONT_10PT);
+
temporaryLocationButton.setBorder(BorderFactory.createCompoundBorder(Styles.BORDER_BLACK_1,
BorderFactory.createEmptyBorder(0, 4, 0, 4)));
+ temporaryLocationButton.addActionListener(new ActionListener()
{
+
+ public void actionPerformed(ActionEvent e) {
+ final JFileChooser fc = GUIUtil.makeNewFileChooser();
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fc.setApproveButtonText("Select");
+
+ try {
+ File previousDir = new
File(temporaryLocationField.getText());
+ if (previousDir != null && previousDir.exists()) {
+ fc.setCurrentDirectory(previousDir);
+ }
+ } catch (Exception ex) {
+ }
+
+ // do not hold up the dispatch thread
+ Thread t = new Thread() {
+
+ @Override
+ public void run() {
+ int returnVal =
fc.showOpenDialog(PreferencesFrame.this);
+ if (returnVal == FileChooser.APPROVE_OPTION) {
+
temporaryLocationField.setText(fc.getSelectedFile().getAbsolutePath());
+ checkForChanges();
+ }
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+ });
+ gbc.weightx = 0;
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ add(temporaryLocationButton, gbc);
+
// padding to the bottom
gbc.weighty = 2;
gbc.fill = GridBagConstraints.BOTH;
@@ -291,16 +348,28 @@
}

public void loadPreferences() {
-
useHashComplete.setSelected(PreferencesUtil.getBoolean(ConfigureTrancheGUI.PROP_AUTO_COMPLETE_HASH));
+
useHashComplete.setSelected(PreferencesUtil.getBoolean(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_AUTO_COMPLETE_HASH));
+ String tempDir =
PreferencesUtil.get(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY);
+ if (tempDir == null || tempDir.equals("")) {
+ tempDir = TempFileUtil.getTemporaryDirectory();
+ }
+ temporaryLocationField.setText(tempDir);
}

public void applyChanges() throws Exception {

PreferencesUtil.set(ConfigureTrancheGUI.PROP_AUTO_COMPLETE_HASH,
String.valueOf(useHashComplete.isSelected()), false);
+ File temporaryFileDir = new
File(temporaryLocationField.getText());
+ if (temporaryFileDir.exists()
&& !temporaryFileDir.isDirectory()) {
+ temporaryFileDir = temporaryFileDir.getParentFile();
+ }
+ TempFileUtil.setTemporaryDirectory(temporaryFileDir);
+
PreferencesUtil.set(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY,
temporaryFileDir.getAbsolutePath(), false);
}

public boolean isChanged() {
try {
- return useHashComplete.isSelected() !=
PreferencesUtil.getBoolean(ConfigureTrancheGUI.PROP_AUTO_COMPLETE_HASH);
+ return useHashComplete.isSelected() !=
PreferencesUtil.getBoolean(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_AUTO_COMPLETE_HASH)
+ ||
PreferencesUtil.get(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY) == null |
| !temporaryLocationField.getText().equals(PreferencesUtil.get(PreferencesUtil.PREF_TEMPORARY_FILE_DIRECTORY));
} catch (Exception e) {
return true;
}
@@ -326,9 +395,9 @@
downloadLocationLabel.setFont(Styles.FONT_14PT_BOLD);
add(downloadLocationLabel, gbc);

- DisplayTextArea downloadDescription = new DisplayTextArea("Set
a default download location for projects. " +
- "You will still be prompted upon starting a
download. " +
- "This will make it faster to select download locations
when using the download tool.");
+ DisplayTextArea downloadDescription = new DisplayTextArea("Set
a default download location for projects. "
+ + "You will still be prompted upon starting a
download. "
+ + "This will make it faster to select download
locations when using the download tool.");
gbc.insets = new Insets(1, 5, 0, 0);
add(downloadDescription, gbc);

@@ -383,9 +452,9 @@
gbc.weightx = 1;
add(poolSizeLabel, gbc);

- DisplayTextArea poolSizesDescription = new
DisplayTextArea("The pool size refers to number of concurrent downloads. " +
- "Larger pool size can make the most of network latency
but requires more memory and processor resources. " +
- "Setting to 0 makes the pool size unlimited.");
+ DisplayTextArea poolSizesDescription = new
DisplayTextArea("The pool size refers to number of concurrent downloads. "
+ + "Larger pool size can make the most of network
latency but requires more memory and processor resources. "
+ + "Setting to 0 makes the pool size unlimited.");
gbc.insets = new Insets(1, 5, 0, 0);
add(poolSizesDescription, gbc);

@@ -425,7 +494,7 @@

public void loadPreferences() {

downloadLocationField.setText(PreferencesUtil.get(PreferencesUtil.PREF_DOWNLOAD_FILE));
-
downloadPoolSizeField.setText(PreferencesUtil.get(ConfigureTrancheGUI.PROP_DOWNLOAD_POOL_SIZE));
+
downloadPoolSizeField.setText(PreferencesUtil.get(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_DOWNLOAD_POOL_SIZE));
}

public void applyChanges() throws Exception {
@@ -437,8 +506,8 @@

public boolean isChanged() {
try {
-
return !downloadLocationField.getText().equals(PreferencesUtil.get(PreferencesUtil.PREF_DOWNLOAD_FILE))
||
- !downloadPoolSizeField.getText().equals(PreferencesUtil.get(ConfigureTrancheGUI.PROP_DOWNLOAD_POOL_SIZE));
+
return !downloadLocationField.getText().equals(PreferencesUtil.get(PreferencesUtil.PREF_DOWNLOAD_FILE))
+ |
| !downloadPoolSizeField.getText().equals(PreferencesUtil.get(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_DOWNLOAD_POOL_SIZE));
} catch (Exception e) {
return true;
}
@@ -464,9 +533,9 @@
poolSizeLabel.setFont(Styles.FONT_14PT_BOLD);
gbc.insets = new Insets(0, 0, 0, 0);
add(poolSizeLabel, gbc);
- DisplayTextArea poolSizesDescription = new
DisplayTextArea("The pool size refers to number of concurrent uploads. " +
- "Larger pool size can make the most of network latency
but requires more memory and processor resources." +
- "Setting to 0 makes the pool size unlimited.");
+ DisplayTextArea poolSizesDescription = new
DisplayTextArea("The pool size refers to number of concurrent uploads. "
+ + "Larger pool size can make the most of network
latency but requires more memory and processor resources."
+ + "Setting to 0 makes the pool size unlimited.");
gbc.insets = new Insets(1, 5, 0, 0);
add(poolSizesDescription, gbc);

@@ -498,7 +567,7 @@
}

public void loadPreferences() {
-
uploadPoolSizeField.setText(PreferencesUtil.get(ConfigureTrancheGUI.PROP_UPLOAD_POOL_SIZE));
+
uploadPoolSizeField.setText(PreferencesUtil.get(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_UPLOAD_POOL_SIZE));
}

public void applyChanges() throws Exception {
@@ -509,7 +578,7 @@

public boolean isChanged() {
try {
-
return !uploadPoolSizeField.getText().equals(PreferencesUtil.get(ConfigureTrancheGUI.PROP_UPLOAD_POOL_SIZE));
+
return !uploadPoolSizeField.getText().equals(PreferencesUtil.get(ConfigureTrancheGUI.CATEGORY_GUI,
ConfigureTrancheGUI.PROP_UPLOAD_POOL_SIZE));
} catch (Exception e) {
return true;
}
@@ -668,9 +737,9 @@
}

public void loadPreferences() {
-
rootDirField.setText(PreferencesUtil.get(ConfigureTranche.PROP_SERVER_DIRECTORY));
-
ssl.setSelected(PreferencesUtil.getBoolean(ConfigureTranche.PROP_SERVER_SSL));
-
portField.setText(PreferencesUtil.get(ConfigureTranche.PROP_SERVER_PORT));
+
rootDirField.setText(PreferencesUtil.get(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_DIRECTORY));
+
ssl.setSelected(PreferencesUtil.getBoolean(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_SSL));
+
portField.setText(PreferencesUtil.get(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_PORT));
}

public void applyChanges() throws Exception {
@@ -681,9 +750,9 @@

public boolean isChanged() {
try {
-
return !rootDirField.getText().equals(String.valueOf(PreferencesUtil.get(ConfigureTranche.PROP_SERVER_DIRECTORY)))
||
- ssl.isSelected() !=
PreferencesUtil.getBoolean(ConfigureTranche.PROP_SERVER_SSL) ||
- !portField.getText().equals(PreferencesUtil.get(ConfigureTranche.PROP_SERVER_PORT));
+
return !rootDirField.getText().equals(String.valueOf(PreferencesUtil.get(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_DIRECTORY)))
+ || ssl.isSelected() !=
PreferencesUtil.getBoolean(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_SSL)
+ |
| !portField.getText().equals(PreferencesUtil.get(ConfigureTranche.CATEGORY_SERVER,
ConfigureTranche.PROP_SERVER_PORT));
} catch (Exception e) {
return true;
}
=======================================
--- /subprojects/GUI/src/org/tranche/gui/default.conf Tue Apr 27 10:26:55
2010
+++ /subprojects/GUI/src/org/tranche/gui/default.conf Wed Aug 18 11:19:06
2010
@@ -1,5 +1,4 @@
[GUI]
-
download.pool.size = 1
hash.auto_complete = true
module.list.hash =
=======================================
--- /test/org/tranche/util/TempFileUtilTest.java Fri Jun 18 11:09:32 2010
+++ /test/org/tranche/util/TempFileUtilTest.java Wed Aug 18 11:19:06 2010
@@ -18,12 +18,23 @@
import java.io.File;
import java.util.HashSet;
import java.util.Set;
+import org.tranche.commons.DebugUtil;

/**
*
* @author Bryan E. Smith - bryan...@gmail.com
*/
public class TempFileUtilTest extends TrancheTestCase {
+
+ @Override()
+ protected void setUp() throws Exception {
+ DebugUtil.setDebug(TempFileUtil.class, true);
+ }
+
+ @Override()
+ protected void tearDown() throws Exception {
+ DebugUtil.setDebug(TempFileUtil.class, false);
+ }

/**
* Tests capability of temp directory to create files with a specific
name.

Reply all
Reply to author
Forward
0 new messages