SiLeBAT/FSK-Lab

View on GitHub
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java

Summary

Maintainability
F
1 wk
Test Coverage

File Login.java has 744 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*******************************************************************************
 * Copyright (c) 2015 Federal Institute for Risk Assessment (BfR), Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 1 day to fix

Method loadDB has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    private MainFrame loadDB(Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {
        MainFrame mf = null;
        MyDBTable myDB = null;
        boolean doUpdates = false;
        try {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method loadDBNew has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    private MainFrame loadDBNew(MyDBI myDBi, String dbPath, Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {
        MainFrame mf = null;
        MyDBTable myDB = null;
        boolean doUpdates = false;
        try {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method initComponents has 153 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        ResourceBundle bundle = ResourceBundle.getBundle("org.hsh.bfr.db.gui.PanelProps");
        dialogPane = new JPanel();
        contentPanel = new JPanel();
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 6 hrs to fix

Method loadDB has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private MainFrame loadDB(Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {
        MainFrame mf = null;
        MyDBTable myDB = null;
        boolean doUpdates = false;
        try {
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 5 hrs to fix

Login has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Login extends JFrame {

    /**
     * 
     */
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 5 hrs to fix

Method loadDBNew has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private MainFrame loadDBNew(MyDBI myDBi, String dbPath, Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {
        MainFrame mf = null;
        MyDBTable myDB = null;
        boolean doUpdates = false;
        try {
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 3 hrs to fix

Method doTheUpdates has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private boolean doTheUpdates(String dbPath) {
        boolean dl = DBKernel.dontLog;
        DBKernel.dontLog = true;
        try {
            boolean isAdmin = DBKernel.isAdmin();
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 3 hrs to fix

Method doTheUpdates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean doTheUpdates(String dbPath) {
        boolean dl = DBKernel.dontLog;
        DBKernel.dontLog = true;
        try {
            boolean isAdmin = DBKernel.isAdmin();
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method askVeraltetDBBackup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private int askVeraltetDBBackup(MyDBI myDBi) {
        int result = JOptionPane.YES_OPTION;
        int retVal = JOptionPane.showConfirmDialog(this, "Die Datenbank ist veraltet und muss ersetzt werden.\nSoll zuvor ein Backup der alten Datenbank erstellt werden?",
                "Backup erstellen?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (retVal == JOptionPane.YES_OPTION) {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method startTheDB has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private void startTheDB(Boolean autoUpdate, boolean openTheGui) {
        MainFrame mf = null;
        DBKernel.myDBi = MyDBI.loadDB(textField2.getText() + System.getProperty("file.separator") + DBKernel.dbKennung + ".xml");
        if (DBKernel.myDBi != null) {
            DBKernel.HSHDB_PATH = textField2.getText();
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method startTheDB has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void startTheDB(Boolean autoUpdate, boolean openTheGui) {
        MainFrame mf = null;
        DBKernel.myDBi = MyDBI.loadDB(textField2.getText() + System.getProperty("file.separator") + DBKernel.dbKennung + ".xml");
        if (DBKernel.myDBi != null) {
            DBKernel.HSHDB_PATH = textField2.getText();
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 1 hr to fix

Method startMainFrame has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void startMainFrame(MainFrame mf, MyDBTable myDB, boolean openTheGui) {
        if (mf != null) {
            if (!mf.getMyList().setSelection(DBKernel.prefs.get("LAST_SELECTED_TABLE", null))) {
                mf.getMyList().setSelection(null);
            }
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 1 hr to fix

Method startMainFrame has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private void startMainFrame(MainFrame mf, MyDBTable myDB, boolean openTheGui) {
        if (mf != null) {
            if (!mf.getMyList().setSelection(DBKernel.prefs.get("LAST_SELECTED_TABLE", null))) {
                mf.getMyList().setSelection(null);
            }
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method loadDBNew has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private MainFrame loadDBNew(MyDBI myDBi, String dbPath, Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 35 mins to fix

Method dropDatabase has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    void dropDatabase() {
        DBKernel.closeDBConnections(false);
        File f = new File(DBKernel.HSHDB_PATH);
        File[] files = f.listFiles();
        if (files != null) {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this method.
Open

                        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    else return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                            return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    if (doTheUpdates(dbPath)) return loadDBNew(myDBi, dbPath, autoUpdate, openTheGui, beInteractive);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                            return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    else return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    if (doTheUpdates(DBKernel.HSHDB_PATH)) return loadDB(autoUpdate, openTheGui, beInteractive);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                        return mf;
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java - About 30 mins to fix

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open

    private boolean doTheUpdates(String dbPath) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 43 to the 15 allowed.
Open

    private MainFrame loadDBNew(MyDBI myDBi, String dbPath, Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.
Open

    private void startTheDB(Boolean autoUpdate, boolean openTheGui) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open

    private int askVeraltetDBBackup(MyDBI myDBi) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 69 to the 15 allowed.
Open

    private MainFrame loadDB(Boolean autoUpdate, boolean openTheGui, boolean beInteractive) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Define a constant instead of duplicating this literal "Tahoma" 17 times.
Open

        setFont(new Font("Tahoma", Font.PLAIN, 13));

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "1.8.6" 5 times.
Open

            if (DBKernel.softwareVersion.equals("1.8.6")) DBKernel.dbKennung = "pmm";

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Use static access with "java.awt.Frame" for "NORMAL".
Open

            else mf.setExtendedState(JFrame.NORMAL);

In the interest of code clarity, static members of a base class should never be accessed using a derived type's name. Doing so is confusing and could create the illusion that two different static members exist.

Noncompliant Code Example

class Parent {
  public static int counter;
}

class Child extends Parent {
  public Child() {
    Child.counter++;  // Noncompliant
  }
}

Compliant Solution

class Parent {
  public static int counter;
}

class Child extends Parent {
  public Child() {
    Parent.counter++;
  }
}

Use static access with "java.awt.Frame" for "MAXIMIZED_BOTH".
Open

            if (full) mf.setExtendedState(JFrame.MAXIMIZED_BOTH);

In the interest of code clarity, static members of a base class should never be accessed using a derived type's name. Doing so is confusing and could create the illusion that two different static members exist.

Noncompliant Code Example

class Parent {
  public static int counter;
}

class Child extends Parent {
  public Child() {
    Child.counter++;  // Noncompliant
  }
}

Compliant Solution

class Parent {
  public static int counter;
}

class Child extends Parent {
  public Child() {
    Parent.counter++;
  }
}

Define a constant instead of duplicating this literal "LAST_DB_PATH" 3 times.
Open

        String lastDBPath = DBKernel.prefs.get("LAST_DB_PATH", DBKernel.HSHDB_PATH);

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "file.separator" 3 times.
Open

        DBKernel.myDBi = MyDBI.loadDB(textField2.getText() + System.getProperty("file.separator") + DBKernel.dbKennung + ".xml");

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "LAST_USER_LOGIN" 3 times.
Open

        String lastUser = DBKernel.prefs.get("LAST_USER_LOGIN", "");

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Don't try to be smarter than the JVM, remove this call to run the garbage collector.
Open

            System.gc();

Calling System.gc() or Runtime.getRuntime().gc() is a bad idea for a simple reason: there is no way to know exactly what will be done under the hood by the JVM because the behavior will depend on its vendor, version and options:

  • Will the whole application be frozen during the call?
  • Is the -XX:DisableExplicitGC option activated?
  • Will the JVM simply ignore the call?
  • ...

Like for System.gc(), there is no reason to manually call runFinalization() to force the call of finalization methods of any objects pending finalization.

An application relying on these unpredictable methods is also unpredictable and therefore broken. The task of running the garbage collector and calling finalize() methods should be left exclusively to the JVM.

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (result != 0) {
                    String msg = "Login rejected!\n";
                    if (result < 0) msg += "Softwareversion (" + softwareVersion + ") neuer als DB-Version (" + dbVersion + ")???";
                    else msg += "Bitte Software aktualisieren!!!";
                    InfoBox ib = new InfoBox(this, msg, true, new Dimension(600, 120), null, true);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 1 hr to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 283..290

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (result != 0) {
                    String msg = "Login rejected!\n";
                    if (result < 0) msg += "Softwareversion (" + softwareVersion + ") neuer als DB-Version (" + dbVersion + ")???";
                    else msg += "Bitte Software aktualisieren!!!";
                    InfoBox ib = new InfoBox(this, msg, true, new Dimension(600, 120), null, true);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 1 hr to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 640..647

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    private void button1ActionPerformed(final ActionEvent e) {
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File(textField2.getText()));
        chooser.setDialogTitle("Wähle Ordner der Datenbank");
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 1 hr to fix
de.bund.bfr.knime.pmm.bfrdbiface.lib/src/de/bund/bfr/knime/pmm/ui/handlers/SettingsDialog.java on lines 68..80

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 88.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    if (newPassword.length() == 0) { // Passwörter dürfen nicht leer sein!
                        passwordField1.setBackground(Color.WHITE);
                        passwordField2.setBackground(Color.RED);
                        passwordField3.setBackground(Color.RED);
                        passwordField2.requestFocus();
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 40 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 654..660

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    if (newPassword.length() == 0) { // Passwörter dürfen nicht leer sein!
                        passwordField1.setBackground(Color.WHITE);
                        passwordField2.setBackground(Color.RED);
                        passwordField3.setBackground(Color.RED);
                        passwordField2.requestFocus();
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 40 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 297..303

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (dbAlt == JOptionPane.YES_OPTION) {
                    doUpdates = true;
                } else if (dbAlt == JOptionPane.CANCEL_OPTION) {
                    myDBi.closeDBConnections(false);
                    return mf;
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 35 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 272..277

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 44.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                if (dbAlt == JOptionPane.YES_OPTION) {
                    doUpdates = true;
                } else if (dbAlt == JOptionPane.CANCEL_OPTION) {
                    DBKernel.closeDBConnections(false);
                    return mf;
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 35 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 629..634

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 44.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if (rs == null || !rs.first()) {
                    DBKernel.sendRequest("DROP TABLE " + DBKernel.delimitL("CACHE_TS") + " IF EXISTS", true, true);
                }
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 30 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 105..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 42.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if (rs == null || !rs.first()) {
                    DBKernel.sendRequest("DROP TABLE " + DBKernel.delimitL("CACHE_selectEstModel1") + " IF EXISTS", true, true);
                }
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java and 1 other location - About 30 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/Login.java on lines 101..103

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 42.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status