Skip to content

Commit

Permalink
Findbugs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nvoxland committed Aug 16, 2016
1 parent 404963b commit d4b6e02
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
34 changes: 34 additions & 0 deletions findbugs-exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>

<FindBugsFilter>
<LastVersion value="-1" relOp="NEQ"/>
<And>
<Rank value="10"/>
<Bug category="SECURITY"/>
<Bug code="SQL"/>
<Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE"/>
</And>
<And>
<Rank value="12"/>
<Bug category="CORRECTNESS"/>
<Bug code="UwF"/>
<Bug pattern="UWF_UNWRITTEN_FIELD"/>
</And>
<And>
<Rank value="15"/>
<Bug category="STYLE"/>
<Bug code="DLS"/>
</And>
<And>
<Rank value="15"/>
<Bug category="STYLE"/>
<Bug code="ST"/>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
</And>
<And>
<Rank value="14"/>
<Bug category="BAD_PRACTICE"/>
<Bug code="Nm"/>
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
</And>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ public boolean canAccessDbaRecycleBin() {
Statement statement = null;
try {
statement = ((JdbcConnection) connection).createStatement();
statement.executeQuery("select 1 from dba_recyclebin where 0=1");
ResultSet resultSet = statement.executeQuery("select 1 from dba_recyclebin where 0=1");
resultSet.close(); //don't need to do anything with the result set, just make sure statement ran.
this.canAccessDbaRecycleBin = true;
} catch (Exception e) {
if (e instanceof SQLException && e.getMessage().startsWith("ORA-00942")) { //ORA-00942: table or view does not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,10 @@ public Edge(Node from, Node to) {

@Override
public boolean equals(Object obj) {
if (!(obj instanceof Edge)) {
if (obj == null) {
return false;
}
if (obj == null) {
if (!(obj instanceof Edge)) {
return false;
}
Edge e = (Edge) obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl outpu
String fileName = table.getName().toLowerCase() + ".csv";
if (dataDir != null) {
fileName = dataDir + "/" + fileName;
}

File parentDir = new File(dataDir);
if (!parentDir.exists()) {
parentDir.mkdirs();
}
if (!parentDir.isDirectory()) {
throw new RuntimeException(parentDir
+ " is not a directory");
File parentDir = new File(dataDir);
if (!parentDir.exists()) {
parentDir.mkdirs();
}
if (!parentDir.isDirectory()) {
throw new RuntimeException(parentDir
+ " is not a directory");
}
}

CSVWriter outputFile = new CSVWriter(new BufferedWriter(new FileWriter(fileName)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static boolean isSystemWindows() {
* @return true if it is a separator character
*/
private static boolean isSeparator(char ch) {
return (ch == UNIX_SEPARATOR) || (ch == WINDOWS_SEPARATOR);
return ch == '/'; //java uses this as a separator in both windows and unix
}

//-----------------------------------------------------------------------
Expand Down
20 changes: 11 additions & 9 deletions liquibase.fbp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<Project projectName="liquibase">
<Jar>.\liquibase-core\target\classes</Jar>
<Jar>.\liquibase-cdi\target\classes</Jar>
<Jar>.\liquibase-maven-plugin\target\classes</Jar>
<Jar>.\liquibase-osgi\target\classes</Jar>
<AuxClasspathEntry>.\liquibase-debian\target\lib</AuxClasspathEntry>
<SrcDir>.\liquibase-cdi\src\main\java</SrcDir>
<SrcDir>.\liquibase-core\src\main\java</SrcDir>
<SrcDir>.\liquibase-maven-plugin\src\main\java</SrcDir>
<SrcDir>.\liquibase-osgi\src\main\java</SrcDir>
<Jar>.\.\.\.\.\.\liquibase-core\target\classes</Jar>
<Jar>.\.\.\.\.\.\liquibase-cdi\target\classes</Jar>
<Jar>.\.\.\.\.\.\liquibase-maven-plugin\target\classes</Jar>
<Jar>.\.\.\.\.\.\liquibase-osgi\target\classes</Jar>
<AuxClasspathEntry>.\.\.\.\.\.\liquibase-debian\target\lib</AuxClasspathEntry>
<SrcDir>.\.\.\.\.\.\liquibase-cdi\src\main\java</SrcDir>
<SrcDir>.\.\.\.\.\.\liquibase-core\src\main\java</SrcDir>
<SrcDir>.\.\.\.\.\.\liquibase-maven-plugin\src\main\java</SrcDir>
<SrcDir>.\.\.\.\.\.\liquibase-osgi\src\main\java</SrcDir>
<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
<Plugin id="edu.umd.cs.findbugs.plugins.findbugsCommunalCloud" enabled="false"/>
<Plugin id="edu.umd.cs.findbugs.plugins.bugCollectionCloud" enabled="true"/>
</Project>

0 comments on commit d4b6e02

Please sign in to comment.