Skip to content

Commit

Permalink
Release v1.3.3
Browse files Browse the repository at this point in the history
Remove spurious throws from byte[] and String decodes
  • Loading branch information
ianopolous committed Jan 31, 2023
1 parent 7de0af4 commit 8ed5ec0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<attribute name="Class-Path" value="${manifest_cp}"/>
<attribute name="Implementation-Vendor" value="io.ipfs"/>
<attribute name="Implementation-Title" value="multihash"/>
<attribute name="Implementation-Version" value="1.3.2"/>
<attribute name="Implementation-Version" value="1.3.3"/>
</manifest>
</jar>
</target>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.multiformats</groupId>
<artifactId>java-multihash</artifactId>
<version>v1.3.2</version>
<version>v1.3.3</version>
<packaging>jar</packaging>

<name>multihash</name>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/ipfs/multihash/Multihash.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,12 @@ public static Multihash deserialize(InputStream din) throws IOException {
return new Multihash(t, hash);
}

public static Multihash deserialize(byte[] raw) throws IOException {
return deserialize(new ByteArrayInputStream(raw));
public static Multihash deserialize(byte[] raw) {
try {
return deserialize(new ByteArrayInputStream(raw));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

/**
Expand All @@ -224,7 +228,7 @@ public static Multihash deserialize(byte[] raw) throws IOException {
* @return
* @throws IOException
*/
public static Multihash decode(String encoded) throws IOException {
public static Multihash decode(String encoded) {
if (encoded.length() == 46 && encoded.startsWith("Qm"))
return deserialize(Base58.decode(encoded));
return deserialize(Multibase.decode(encoded));
Expand Down Expand Up @@ -269,11 +273,7 @@ public static Multihash fromHex(String hex) {
}

public static Multihash fromBase58(String base58) {
try {
return Multihash.deserialize(Base58.decode(base58));
} catch (IOException e) {
throw new RuntimeException(e);
}
return Multihash.deserialize(Base58.decode(base58));
}

public static long readVarint(InputStream in) throws IOException {
Expand Down

0 comments on commit 8ed5ec0

Please sign in to comment.