Changeset 1f9bb04 for apps/addressbook


Ignore:
Timestamp:
Jul 12, 2015 4:06:49 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d087fd6
Parents:
914cc12
Message:

Findbugs all over #2
Mostly char encoding
Use StringWriter? rather than OSW→BAOS→String

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

Legend:

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

    r914cc12 r1f9bb04  
    160160     */
    161161    public Iterator<Map.Entry<String, String>> iterator() {
    162         if (this.subFile != null)
    163             return new ConfigIterator(this.subFile);
     162        if (this.subFile != null) {
     163            try {
     164                return new ConfigIterator(this.subFile);
     165            } catch (IOException ioe) {
     166                return new ConfigIterator();
     167            }
     168       }
    164169        return this.addresses.entrySet().iterator();
    165170    }
  • apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java

    r914cc12 r1f9bb04  
    5555     *  An iterator over the key/value pairs in the file.
    5656     */
    57     public ConfigIterator(File file) {
    58         try {
     57    public ConfigIterator(File file) throws IOException {
    5958            FileInputStream fileStream = new FileInputStream(file);
    60             input = new BufferedReader(new InputStreamReader(fileStream));
    61         } catch (IOException ioe) {}
     59            input = new BufferedReader(new InputStreamReader(fileStream, "UTF-8"));
    6260    }
    6361
  • apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java

    r914cc12 r1f9bb04  
    117117        FileInputStream fileStream = new FileInputStream(file);
    118118        BufferedReader input = new BufferedReader(new InputStreamReader(
    119                 fileStream));
     119                fileStream, "UTF-8"));
    120120        Map<String, String>  rv = parse(input);
    121121        try {
     
    206206        FileInputStream fileStream = new FileInputStream(file);
    207207        BufferedReader input = new BufferedReader(new InputStreamReader(
    208                 fileStream));
     208                fileStream, "UTF-8"));
    209209        List<String> rv = parseSubscriptions(input);
    210210        try {
  • apps/addressbook/java/src/net/i2p/addressbook/Log.java

    r914cc12 r1f9bb04  
    2424import java.io.BufferedWriter;
    2525import java.io.File;
    26 import java.io.FileWriter;
     26import java.io.FileOutputStream;
    2727import java.io.IOException;
     28import java.io.OutputStreamWriter;
    2829import java.util.Date;
    2930
     
    5758        BufferedWriter bw = null;
    5859        try {
    59             bw = new BufferedWriter(new FileWriter(this.file,
    60                     true));
     60            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.file,
     61                    true), "UTF-8"));
    6162            String timestamp = new Date().toString();
    6263            bw.write(timestamp + " -- " + entry);
Note: See TracChangeset for help on using the changeset viewer.