forked from j62/ctbrec
1
0
Fork 0

Remove some compiler and sonar warnings

This commit is contained in:
0xb00bface 2021-01-09 14:03:03 +01:00
parent dc12e12dc0
commit e548f25f2d
7 changed files with 27 additions and 18 deletions

View File

@ -11,7 +11,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -1,9 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=12
org.eclipse.jdt.core.compiler.compliance=15
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -13,4 +13,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=12
org.eclipse.jdt.core.compiler.source=15

View File

@ -14,8 +14,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
<name.final>${project.groupId}-${project.version}-final</name.final>
</properties>

View File

@ -30,12 +30,10 @@ public class LiveJasminFollowedUpdateService extends PaginatedScheduledService {
private static final Logger LOG = LoggerFactory.getLogger(LiveJasminFollowedUpdateService.class);
private LiveJasmin liveJasmin;
private String url;
private boolean showOnline = true;
public LiveJasminFollowedUpdateService(LiveJasmin liveJasmin) {
this.liveJasmin = liveJasmin;
this.url = liveJasmin.getBaseUrl() + "/en/member/favorite";
//this.url = liveJasmin.getBaseUrl() + "/en/free/favourite/get-favourite-list?_dc=" + ts;
}
@Override
@ -43,15 +41,15 @@ public class LiveJasminFollowedUpdateService extends PaginatedScheduledService {
return new Task<List<Model>>() {
@Override
public List<Model> call() throws IOException {
if(!liveJasmin.credentialsAvailable()) {
if (!liveJasmin.credentialsAvailable()) {
throw new NotLoggedInExcetion("Credentials missing");
}
boolean loggedIn = SiteUiFactory.getUi(liveJasmin).login();
if(!loggedIn) {
throw new RuntimeException("Couldn't login to livejasmin");
if (!loggedIn) {
throw new NotLoggedInExcetion("Couldn't login to livejasmin");
}
//LOG.debug("Fetching page {}", url);
LOG.debug("Fetching page {}", url);
Request request = new Request.Builder()
.url(url)
.header(USER_AGENT, Config.getInstance().getSettings().httpUserAgent)
@ -80,8 +78,4 @@ public class LiveJasminFollowedUpdateService extends PaginatedScheduledService {
}
};
}
public void setShowOnline(boolean showOnline) {
this.showOnline = showOnline;
}
}

View File

@ -14,6 +14,7 @@ import org.json.JSONObject;
import ctbrec.Config;
import ctbrec.Model;
import ctbrec.UnexpectedResponseException;
import ctbrec.io.HttpException;
import ctbrec.sites.showup.Showup;
import ctbrec.sites.showup.ShowupModel;
@ -55,7 +56,7 @@ public class ShowupFollowedUpdateService extends PaginatedScheduledService {
.filter(m -> onlineModels.containsKey(m.getName()) == showOnline)
.collect(Collectors.toList());
} else {
throw new RuntimeException("Request was not successful: " + body);
throw new UnexpectedResponseException("Request was not successful: " + body);
}
} else {
throw new HttpException(response.code(), response.message());
@ -83,7 +84,7 @@ public class ShowupFollowedUpdateService extends PaginatedScheduledService {
for (int i = 0; i < online.length(); i++) {
JSONObject m = online.getJSONObject(i);
String preview = site.getBaseUrl() + "/files/" + m.optString("big_img") + ".jpg";
//onlineModels.put(m.optLong("uid"), preview);
onlineModels.put(String.valueOf(m.optLong("uid")), preview);
}
return onlineModels;
}

View File

@ -0,0 +1,9 @@
package ctbrec;
public class UnexpectedResponseException extends RuntimeException {
public UnexpectedResponseException(String msg) {
super(msg);
}
}

View File

@ -276,6 +276,7 @@ public class DashDownload extends AbstractDownload {
}
}
@SuppressWarnings("deprecation")
private boolean splitRecording() {
if (config.getSettings().splitRecordings > 0) {
Duration recordingDuration = Duration.between(splitRecStartTime, ZonedDateTime.now());