Skip to content

Commit da559d6

Browse files
committed
remove unused/dead code
1 parent 102e868 commit da559d6

File tree

4 files changed

+2
-102
lines changed

4 files changed

+2
-102
lines changed

src/main/java/com/opentok/Archive.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,6 @@ public Status getStatus() {
137137
public String getUrl() {
138138
return url;
139139
}
140-
141-
// public Archive stop() throws OpenTokException {
142-
// HashMap<String, String> headers = new HashMap<String, String>();
143-
// headers.put("content-type", "application/json");
144-
// String archive = HttpClient.makePostRequest("/v2/partner/" + this.partnerId + "/archive/" + id, headers, null,
145-
// "{ \"action\" : \"stop\" }");
146-
// ObjectMapper mapper = new ObjectMapper();
147-
// try {
148-
// Archive updatedArchive = mapper.readValue(archive, Archive.class);
149-
// this.status = updatedArchive.status;
150-
// return this;
151-
// } catch (Exception e) {
152-
// throw new RequestException(500, "Exception mapping json: " + e.getMessage());
153-
// }
154-
// }
155-
156-
// public void delete() throws OpenTokException {
157-
// HttpClient.makeDeleteRequest("/v2/partner/" + partnerId + "/archive/" + id);
158-
// }
159140

160141
@Override
161142
public String toString() {

src/main/java/com/opentok/OpenTok.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ public List<Archive> listArchives(int offset, int count) throws OpenTokException
351351
JsonParser jp = mapper.getFactory().createParser(archive);
352352
return mapper.readValue(mapper.treeAsTokens(mapper.readTree(jp).get("items")),
353353
TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, Archive.class));
354+
355+
// if we only wanted Java 7 and above, we could DRY this into one catch clause
354356
} catch (JsonMappingException e) {
355357
throw new RequestException("Exception mapping json: " + e.getMessage());
356358
} catch (JsonParseException e) {

src/main/java/com/opentok/exception/SessionNotFoundException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/java/com/opentok/util/HttpClient.java

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
public class HttpClient extends AsyncHttpClient {
2020

2121
private final String apiUrl;
22-
// NOTE: do we even need these since we now have the PartnerAuthRequestFilter?
2322
private final int apiKey;
24-
private final String apiSecret;
2523

2624
private HttpClient(Builder builder) {
2725
super(builder.config);
2826
this.apiKey = builder.apiKey;
29-
this.apiSecret = builder.apiSecret;
3027
this.apiUrl = builder.apiUrl;
3128
}
3229

@@ -238,76 +235,6 @@ public String deleteArchive(String archiveId) {
238235
return responseString;
239236
}
240237

241-
// protected static String makeDeleteRequest(String resource) throws OpenTokException {
242-
// BoundRequestBuilder get = client.prepareDelete(apiUrl + resource);
243-
// addCommonHeaders(get);
244-
//
245-
// try {
246-
// Response result = get.execute().get();
247-
// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) {
248-
// throw new RequestException(result.getStatusCode(), "Error response: message: "
249-
// + result.getStatusText());
250-
// }
251-
// return result.getResponseBody();
252-
// } catch (Exception e) {
253-
// throw new RequestException(500, e.getMessage());
254-
// }
255-
// }
256-
//
257-
// protected static String makeGetRequest(String resource) throws OpenTokException {
258-
// BoundRequestBuilder get = client.prepareGet(apiUrl + resource);
259-
// addCommonHeaders(get);
260-
//
261-
// try {
262-
// Response result = get.execute().get();
263-
// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) {
264-
// throw new RequestException(result.getStatusCode(), "Error response: message: "
265-
// + result.getStatusText());
266-
// }
267-
// return result.getResponseBody();
268-
// } catch (Exception e) {
269-
// throw new RequestException(500, e.getMessage());
270-
// }
271-
// }
272-
//
273-
// protected static String makePostRequest(String resource, Map<String, String> headers, Map<String, String> params,
274-
// String postData) throws OpenTokException {
275-
// BoundRequestBuilder post = client.preparePost(apiUrl + resource);
276-
// if (params != null) {
277-
// for (Entry<String, String> pair : params.entrySet()) {
278-
// post.addParameter(pair.getKey(), pair.getValue());
279-
// }
280-
// }
281-
//
282-
// if (headers != null) {
283-
// for (Entry<String, String> pair : headers.entrySet()) {
284-
// post.addHeader(pair.getKey(), pair.getValue());
285-
// }
286-
// }
287-
//
288-
// addCommonHeaders(post);
289-
//
290-
// if (postData != null) {
291-
// post.setBody(postData);
292-
// }
293-
//
294-
// try {
295-
// Response result = post.execute().get();
296-
//
297-
// if (result.getStatusCode() < 200 || result.getStatusCode() > 299) {
298-
// throw new RequestException(result.getStatusCode(), "Error response: message: " + result.getStatusText());
299-
// }
300-
//
301-
// return result.getResponseBody();
302-
// } catch (Exception e) {
303-
// throw new RequestException(500, e.getMessage());
304-
// }
305-
// }
306-
//
307-
// private static void addCommonHeaders(BoundRequestBuilder get) {
308-
// get.addHeader("X-TB-PARTNER-AUTH", String.format("%s:%s", apiKey, apiSecret));
309-
// }
310-
311238
public static class Builder {
312239
private final int apiKey;
313240
private final String apiSecret;

0 commit comments

Comments
 (0)