Changeset ca3f996


Ignore:
Timestamp:
Apr 16, 2016 9:01:05 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3428995
Parents:
ebbf7f2
Message:

Addressbook: More cleanups

Location:
apps/addressbook/java/src/net/i2p/addressbook
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java

    rebbf7f2 rca3f996  
    7272            while ((inputLine = input.readLine()) != null) {
    7373                inputLine = ConfigParser.stripComments(inputLine);
    74                 String[] splitLine = DataHelper.split(inputLine, "=");
     74                if (inputLine.length() == 0)
     75                    continue;
     76                String[] splitLine = DataHelper.split(inputLine, "=", 2);
    7577                if (splitLine.length == 2) {
    7678                    next = new ConfigEntry(splitLine[0].trim().toLowerCase(Locale.US), splitLine[1].trim());
  • apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java

    rebbf7f2 rca3f996  
    9494            while ((inputLine = input.readLine()) != null) {
    9595                inputLine = stripComments(inputLine);
    96                 String[] splitLine = DataHelper.split(inputLine, "=");
     96                if (inputLine.length() == 0)
     97                    continue;
     98                String[] splitLine = DataHelper.split(inputLine, "=", 2);
    9799                if (splitLine.length == 2) {
    98100                    result.put(splitLine[0].trim().toLowerCase(Locale.US), splitLine[1].trim());
  • apps/addressbook/java/src/net/i2p/addressbook/Log.java

    rebbf7f2 rca3f996  
    7575     * @return The File that the log is writing to.
    7676     */
     77/****
    7778    public File getFile() {
    7879        return this.file;
    7980    }
     81****/
    8082}
  • apps/addressbook/java/src/net/i2p/addressbook/SubscriptionList.java

    rebbf7f2 rca3f996  
    2525import java.io.IOException;
    2626import java.util.ArrayList;
     27import java.util.Collections;
    2728import java.util.HashMap;
    2829import java.util.List;
     
    8182            etags = ConfigParser.parse(etagsFile);
    8283        } catch (IOException exp) {
    83             etags = new HashMap<String, String>();
     84            etags = Collections.<String, String>emptyMap();
    8485        }
    8586        try {
    8687            lastModified = ConfigParser.parse(lastModifiedFile);
    8788        } catch (IOException exp) {
    88             lastModified = new HashMap<String, String>();
     89            lastModified = Collections.<String, String>emptyMap();
    8990        }
    9091        try {
    9192            lastFetched = ConfigParser.parse(lastFetchedFile);
    9293        } catch (IOException exp) {
    93             lastFetched = new HashMap<String, String>();
     94            lastFetched = Collections.<String, String>emptyMap();
    9495        }
    9596        for (String location : locations) {
     
    118119     */
    119120    public void write() {
    120         Map<String, String> etags = new HashMap<String, String>();
    121         Map<String, String>  lastModified = new HashMap<String, String>();
    122         Map<String, String>  lastFetched = new HashMap<String, String>();
     121        int sz = subscriptions.size();
     122        Map<String, String> etags = new HashMap<String, String>(sz);
     123        Map<String, String> lastModified = new HashMap<String, String>(sz);
     124        Map<String, String> lastFetched = new HashMap<String, String>(sz);
    123125        for (Subscription sub : this.subscriptions) {
    124126            if (sub.getEtag() != null) {
     
    128130                lastModified.put(sub.getLocation(), sub.getLastModified());
    129131            }
    130             lastFetched.put(sub.getLocation(), "" + sub.getLastFetched());
     132            lastFetched.put(sub.getLocation(), Long.toString(sub.getLastFetched()));
    131133        }
    132134        try {
    133135            ConfigParser.write(etags, this.etagsFile);
     136        } catch (IOException exp) {}
     137        try {
    134138            ConfigParser.write(lastModified, this.lastModifiedFile);
     139        } catch (IOException exp) {}
     140        try {
    135141            ConfigParser.write(lastFetched, this.lastFetchedFile);
    136         } catch (IOException exp) {
    137         }
     142        } catch (IOException exp) {}
    138143    }
    139144}
Note: See TracChangeset for help on using the changeset viewer.