Changeset 273e940


Ignore:
Timestamp:
Sep 28, 2011 5:05:38 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
efaafea
Parents:
7bac7aa
Message:

findbugs

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java

    r7bac7aa r273e940  
    293293                if (_log.shouldLog(Log.INFO) && (_in != null))
    294294                    _log.info("After decompression, written=" + written +
    295                               (_in != null ?
    296295                                " read=" + _in.getTotalRead()
    297296                                + ", expanded=" + _in.getTotalExpanded() + ", remaining=" + _in.getRemaining()
    298                                 + ", finished=" + _in.getFinished()
    299                                : ""));
     297                                + ", finished=" + _in.getFinished());
    300298                if (ba != null)
    301299                    _cache.release(ba);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java

    r7bac7aa r273e940  
    213213                }
    214214            }
    215             if (sockMgr == null) {
    216                 l.log("Invalid I2CP configuration");
    217                 throw new IllegalArgumentException("Socket manager could not be created");
    218             }
     215            // can't be null unless we limit the loop above
     216            //if (sockMgr == null) {
     217            //    l.log("Invalid I2CP configuration");
     218            //    throw new IllegalArgumentException("Socket manager could not be created");
     219            //}
    219220            l.log("Tunnels ready for client: " + handlerName);
    220221
     
    557558                localPort = ss.getLocalPort();
    558559            }
    559             notifyEvent("clientLocalPort", new Integer(ss.getLocalPort()));
     560            notifyEvent("clientLocalPort", Integer.valueOf(ss.getLocalPort()));
    560561            // duplicates message in constructor
    561562            //l.log("Listening for clients on port " + localPort + " of " + getTunnel().listenHost);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java

    r7bac7aa r273e940  
    413413        StringBuilder buf = new StringBuilder(command.length() + headers.size() * 64);
    414414        buf.append(command.toString().trim()).append("\r\n");
    415         for (Iterator<String> iter = headers.keySet().iterator(); iter.hasNext(); ) {
    416             String name = (String)iter.next();
    417             for(String val: headers.get(name)) {
     415        for (Map.Entry<String, List<String>> e : headers.entrySet()) {
     416            String name = e.getKey();
     417            for(String val: e.getValue()) {
    418418                buf.append(name.trim()).append(": ").append(val.trim()).append("\r\n");
    419419            }
  • apps/streaming/java/src/net/i2p/client/streaming/Connection.java

    r7bac7aa r273e940  
    312312            int remaining;
    313313            synchronized (_outboundPackets) {
    314                 _outboundPackets.put(new Long(packet.getSequenceNum()), packet);
     314                _outboundPackets.put(Long.valueOf(packet.getSequenceNum()), packet);
    315315                windowSize = _options.getWindowSize();
    316316                remaining = windowSize - _outboundPackets.size() ;
     
    442442                for (int i = 0; i < acked.size(); i++) {
    443443                    PacketLocal p = acked.get(i);
    444                     _outboundPackets.remove(new Long(p.getSequenceNum()));
     444                    _outboundPackets.remove(Long.valueOf(p.getSequenceNum()));
    445445                    _ackedPackets++;
    446446                    if (p.getNumSends() > 1) {
     
    11301130                if (_packet.getSequenceNum() == _highestAckedThrough + 1)
    11311131                    isLowest = true;
    1132                 if (_outboundPackets.containsKey(new Long(_packet.getSequenceNum())))
     1132                if (_outboundPackets.containsKey(Long.valueOf(_packet.getSequenceNum())))
    11331133                    resend = true;
    11341134            }
  • apps/streaming/java/src/net/i2p/client/streaming/MessageInputStream.java

    r7bac7aa r273e940  
    230230                long cur = _highestReadyBlockId + 1;
    231231                // now pull in any previously pending blocks
    232                 while (_notYetReadyBlocks.containsKey(new Long(cur))) {
    233                     ByteArray ba = _notYetReadyBlocks.remove(new Long(cur));
     232                while (_notYetReadyBlocks.containsKey(Long.valueOf(cur))) {
     233                    ByteArray ba = _notYetReadyBlocks.remove(Long.valueOf(cur));
    234234                    if ( (ba != null) && (ba.getData() != null) && (ba.getValid() > 0) ) {
    235235                        _readyDataBlocks.add(ba);
     
    246246                    _log.debug("message is out of order: " + messageId);
    247247                if (_locallyClosed) // dont need the payload, just the msgId in order
    248                     _notYetReadyBlocks.put(new Long(messageId), new ByteArray(null));
     248                    _notYetReadyBlocks.put(Long.valueOf(messageId), new ByteArray(null));
    249249                else
    250                     _notYetReadyBlocks.put(new Long(messageId), payload);
     250                    _notYetReadyBlocks.put(Long.valueOf(messageId), payload);
    251251                _dataLock.notifyAll();
    252252            }
  • core/java/src/net/i2p/client/I2PSessionImpl.java

    r7bac7aa r273e940  
    356356                // _socket.setSoTimeout(1000000); // Uhmmm we could really-really use a real timeout, and handle it.
    357357                _out = _socket.getOutputStream();
    358                 synchronized (_out) {
    359                     _out.write(I2PClient.PROTOCOL_BYTE);
    360                     _out.flush();
    361                 }
     358                _out.write(I2PClient.PROTOCOL_BYTE);
     359                _out.flush();
    362360                _writer = new ClientWriterRunner(_out, this);
    363361                InputStream in = _socket.getInputStream();
  • core/java/src/net/i2p/client/I2PSimpleSession.java

    r7bac7aa r273e940  
    7979                    _socket = new Socket(_hostname, _portNum);
    8080                _out = _socket.getOutputStream();
    81                 synchronized (_out) {
    82                     _out.write(I2PClient.PROTOCOL_BYTE);
    83                     _out.flush();
    84                 }
     81                _out.write(I2PClient.PROTOCOL_BYTE);
     82                _out.flush();
    8583                _writer = new ClientWriterRunner(_out, this);
    8684                InputStream in = _socket.getInputStream();
  • core/java/src/net/i2p/client/naming/BlockfileNamingService.java

    r7bac7aa r273e940  
    433433     *  @throws RuntimeException
    434434     */
     435/****
    435436    private void addEntry(SkipList sl, String key, Destination dest, String source) {
    436437        Properties props = new Properties();
     
    440441        addEntry(sl, key, dest, props);
    441442    }
     443****/
    442444
    443445    /**
     
    477479     *  @since 0.8.9
    478480     */
     481/****
    479482    private String getReverseEntry(Destination dest) {
    480483        return getReverseEntry(dest.calculateHash());
    481484    }
     485****/
    482486
    483487    /**
  • core/java/src/net/i2p/client/naming/SingleFileNamingService.java

    r7bac7aa r273e940  
    127127            return null;
    128128        } finally {
     129            if (in != null) try { in.close(); } catch (IOException ioe) {}
    129130            releaseReadLock();
    130131        }
  • core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java

    r7bac7aa r273e940  
    520520
    521521    /** A basic symmetric encryption/decryption test. */
     522/****
    522523    public static boolean self_test() {
    523524        return self_test(_BLOCK_SIZE);
    524525    }
     526****/
    525527
    526528    // Rijndael own methods
     
    746748
    747749    /** A basic symmetric encryption/decryption test for a given key size. */
     750/****
    748751    private static boolean self_test(int keysize) {
    749752        if (_RDEBUG) trace(_IN, "self_test(" + keysize + ")");
     
    796799        return ok;
    797800    }
     801****/
    798802
    799803    /**
     
    895899    //...........................................................................
    896900
     901/****
    897902    public static void main(String[] args) {
    898903        self_test(16);
     
    900905        self_test(32);
    901906    }
     907****/
    902908}
  • core/java/src/net/i2p/crypto/ElGamalAESEngine.java

    r7bac7aa r273e940  
    299299     * @return decrypted data or null on failure
    300300     */
     301/****
    301302    private byte[] decryptAESBlock(byte encrypted[], SessionKey key, byte iv[],
    302303                           byte sentTag[], Set foundTags, SessionKey foundKey) throws DataFormatException {
    303304        return decryptAESBlock(encrypted, 0, encrypted.length, key, iv, sentTag, foundTags, foundKey);
    304305    }
     306****/
    305307
    306308    /*
  • core/java/src/net/i2p/crypto/HMAC256Generator.java

    r7bac7aa r273e940  
    3535    }
    3636   
    37     private class Sha256ForMAC extends Sha256Standalone implements Digest {
     37    private static class Sha256ForMAC extends Sha256Standalone implements Digest {
    3838        public String getAlgorithmName() { return "sha256 for hmac"; }
    3939        public int getDigestSize() { return 32; }
  • core/java/src/net/i2p/crypto/TransientSessionKeyManager.java

    r7bac7aa r273e940  
    597597        int total = 0;
    598598        long now = _context.clock().now();
    599         for (Iterator<SessionKey> iter = inboundSets.keySet().iterator(); iter.hasNext();) {
    600             SessionKey skey = iter.next();
     599        for (Map.Entry<SessionKey, Set<TagSet>> e : inboundSets.entrySet()) {
     600            SessionKey skey = e.getKey();
    601601            Set<TagSet> sets = new TreeSet(new TagSetComparator());
    602             sets.addAll(inboundSets.get(skey));
     602            sets.addAll(e.getValue());
    603603            buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>" +
    604604                       "<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>" +
     
    654654     *  Earliest first
    655655     */
    656     private static class TagSetComparator implements Comparator {
    657          public int compare(Object l, Object r) {
    658              return (int) (((TagSet)l).getDate() - ((TagSet)r).getDate());
     656    private static class TagSetComparator implements Comparator<TagSet> {
     657         public int compare(TagSet l, TagSet r) {
     658             return (int) (l.getDate() - r.getDate());
    659659        }
    660660    }
  • core/java/src/net/i2p/time/NtpMessage.java

    r7bac7aa r273e940  
    3434import java.util.Date;
    3535
     36import net.i2p.util.RandomSource;
    3637
    3738/**
     
    400401        // bitstring, both to avoid systematic roundoff errors and as
    401402        // a means of loop detection and replay detection.
    402         array[7+pointer] = (byte) (Math.random()*255.0);
     403        array[7+pointer] = (byte) (RandomSource.getInstance().nextInt());
    403404    }
    404405   
  • core/java/src/net/i2p/time/Timestamper.java

    r7bac7aa r273e940  
    322322    }
    323323   
     324/****
    324325    public static void main(String args[]) {
    325326        System.setProperty(PROP_DISABLED, "false");
    326327        System.setProperty(PROP_QUERY_FREQUENCY, "30000");
    327         I2PAppContext ctx = I2PAppContext.getGlobalContext();
     328        I2PAppContext.getGlobalContext();
    328329        for (int i = 0; i < 5*60*1000; i += 61*1000) {
    329330            try { Thread.sleep(61*1000); } catch (InterruptedException ie) {}
    330331        }
    331332    }
     333****/
    332334   
    333335    /**
  • core/java/src/net/metanotion/io/block/BlockFile.java

    r7bac7aa r273e940  
    444444                if(metaIndex.get(name) != null) { throw new IOException("Index already exists"); }
    445445                int page = allocPage();
    446                 metaIndex.put(name, new Integer(page));
     446                metaIndex.put(name, Integer.valueOf(page));
    447447                BSkipList.init(this, page, spanSize);
    448448                BSkipList bsl = new BSkipList(spanSize, this, page, key, val, true);
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r7bac7aa r273e940  
    104104   
    105105    /** don't probe or broadcast data, just respond and search when explicitly needed */
    106     private final boolean QUIET = false;
     106    private static final boolean QUIET = false;
    107107   
    108108    public static final String PROP_ENFORCE_NETID = "router.networkDatabase.enforceNetId";
Note: See TracChangeset for help on using the changeset viewer.