Changeset bdde11c


Ignore:
Timestamp:
Nov 8, 2015 6:14:42 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
a3e16614
Parents:
63ddf11
Message:

Fix NPE from URL→URI conversion
new URL(null) throws MUE
new URI(null) throws NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java

    r63ddf11 rbdde11c  
    876876
    877877  /**
    878    *  @param ann an announce URL
     878   *  @param ann an announce URL, may be null, returns false if null
    879879   *  @return true for i2p hosts only
    880880   *  @since 0.7.12
    881881   */
    882882  public static boolean isValidAnnounce(String ann) {
     883    if (ann == null)
     884        return false;
    883885    URI url;
    884886    try {
    885        url = new URI(ann);
     887        url = new URI(ann);
    886888    } catch (URISyntaxException use) {
    887        return false;
     889        return false;
    888890    }
    889891    return "http".equals(url.getScheme()) && url.getHost() != null &&
Note: See TracChangeset for help on using the changeset viewer.