Changeset f4754d7


Ignore:
Timestamp:
Aug 21, 2004 4:03:22 AM (16 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f7f05cf
Parents:
7dc8d0c
git-author:
hypercubus <hypercubus> (08/21/04 04:03:22)
git-committer:
zzz <zzz@…> (08/21/04 04:03:22)
Message:
  • a missing systray.config file is now handled gracefully
  • fixed javadoc warnings
Location:
apps/systray/java
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/systray/java/build.xml

    r7dc8d0c rf4754d7  
    4040        <javadoc
    4141            sourcepath="./src"
    42             classpath="./src:./src/net/i2p/apps/systray/systray4j.jar"
     42            classpath="./src:./src/net/i2p/apps/systray/lib/systray4j.jar"
    4343            destdir="./build/javadoc"
    4444            packagenames="*"
  • apps/systray/java/src/net/i2p/apps/systray/ConfigFile.java

    r7dc8d0c rf4754d7  
    1818 *
    1919 * @author hypercubus
    20  *
    21  * TODO Make write operations keep original line comments intact.
    2220 */
    2321public class ConfigFile {
     22
     23    // TODO Make write operations keep original line comments intact.
    2424
    2525    private String     _configFile;
    2626    private Properties _properties = new Properties();
    2727
    28     public ConfigFile(String configFile) {
     28    /**
     29     * Initializes the {@link ConfigFile} object.
     30     *
     31     * @param  configFile The config file to use.
     32     * @return            <code>false</code> if the given config file cannot be
     33     *                    located or accessed, otherwise <code>true</code>.
     34     */
     35    public boolean init(String configFile) {
    2936        _configFile = configFile;
    30         readConfigFile();
     37        return readConfigFile();
    3138    }
    3239
     
    4451    }
    4552
    46     private void readConfigFile() {
     53    private boolean readConfigFile() {
    4754
    4855        FileInputStream fileInputStream = null;
     
    5259            _properties.load(fileInputStream);
    5360        } catch (IOException e) {
    54             System.exit(1);
     61            return false;
    5562        }
    5663        try {
     
    5966            // No worries.
    6067        }
     68        return true;
    6169    }
    6270
    6371    private void writeConfigFile() {
     72
    6473        FileOutputStream fileOutputStream = null;
    6574
  • apps/systray/java/src/net/i2p/apps/systray/ShellCommand.java

    r7dc8d0c rf4754d7  
    6262                caller.notify();  // In case the caller is still in the wait() state.
    6363            }
    64             return;
    6564        }
    6665    }
     
    185184     * <code>STDIN</code> of the shell process via {@link #getInputStream()}.
    186185     *
    187      * @param  _shellCommand The command for the shell to execute.
     186     * @param shellCommand The command for the shell to execute.
    188187     */
    189188    public void execute(String shellCommand) {
     
    200199     * {@link #getInputStream()}.
    201200     *
    202      * @param  _shellCommand The command for the shell to execute.
     201     * @param  shellCommand The command for the shell to execute.
    203202     * @return              <code>true</code> if the spawned shell process
    204203     *                      returns an exit status of 0 (indicating success),
     
    222221     * <code>STDIN</code> of the shell process via {@link #getInputStream()}.
    223222     *
    224      * @param  _shellCommand The command for the shell to execute.
     223     * @param  shellCommand The command for the shell to execute.
    225224     * @param  seconds      The method will return <code>true</code> if this
    226225     *                      number of seconds elapses without the process
     
    257256     * command will not be displayed.
    258257     *
    259      * @param  _shellCommand The command for the shell to execute.
     258     * @param  shellCommand The command for the shell to execute.
    260259     * @throws IOException
    261260     */
     
    269268     * produced by the executed command will not be displayed.
    270269     *
    271      * @param  _shellCommand The command for the shell to execute.
     270     * @param  shellCommand The command for the shell to execute.
    272271     * @return              <code>true</code> if the spawned shell process
    273272     *                      returns an exit status of 0 (indicating success),
     
    288287     * executed command will not be displayed.
    289288     *
    290      * @param  _shellCommand The command for the shell to execute.
     289     * @param  shellCommand The command for the shell to execute.
    291290     * @param  seconds      The method will return <code>true</code> if this
    292291     *                      number of seconds elapses without the process
     
    357356                processStdoutReader.start();
    358357            }
    359 
    360358            if (waitForExitStatus) {
    361359                try {
     
    375373                    return false;
    376374            }
    377 
    378375        } catch (Exception e) {
    379376            return false;
  • apps/systray/java/src/net/i2p/apps/systray/SysTray.java

    r7dc8d0c rf4754d7  
    2626    private BrowserChooser  _browserChooser;
    2727    private String          _browserString;
    28     private ConfigFile      _configFile        = new ConfigFile("../systray.config");
     28    private ConfigFile      _configFile        = new ConfigFile();
    2929    private Frame           _frame;
    3030    private SysTrayMenuItem _itemExit          = new SysTrayMenuItem("Exit I2P systray", "exit");
     
    3535
    3636    public SysTray() {
     37
     38        if (!_configFile.init("../systray.config"))
     39            _configFile.setProperty("browser", "default");
     40
    3741        _browserString = _configFile.getProperty("browser", "default");
     42
    3843        _sysTrayMenuIcon.addSysTrayMenuListener(this);
    3944        createSysTrayMenu();
Note: See TracChangeset for help on using the changeset viewer.