Skip to content

Commit

Permalink
Remove obsolete dependency to commons-codec.
Browse files Browse the repository at this point in the history
We have copied the Hex class from commons-codec into the leshan-core
code base several weeks ago. Thus, we do not need the dependency on the
commons-codec component anymore.
  • Loading branch information
Kai Hudalla committed Dec 9, 2015
1 parent 77dd845 commit fa4daee
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
4 changes: 0 additions & 4 deletions leshan-bs-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ Contributors:
<groupId>org.eclipse.leshan</groupId>
<artifactId>leshan-server-cf</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions leshan-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ Contributors:
<groupId>org.eclipse.californium</groupId>
<artifactId>californium-core</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
import java.security.spec.InvalidParameterSpecException;
import java.security.spec.KeySpec;

import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.eclipse.leshan.server.security.SecurityInfo;
import org.eclipse.leshan.util.Hex;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
Expand Down Expand Up @@ -74,8 +73,8 @@ public SecurityInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializat
byte[] key;
try {
key = Hex.decodeHex(psk.get("key").getAsString().toCharArray());
} catch (DecoderException e) {
throw new JsonParseException(e);
} catch (IllegalArgumentException e) {
throw new JsonParseException("key parameter must be a valid hex string", e);
}

info = SecurityInfo.newPreSharedKeyInfo(endpoint, identity, key);
Expand All @@ -94,7 +93,7 @@ public SecurityInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializat
parameterSpec);

key = KeyFactory.getInstance("EC").generatePublic(keySpec);
} catch (DecoderException | InvalidKeySpecException | NoSuchAlgorithmException
} catch (IllegalArgumentException | InvalidKeySpecException | NoSuchAlgorithmException
| InvalidParameterSpecException e) {
throw new JsonParseException("Invalid security info content", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.security.interfaces.ECPublicKey;
import java.util.Arrays;

import org.apache.commons.codec.binary.Hex;
import org.eclipse.leshan.server.security.SecurityInfo;
import org.eclipse.leshan.util.Hex;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.Charsets;
import org.apache.commons.lang.StringUtils;
import org.eclipse.californium.core.coap.CoAP.Type;
Expand All @@ -31,6 +30,7 @@
import org.eclipse.californium.core.coap.OptionSet;
import org.eclipse.californium.core.coap.Request;
import org.eclipse.californium.core.coap.Response;
import org.eclipse.leshan.util.Hex;

public class CoapMessage {

Expand Down

0 comments on commit fa4daee

Please sign in to comment.