@@ -92,12 +92,11 @@ public Optional<String> getName() {
92
92
log .warn ("Request was rate limited" , new Exception ());
93
93
}
94
94
MatrixErrorInfo info = gson .fromJson (body , MatrixErrorInfo .class );
95
- throw new IOException ("Couldn't get name for room " + roomId + " - "
96
- + info .getErrcode () + ": " + info . getError ());
95
+ throw new IOException ("Couldn't get name for room " + roomId + " - " + info . getErrcode () + ": "
96
+ + info .getError ());
97
97
}
98
98
99
- return Optional
100
- .of (jsonParser .parse (body ).getAsJsonObject ().get ("name" ).getAsString ());
99
+ return Optional .of (jsonParser .parse (body ).getAsJsonObject ().get ("name" ).getAsString ());
101
100
}
102
101
} catch (IOException e ) {
103
102
throw new MatrixClientRequestException (e );
@@ -124,12 +123,10 @@ public Optional<String> getTopic() {
124
123
log .warn ("Request was rate limited" , new Exception ());
125
124
}
126
125
MatrixErrorInfo info = gson .fromJson (body , MatrixErrorInfo .class );
127
- throw new MatrixClientRequestException (info ,
128
- "Couldn't get topic for room " + roomId );
126
+ throw new MatrixClientRequestException (info , "Couldn't get topic for room " + roomId );
129
127
}
130
128
131
- return Optional
132
- .of (jsonParser .parse (body ).getAsJsonObject ().get ("topic" ).getAsString ());
129
+ return Optional .of (jsonParser .parse (body ).getAsJsonObject ().get ("topic" ).getAsString ());
133
130
}
134
131
} catch (IOException e ) {
135
132
throw new MatrixClientRequestException (e );
@@ -157,8 +154,7 @@ public void join() {
157
154
MatrixErrorInfo info = gson .fromJson (body , MatrixErrorInfo .class );
158
155
159
156
if (res .getStatusLine ().getStatusCode () == 403 ) {
160
- log .error ("Failed to join room, we are not allowed: {} - {}" , info .getErrcode (),
161
- info .getError ());
157
+ log .error ("Failed to join room, we are not allowed: {} - {}" , info .getErrcode (), info .getError ());
162
158
} else {
163
159
throw new MatrixClientRequestException (info , "Error joining for " + getUser ());
164
160
}
@@ -195,8 +191,7 @@ public void leave() {
195
191
MatrixErrorInfo info = gson .fromJson (body , MatrixErrorInfo .class );
196
192
197
193
if (res .getStatusLine ().getStatusCode () == 403 ) {
198
- log .debug (
199
- "Failed to leave room, we are not allowed, most likely already left: {} - {}" ,
194
+ log .debug ("Failed to leave room, we are not allowed, most likely already left: {} - {}" ,
200
195
info .getErrcode (), info .getError ());
201
196
} else {
202
197
throw new MatrixClientRequestException (info ,
@@ -211,8 +206,7 @@ public void leave() {
211
206
212
207
private void sendMessage (RoomMessageTextPutBody content ) {
213
208
try {
214
- URI path = getClientPath (
215
- "/rooms/{roomId}/send/m.room.message/" + System .currentTimeMillis ());
209
+ URI path = getClientPath ("/rooms/{roomId}/send/m.room.message/" + System .currentTimeMillis ());
216
210
HttpPut req = new HttpPut (path );
217
211
req .setEntity (getJsonEntity (content ));
218
212
@@ -232,8 +226,8 @@ private void sendMessage(RoomMessageTextPutBody content) {
232
226
if (res .getStatusLine ().getStatusCode () == 403 ) {
233
227
log .error ("Failed send message, we are not allowed: {}" , info .getError ());
234
228
} else {
235
- throw new IOException ("Error sending message for " + getUser () + " - "
236
- + info . getErrcode () + ": " + info .getError ());
229
+ throw new IOException ("Error sending message for " + getUser () + " - " + info . getErrcode ()
230
+ + ": " + info .getError ());
237
231
}
238
232
}
239
233
}
@@ -285,12 +279,11 @@ public List<_MatrixID> getJoinedUsers() {
285
279
log .warn ("Request was rate limited" , new Exception ());
286
280
}
287
281
MatrixErrorInfo info = gson .fromJson (body , MatrixErrorInfo .class );
288
- throw new IOException ("Couldn't list joined users in " + roomId + " - "
289
- + info .getErrcode () + ": " + info . getError ());
282
+ throw new IOException ("Couldn't list joined users in " + roomId + " - " + info . getErrcode () + ": "
283
+ + info .getError ());
290
284
}
291
285
292
- JsonObject joinedUsers = jsonParser .parse (body ).getAsJsonObject ().get ("joined" )
293
- .getAsJsonObject ();
286
+ JsonObject joinedUsers = jsonParser .parse (body ).getAsJsonObject ().get ("joined" ).getAsJsonObject ();
294
287
List <_MatrixID > ids = new ArrayList <>();
295
288
for (Map .Entry <String , JsonElement > entry : joinedUsers .entrySet ()) {
296
289
ids .add (new MatrixID (entry .getKey ()));
0 commit comments