Skip to content

Commit be2ff19

Browse files
committed
Tidied up warnings highlighted by IntelliJ
1 parent 7035278 commit be2ff19

23 files changed

+213
-351
lines changed

sample/Archiving/src/main/java/com/example/ArchivingServer.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import com.opentok.*;
66
import com.opentok.Archive.OutputMode;
7-
import com.opentok.ArchiveLayout;
8-
import com.opentok.ArchiveProperties;
97

108
import spark.*;
119

@@ -56,7 +54,7 @@ public ModelAndView handle(Request request, Response response) {
5654
public ModelAndView handle(Request request, Response response) {
5755

5856
String token = null;
59-
ArrayList<String> layoutClassList = new ArrayList<String>();
57+
ArrayList<String> layoutClassList = new ArrayList<>();
6058
layoutClassList.add("focus");
6159
try {
6260
token = opentok.generateToken(sessionId, new TokenOptions.Builder()
@@ -67,7 +65,7 @@ public ModelAndView handle(Request request, Response response) {
6765
e.printStackTrace();
6866
}
6967

70-
Map<String, Object> attributes = new HashMap<String, Object>();
68+
Map<String, Object> attributes = new HashMap<>();
7169
attributes.put("apiKey", apiKey);
7270
attributes.put("sessionId", sessionId);
7371
attributes.put("token", token);
@@ -91,7 +89,7 @@ public ModelAndView handle(Request request, Response response) {
9189
e.printStackTrace();
9290
}
9391

94-
Map<String, Object> attributes = new HashMap<String, Object>();
92+
Map<String, Object> attributes = new HashMap<>();
9593
attributes.put("apiKey", apiKey);
9694
attributes.put("sessionId", sessionId);
9795
attributes.put("token", token);
@@ -122,7 +120,7 @@ public ModelAndView handle(Request request, Response response) {
122120
e.printStackTrace();
123121
}
124122

125-
Map<String, Object> attributes = new HashMap<String, Object>();
123+
Map<String, Object> attributes = new HashMap<>();
126124
attributes.put("archives", archives);
127125
attributes.put("showPrevious", null);
128126
// TODO: we don't have a total count, how do we know if there is a next page?
@@ -140,7 +138,7 @@ public ModelAndView handle(Request request, Response response) {
140138
@Override
141139
public Object handle(Request request, Response response) {
142140

143-
Archive archive = null;
141+
Archive archive;
144142
try {
145143
archive = opentok.getArchive(request.params("archiveId"));
146144
} catch (OpenTokException e) {
@@ -157,7 +155,7 @@ public Object handle(Request request, Response response) {
157155
@Override
158156
public Object handle(Request request, Response response) {
159157

160-
Archive archive = null;
158+
Archive archive;
161159
HttpServletRequest req = request.raw();
162160
boolean hasAudio = req.getParameterMap().containsKey("hasAudio");
163161
boolean hasVideo = req.getParameterMap().containsKey("hasVideo");
@@ -188,7 +186,7 @@ public Object handle(Request request, Response response) {
188186
@Override
189187
public Object handle(Request request, Response response) {
190188

191-
Archive archive = null;
189+
Archive archive;
192190
try {
193191
archive = opentok.stopArchive(request.params("archiveId"));
194192
} catch (OpenTokException e) {
@@ -240,7 +238,7 @@ public Object handle(Request request, Response response) {
240238
post(new Route("/focus") {
241239
@Override
242240
public Object handle(Request request, Response response) {
243-
ArrayList<String> otherStreams = new ArrayList<String>();
241+
ArrayList<String> otherStreams = new ArrayList<>();
244242
HttpServletRequest req = request.raw();
245243
String newFocusStreamId = req.getParameterMap().get("focus")[0];
246244

sample/Archiving/src/main/java/com/example/FreeMarkerTemplateView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public String render(ModelAndView modelAndView) {
3333

3434
return stringWriter.toString();
3535

36-
} catch (IOException e) {
37-
throw new IllegalArgumentException(e);
38-
} catch (TemplateException e) {
36+
} catch (IOException | TemplateException e) {
3937
throw new IllegalArgumentException(e);
4038
}
4139
}

sample/HelloWorld/src/main/java/com/example/FreeMarkerTemplateView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public String render(ModelAndView modelAndView) {
3333

3434
return stringWriter.toString();
3535

36-
} catch (IOException e) {
37-
throw new IllegalArgumentException(e);
38-
} catch (TemplateException e) {
36+
} catch (IOException | TemplateException e) {
3937
throw new IllegalArgumentException(e);
4038
}
4139
}

sample/HelloWorld/src/main/java/com/example/HelloWorldServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ModelAndView handle(Request request, Response response) {
4040
e.printStackTrace();
4141
}
4242

43-
Map<String, Object> attributes = new HashMap<String, Object>();
43+
Map<String, Object> attributes = new HashMap<>();
4444
attributes.put("apiKey", apiKey);
4545
attributes.put("sessionId", sessionId);
4646
attributes.put("token", token);

src/main/java/com/opentok/ArchiveLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public enum Type {
7474

7575
private String serialized;
7676

77-
private Type(String s) {
77+
Type(String s) {
7878
serialized = s;
7979
}
8080

src/main/java/com/opentok/ArchiveMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum ArchiveMode {
2727

2828
private String serialized;
2929

30-
private ArchiveMode(String s) {
30+
ArchiveMode(String s) {
3131
serialized = s;
3232
}
3333

src/main/java/com/opentok/ArchiveProperties.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
public class ArchiveProperties {
2626

2727

28-
private String name = null;
29-
private String resolution = null;
28+
private String name;
29+
private String resolution;
3030
private boolean hasAudio;
3131
private boolean hasVideo;
3232
private OutputMode outputMode;
@@ -219,40 +219,40 @@ public ArchiveLayout layout() {
219219
* Returns the archive properties as a Map.
220220
*/
221221
public Map<String, Collection<String>> toMap() {
222-
Map<String, Collection<String>> params = new HashMap<String, Collection<String>>();
222+
Map<String, Collection<String>> params = new HashMap<>();
223223
if (name != null) {
224-
ArrayList<String> valueList = new ArrayList<String>();
224+
ArrayList<String> valueList = new ArrayList<>();
225225
valueList.add(name);
226226
params.put("name", valueList);
227227
}
228228
if (resolution != null) {
229-
ArrayList<String> valueList = new ArrayList<String>();
229+
ArrayList<String> valueList = new ArrayList<>();
230230
valueList.add(resolution);
231231
params.put("resolution", valueList);
232232
}
233-
ArrayList<String> valueList = new ArrayList<String>();
233+
ArrayList<String> valueList = new ArrayList<>();
234234
valueList.add(Boolean.toString(hasAudio));
235235
params.put("hasAudio", valueList);
236236

237-
valueList = new ArrayList<String>();
237+
valueList = new ArrayList<>();
238238
valueList.add(Boolean.toString(hasVideo));
239239
params.put("hasVideo", valueList);
240240

241-
valueList = new ArrayList<String>();
241+
valueList = new ArrayList<>();
242242
valueList.add(outputMode.toString());
243243
params.put("outputMode", valueList);
244244

245-
valueList = new ArrayList<String>();
245+
valueList = new ArrayList<>();
246246
valueList.add(streamMode.toString());
247247
params.put("streamMode", valueList);
248248

249249
if (layout != null) {
250-
valueList = new ArrayList<String>();
250+
valueList = new ArrayList<>();
251251
valueList.add(layout.toString());
252252
params.put("layout", valueList);
253253
}
254254

255255
return params;
256256
}
257257

258-
};
258+
}

src/main/java/com/opentok/Broadcast.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.fasterxml.jackson.databind.ObjectMapper;
1515

1616
import java.util.ArrayList;
17-
import java.util.Collection;
1817
import java.util.List;
1918
import java.util.Map;
2019

src/main/java/com/opentok/BroadcastProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public Builder hls(Hls hls) {
114114
* @return The BroadcastProperties.Builder object with the list of RtmpProperties setting.
115115
*/
116116
public Builder addRtmpProperties (RtmpProperties rtmpProps) throws InvalidArgumentException {
117-
if(this.rtmpList.size() >= 5) {
117+
if (this.rtmpList.size() >= 5) {
118118
throw new InvalidArgumentException("Cannot add more than 5 RtmpProperties properties");
119119
}
120120
this.rtmpList.add(rtmpProps);

src/main/java/com/opentok/MediaMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public enum MediaMode {
2525

2626
private String serialized;
2727

28-
private MediaMode(String s) {
28+
MediaMode(String s) {
2929
serialized = s;
3030
}
3131

0 commit comments

Comments
 (0)