Changeset a7a7e96


Ignore:
Timestamp:
Nov 20, 2013 9:15:12 AM (6 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
413ad6b0
Parents:
796dbc5d
Message:

Findbugs in imported core code

Location:
core/java/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/com/nettgryppa/security/HashCash.java

    r796dbc5d ra7a7e96  
    213213       * Two objects are considered equal if they are both of type HashCash and have an identical string representation
    214214       */
    215   /* FIXME missing hashCode() method FIXME */
    216215  @Override
    217216  public boolean equals(Object obj) {
     
    220219    else
    221220      return super.equals(obj);
     221  }
     222
     223  /**
     224   * Implemented based on definition of equals()
     225   */
     226  @Override
     227  public int hashCode() {
     228      return ("HashCash:"+toString()).hashCode();
    222229  }
    223230 
     
    331338    boolean first = true;
    332339   
    333     for(String key: extensions.keySet()) {
     340    for(Map.Entry<String, List<String>> entry: extensions.entrySet()) {
     341        String key = entry.getKey();
    334342      if(key.contains(":") || key.contains(";") || key.contains("="))
    335343          throw new IllegalArgumentException("Extension key contains an illegal character. " + key);
     
    338346      first = false;
    339347      result.append(key);
    340       tempList = extensions.get(key);
     348      tempList = entry.getValue();
    341349     
    342350      if(null != tempList) {
     
    443451    initEstimates();
    444452    int result = 0;
    445     long millis = secs * 1000 * 65536;
     453    long millis = secs * 1000L * 65536;
    446454    millis /= milliFor16;
    447455   
  • core/java/src/gnu/crypto/hash/Sha256Standalone.java

    r796dbc5d ra7a7e96  
    9696
    9797   /** caches the result of the correctness test, once executed. */
    98    private static Boolean valid;
     98   private static volatile Boolean valid;
    9999
    100100   /** 256-bit interim result. */
     
    219219         md.update((byte) 0x63); // c
    220220         String result = "broken"; //Util.toString(md.digest());
    221          valid = new Boolean(DIGEST0.equals(result));
     221         valid = Boolean.valueOf(DIGEST0.equals(result));
    222222      }
    223223
Note: See TracChangeset for help on using the changeset viewer.