Changeset b8eeb72 for core/java


Ignore:
Timestamp:
Dec 2, 2017 5:42:59 PM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
0f75748
Parents:
60efd0b
Message:

Fix net.i2p.data.*Key tests, remove dead code

Broken in 463f5347b682f23a159bdeb06ffc8f55c5c2cff7 by an underlying API change.
The dead code threw the previously-expected exception.

Location:
core/java
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/SimpleDataStructure.java

    r60efd0b rb8eeb72  
    8181        int length = length();
    8282        _data = new byte[length];
    83         int read = read(in, _data);
    84         if (read != length)
    85             throw new DataFormatException("EOF reading " + getClass().getSimpleName() +
    86                                           ", read: " + read + ", required: " + length);
     83        // Throws on incomplete read
     84        read(in, _data);
    8785    }
    8886   
  • core/java/test/junit/net/i2p/data/PrivateKeyTest.java

    r60efd0b rb8eeb72  
    1313import java.io.ByteArrayInputStream;
    1414import java.io.ByteArrayOutputStream;
     15import java.io.EOFException;
    1516
    1617import org.junit.Rule;
     
    8889        ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
    8990
    90         exception.expect(DataFormatException.class);
    91         exception.expectMessage("EOF reading PrivateKey, read: 31, required: " + PrivateKey.KEYSIZE_BYTES);
     91        exception.expect(EOFException.class);
     92        exception.expectMessage("EOF after reading 31 bytes of " + PrivateKey.KEYSIZE_BYTES + " byte value");
    9293        privateKey.readBytes(in);
    9394    }
  • core/java/test/junit/net/i2p/data/PublicKeyTest.java

    r60efd0b rb8eeb72  
    1313import java.io.ByteArrayInputStream;
    1414import java.io.ByteArrayOutputStream;
     15import java.io.EOFException;
    1516
    1617import org.junit.Rule;
     
    8990        ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
    9091
    91         exception.expect(DataFormatException.class);
    92         exception.expectMessage("EOF reading PublicKey, read: 31, required: " + PublicKey.KEYSIZE_BYTES);
     92        exception.expect(EOFException.class);
     93        exception.expectMessage("EOF after reading 31 bytes of " + PublicKey.KEYSIZE_BYTES + " byte value");
    9394        publicKey.readBytes(in);
    9495    }
  • core/java/test/junit/net/i2p/data/SigningPrivateKeyTest.java

    r60efd0b rb8eeb72  
    1313import java.io.ByteArrayInputStream;
    1414import java.io.ByteArrayOutputStream;
     15import java.io.EOFException;
    1516
    1617import org.junit.Rule;
     
    8990        ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("short"));
    9091
    91         exception.expect(DataFormatException.class);
    92         exception.expectMessage("EOF reading SigningPrivateKey, read: 5, required: " + SigningPrivateKey.KEYSIZE_BYTES);
     92        exception.expect(EOFException.class);
     93        exception.expectMessage("EOF after reading 5 bytes of " + SigningPrivateKey.KEYSIZE_BYTES + " byte value");
    9394        signingPrivateKey.readBytes(in);
    9495    }
  • core/java/test/junit/net/i2p/data/SigningPublicKeyTest.java

    r60efd0b rb8eeb72  
    1313import java.io.ByteArrayInputStream;
    1414import java.io.ByteArrayOutputStream;
     15import java.io.EOFException;
    1516
    1617import org.junit.Rule;
     
    8990        ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
    9091
    91         exception.expect(DataFormatException.class);
    92         exception.expectMessage("EOF reading SigningPublicKey, read: 31, required: " + SigningPublicKey.KEYSIZE_BYTES);
     92        exception.expect(EOFException.class);
     93        exception.expectMessage("EOF after reading 31 bytes of " + SigningPublicKey.KEYSIZE_BYTES + " byte value");
    9394        publicKey.readBytes(in);
    9495    }
Note: See TracChangeset for help on using the changeset viewer.