1
0
mirror of https://github.com/moparisthebest/rcrdit synced 2024-12-22 07:18:56 -05:00

Implement error-prone static analyzer, fix some problems it found

This commit is contained in:
Travis Burtrum 2017-03-03 01:11:14 -05:00
parent ae8df83ce8
commit 352e8ed1ad
3 changed files with 30 additions and 7 deletions

20
pom.xml
View File

@ -156,13 +156,33 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version> <version>3.6.1</version>
<configuration> <configuration>
<compilerId>javac-with-errorprone</compilerId>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<debug>true</debug> <debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
<compilerArgs> <compilerArgs>
<arg>-Xlint</arg> <arg>-Xlint</arg>
<arg>-Werror</arg>
</compilerArgs> </compilerArgs>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.8.1</version>
</dependency>
<!-- override plexus-compiler-javac-errorprone's dependency on
Error Prone with the latest version -->
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.0.18</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>

View File

@ -18,6 +18,8 @@
package com.moparisthebest.rcrdit; package com.moparisthebest.rcrdit;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.moparisthebest.jdbc.QueryMapper; import com.moparisthebest.jdbc.QueryMapper;
import com.moparisthebest.rcrdit.autorec.AutoRec; import com.moparisthebest.rcrdit.autorec.AutoRec;
import com.moparisthebest.rcrdit.autorec.Profile; import com.moparisthebest.rcrdit.autorec.Profile;
@ -167,13 +169,13 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
// generate unique identifier.. // generate unique identifier..
md.reset(); md.reset();
// incorporate everything to make this unique // incorporate everything to make this unique
md.update(Long.toString(start.toEpochMilli()).getBytes()); md.update(Long.toString(start.toEpochMilli()).getBytes(UTF_8));
md.update(Long.toString(stop.toEpochMilli()).getBytes()); md.update(Long.toString(stop.toEpochMilli()).getBytes(UTF_8));
md.update(Long.toString(prog.getProgram().getStart().toEpochMilli()).getBytes()); md.update(Long.toString(prog.getProgram().getStart().toEpochMilli()).getBytes(UTF_8));
md.update(Long.toString(prog.getProgram().getStop().toEpochMilli()).getBytes()); md.update(Long.toString(prog.getProgram().getStop().toEpochMilli()).getBytes(UTF_8));
md.update(prog.getProgram().getChannelName().getBytes()); md.update(prog.getProgram().getChannelName().getBytes(UTF_8));
md.update(name.getBytes()); md.update(name.getBytes(UTF_8));
md.update(description.getBytes()); md.update(description.getBytes(UTF_8));
final byte[] digest = md.digest(); final byte[] digest = md.digest();
final Uid uid = new Uid(String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest))); final Uid uid = new Uid(String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest)));
/* /*

View File

@ -34,6 +34,7 @@ public interface Tuner extends AutoCloseable {
boolean stopAndRecordNow(ProgramAutoRec stop, ProgramAutoRec start, Timer timer); boolean stopAndRecordNow(ProgramAutoRec stop, ProgramAutoRec start, Timer timer);
@Override
public void close(); public void close();
default ProgramAutoRec getRecording() { default ProgramAutoRec getRecording() {