Changeset 1249


Ignore:
Timestamp:
Oct 22, 2010, 8:13:17 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

Getting rid of UnsupportedEncodingException:s that can never happen.

Location:
extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc/protocol/processor/Client.java

    r1248 r1249  
    3434    private byte[] protocol;
    3535
    36     public Client(byte[] peerId) throws UnsupportedEncodingException {
     36    public Client(byte[] peerId) {
    3737        fastTimer = new Timer(true);
    3838        torrents = new Vector<Torrent>();
     
    4141    }
    4242   
    43     public Client() throws UnsupportedEncodingException {
     43    public Client() {
    4444        this(TorrentUtil.generateId());
    4545    }
  • extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc/util/TorrentUtil.java

    r1248 r1249  
    8585    }
    8686
    87     public static byte[] generateId() throws UnsupportedEncodingException {
     87    public static byte[] generateId() {
    8888        byte[] pid = new byte[20];
    8989        ByteBuffer bb = ByteBuffer.wrap(pid);
    90         bb.put("CristianMocanu".getBytes("US-ASCII"));
     90        try {
     91          bb.put("CristianMocanu".getBytes("US-ASCII"));
     92        }
     93        catch (UnsupportedEncodingException ex)
     94        {} // Should never happen
    9195        Random r = new Random();
    9296        for (int i = 14; i < 20; i++) {
     
    96100    }
    97101
    98     public static byte[] getSupportedProtocol() throws
    99             UnsupportedEncodingException {
     102    public static byte[] getSupportedProtocol() {
    100103        byte[] protocol = new byte[20];
    101104        ByteBuffer pr = ByteBuffer.wrap(protocol);
    102105        pr.put((byte) 19);
    103         pr.put("BitTorrent protocol".getBytes("US-ASCII"));
     106        try {
     107          pr.put("BitTorrent protocol".getBytes("US-ASCII"));
     108        }
     109        catch (UnsupportedEncodingException ex)
     110        {} // Should never happen
    104111        return protocol;
    105112    }
  • extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc/util/TrackerUtil.java

    r1248 r1249  
    1919
    2020    public static Set<Peer> doCompactPeer(final byte[] prs)
    21             throws UnsupportedEncodingException, UnknownHostException {
     21            throws UnknownHostException {
    2222        final Set<Peer> peers = new HashSet<Peer>();
    2323        int k = 0;
Note: See TracChangeset for help on using the changeset viewer.