Skip to content

Commit 647de8f

Browse files
committed
Suppress warnings in DeviantartRipper and provide justification.
1 parent 672c3c2 commit 647de8f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ private void login() throws IOException {
224224
logger.info("DA Cookies: " + getDACookie());
225225
}
226226

227-
228227
/**
229228
* Returns next page Document using offset.
230229
*/
@@ -246,7 +245,6 @@ public Document getNextPage(Document doc) throws IOException {
246245
}
247246

248247
return Http.url(urlWithParams(this.offset)).referrer(referer).userAgent(userAgent).cookies(getDACookie()).get();
249-
250248
}
251249

252250
/**
@@ -258,7 +256,6 @@ public Document getNextPage(Document doc) throws IOException {
258256
*/
259257
@Override
260258
protected List<String> getURLsFromPage(Document page) {
261-
262259
List<String> result = new ArrayList<String>();
263260

264261
Element div;
@@ -293,6 +290,11 @@ protected void downloadURL(URL url, int index) {
293290
logger.info("Downloading URL Number " + this.downloadCount);
294291
logger.info("Deviant Art URL: " + url.toExternalForm());
295292
try {
293+
// Suppress this warning because it is part of code that was temporarily
294+
// commented out to disable the behavior.
295+
// We know there's a lot about this ripper that needs to be fixed so
296+
// we're not too worried about warnings in this file.
297+
@SuppressWarnings("unused")
296298
Response re = Http.url(urlWithParams(this.offset)).cookies(getDACookie()).referrer(referer)
297299
.userAgent(userAgent).response();
298300
//updateCookie(re.cookies());
@@ -319,7 +321,6 @@ public String normalizeUrl(String url) {
319321
*/
320322
@Override
321323
public String getGID(URL url) throws MalformedURLException {
322-
323324
String s = url.toExternalForm();
324325
String artist = "unknown";
325326
String what = "unknown";
@@ -366,7 +367,6 @@ public String getGID(URL url) throws MalformedURLException {
366367
logger.info("Album Name: " + artist + "_" + what + "_" + albumname);
367368

368369
return artist + "_" + what + "_" + albumname;
369-
370370
}
371371

372372
/**
@@ -413,7 +413,6 @@ private Map<String, String> getDACookie() {
413413
* @param m new Cookies
414414
*/
415415
private void updateCookie(Map<String, String> m) {
416-
417416
if (m == null) {
418417
return;
419418
}
@@ -439,7 +438,6 @@ private void updateCookie(Map<String, String> m) {
439438
} catch (IOException e) {
440439
e.printStackTrace();
441440
}
442-
443441
}
444442

445443
/**
@@ -470,8 +468,13 @@ private String serialize(Serializable o) throws IOException {
470468
private Map<String, String> deserialize(String s) throws IOException, ClassNotFoundException {
471469
byte[] data = Base64.getDecoder().decode(s);
472470
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
473-
HashMap<String, String> o = (HashMap<String, String>) ois.readObject(); // Unchecked cast here but should never
474-
// be something else
471+
472+
// Suppress this warning because it's part of the legacy implementation.
473+
// We know there's a lot about this ripper that needs to be fixed so
474+
// we're not too worried about warnings in this file.
475+
// Unchecked cast here but should never be something else.
476+
@SuppressWarnings("unchecked")
477+
HashMap<String, String> o = (HashMap<String, String>) ois.readObject();
475478
ois.close();
476479
return o;
477480
}

0 commit comments

Comments
 (0)