Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/xyz/zcraft/ostella/network/OsuAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,14 @@ public static User getSelf(String auth) {
if (response.statusCode() >= 400) {
throw new ApiException(
ErrorCode.USER_FETCH_FAILED,
"osu! API returned status " + response.statusCode() + " for friend list"
"osu! API returned status " + response.statusCode() + " for self data"
);
}

final var json = JsonParser.parseString(response.body()).getAsJsonObject();
return GSON.fromJson(json, User.class);
} catch (IOException | InterruptedException e) {
throw new ApiException(ErrorCode.USER_FETCH_FAILED, "Network failed to get friend list", e);
throw new ApiException(ErrorCode.USER_FETCH_FAILED, "Network failed to get self data", e);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/xyz/zcraft/ostella/network/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ public void getCurrentRoomItem(@NotNull Context context) {
})
.thenApply((MultiplayerRoom.CurrentPlaylistItem c) -> {
final BeatmapExtended beatmap = c.getBeatmap();
if (beatmap == null) {
throw new ApiException(ErrorCode.NO_BEATMAP_FOUND, "Beatmap is null!");
}
JsonObject res = new JsonObject();
res.addProperty("beatmap_id", beatmap.getId());
res.addProperty("beatmapset_id", beatmap.getBeatmapsetId());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/xyz/zcraft/ostella/network/WebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public WebServer(AppConfig conf, TokenManager tokenManager) throws IOException {
.get("/replays/{jobId}/video/replay.mp4", router.replayController::getReplayRenderResultFile)
.delete("/replays/{jobId}/video", router.replayController::deleteReplayRenderResult);
} else {
LOG.info("Replay rendering will is disabled.");
LOG.info("Replay rendering is disabled.");
}

cfg.routes
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/xyz/zcraft/ostella/util/RequestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ public static String optionalString(Context context, String param) throws ApiExc
}

public static long requireLong(Context context, String param) throws ApiException {
return parseLong(context.queryParam(param));
}

public static long parseLong(String s) throws ApiException {
try {
return Long.parseLong(Objects.requireNonNull(s));
return Long.parseLong(Objects.requireNonNull(context.queryParam(param)));
} catch (Exception e) {
throw new ApiException(ErrorCode.ILLEGAL_ARGUMENT, "Invalid parameter: " + s);
throw new ApiException(ErrorCode.ILLEGAL_ARGUMENT, "Invalid parameter: " + param);
}
}

Expand Down
Loading