Reformat to use Fabric API's checkstyle (#137)

* Reformat to use Fabric API's checkstyle

* Fix

* Fix

* Update

* Travis and fixes

* possible fix for checkstyle?

* Helps if i push the checkstyle.xml file...

* Log checkstyle issues to console - used by travis

* Fix some more issues

* opps
This commit is contained in:
modmuss50
2019-11-02 20:23:27 +00:00
committed by GitHub
parent 2bd339241f
commit f85daec559
59 changed files with 2129 additions and 1655 deletions

View File

@@ -24,15 +24,15 @@
package net.fabricmc.loom.util;
import java.io.File;
import java.io.IOException;
import com.google.common.hash.HashCode;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import java.io.File;
import java.io.IOException;
public class Checksum {
private static final Logger log = Logging.getLogger(Checksum.class);
@@ -40,18 +40,22 @@ public class Checksum {
if (file == null) {
return false;
}
try {
//noinspection deprecation
HashCode hash = Files.asByteSource(file).hash(Hashing.sha1());
StringBuilder builder = new StringBuilder();
for (Byte hashBytes : hash.asBytes()) {
builder.append(Integer.toString((hashBytes & 0xFF) + 0x100, 16).substring(1));
}
log.debug("Checksum check: '" + builder.toString() + "' == '" + checksum + "'?");
return builder.toString().equals(checksum);
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}