Skip to content

Commit

Permalink
Fix IntelliJ warnings, update .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
comp500 committed Jun 16, 2020
1 parent 692e9c8 commit 842427e
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 22 deletions.
110 changes: 99 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Created by https://www.gitignore.io/api/java,gradle,eclipse
# Edit at https://www.gitignore.io/?templates=java,gradle,eclipse

# Created by https://www.toptal.com/developers/gitignore/api/java,gradle,eclipse,intellij+all
# Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,eclipse,intellij+all

### Eclipse ###
.metadata
Expand Down Expand Up @@ -52,23 +53,109 @@ local.properties

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Eclipse Patch ###
# Eclipse Core
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
.project

# JDT-specific (Eclipse Java Development Tools)
.classpath
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/

# Annotation Processing
.apt_generated
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.sts4-cache/
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Java ###
# Compiled class file
Expand Down Expand Up @@ -114,7 +201,8 @@ gradle-app.setting
### Gradle Patch ###
**/build/

# End of https://www.gitignore.io/api/java,gradle,eclipse
# End of https://www.toptal.com/developers/gitignore/api/java,gradle,eclipse,intellij+all

/.vscode/
/packwiz.json
/packwiz.json
.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static boolean addOptions(Options options, String path) {
return true;
}

public static void start(String[] args, String path) throws ClassNotFoundException, Exception {
public static void start(String[] args, String path) throws Exception {
loadClass(path);

// Must be casted to Object (not array) because varargs
Expand All @@ -63,12 +63,12 @@ public static String getVersion(String path) {
try {
Manifest mf = jarStream.getManifest();
version = mf.getMainAttributes().getValue("Implementation-Version");
} catch (Exception e) {}
} catch (Exception ignored) {}

// Clean up
try {
jarStream.close();
} catch (IOException e) {}
} catch (IOException ignored) {}
return version;
}
}
12 changes: 5 additions & 7 deletions src/main/java/link/infra/packwiz/installer/bootstrap/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ private void doUpdate() throws IOException, GithubException {
}
return;
}

// Assist with GC a bit, probably not necessary
backup = null;

System.out.println("Update successful!");
} else {
System.out.println("Already up to date!");
Expand Down Expand Up @@ -201,7 +199,7 @@ private void parseOptions(String[] args) throws ParseException {
// Remove invalid arguments, because Commons CLI chokes on invalid arguments
// (that should be passed to packwiz-installer)
private String[] filterArgs(String[] args, Options options) {
List<String> argsList = new ArrayList<String>(args.length);
List<String> argsList = new ArrayList<>(args.length);
boolean prevOptWasArg = false;
for (String arg : args) {
if (arg.charAt(0) == '-' && options.hasOption(arg)) {
Expand All @@ -221,13 +219,13 @@ private String[] filterArgs(String[] args, Options options) {
return argsList.toArray(new String[0]);
}

private class Release {
private static class Release {
String tagName = null;
String downloadURL = null;
String assetURL = null;
}

private class GithubException extends Exception {
private static class GithubException extends Exception {
private static final long serialVersionUID = 3843811090801607241L;

public GithubException() {
Expand All @@ -239,7 +237,7 @@ public GithubException(String message) {
}
}

class ConnMonitorInputStream extends InputStream {
static class ConnMonitorInputStream extends InputStream {
private InputStream in = null;
private int size = -1;
private int bytesRead = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public RollbackHandler(String path) {
storage = Files.readAllBytes(rollbackPath);
hasRollback = true;
// Ignore errors, it probably doesn't exist!
} catch (IOException e) {}
} catch (IOException ignored) {}
}

public void rollback() throws IOException {
Expand Down

0 comments on commit 842427e

Please sign in to comment.