Bug 1244944 - Remove untyped EJO.putAll. r=rnewman

MozReview-Commit-ID: 2TQNGErFAMv
This commit is contained in:
Nick Alexander 2016-01-20 16:23:44 -08:00
parent c6f78cf224
commit 80a6d27839
3 changed files with 3 additions and 16 deletions

View File

@ -35,14 +35,7 @@ public class JSONWebTokenUtils {
public static final String DEFAULT_ASSERTION_ISSUER = "127.0.0.1";
public static String encode(String payload, SigningPrivateKey privateKey) throws UnsupportedEncodingException, GeneralSecurityException {
return encode(payload, privateKey, null);
}
protected static String encode(String payload, SigningPrivateKey privateKey, Map<String, Object> headerFields) throws UnsupportedEncodingException, GeneralSecurityException {
ExtendedJSONObject header = new ExtendedJSONObject();
if (headerFields != null) {
header.putAll(headerFields);
}
final ExtendedJSONObject header = new ExtendedJSONObject();
header.put("alg", privateKey.getAlgorithm());
String encodedHeader = Base64.encodeBase64URLSafeString(header.toJSONString().getBytes("UTF-8"));
String encodedPayload = Base64.encodeBase64URLSafeString(payload.getBytes("UTF-8"));

View File

@ -294,11 +294,6 @@ public class ExtendedJSONObject {
map.put(key, value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public void putAll(Map map) {
this.object.putAll(map);
}
/**
* Remove key-value pair from JSONObject.
*

View File

@ -20,6 +20,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
@ -62,7 +63,6 @@ public class TestExtendedJSONObject {
public void testSafeInteger() {
ExtendedJSONObject o = new ExtendedJSONObject();
o.put("integer", Integer.valueOf(5));
o.put("double", Double.valueOf(1.2));
o.put("string", "66");
o.put("object", new ExtendedJSONObject());
o.put("null", null);
@ -146,8 +146,7 @@ public class TestExtendedJSONObject {
ExtendedJSONObject q = new ExtendedJSONObject(exampleJSON);
q.put("modified", 0);
assertNotSame(o, q);
q.put("modified", o.get("modified"));
assertEquals(o, q);
assertNotEquals(o, q);
}
@Test