mlaccetti/JavaPNS

View on GitHub
src/main/java/javapns/communication/KeystoreManager.java

Summary

Maintainability
B
6 hrs
Test Coverage

Method verifyKeystoreContent has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  private static void verifyKeystoreContent(final KeyStore keystore) throws KeystoreException {
    try {
      int numberOfCertificates = 0;
      final Enumeration<String> aliases = keystore.aliases();
      while (aliases.hasMoreElements()) {
Severity: Minor
Found in src/main/java/javapns/communication/KeystoreManager.java - About 1 hr 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 verifyKeystoreContent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static void verifyKeystoreContent(final KeyStore keystore) throws KeystoreException {
    try {
      int numberOfCertificates = 0;
      final Enumeration<String> aliases = keystore.aliases();
      while (aliases.hasMoreElements()) {
Severity: Minor
Found in src/main/java/javapns/communication/KeystoreManager.java - About 1 hr to fix

    Method validateKeystoreParameter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      public static void validateKeystoreParameter(Object keystore) throws InvalidKeystoreReferenceException {
        if (keystore == null) {
          throw new InvalidKeystoreReferenceException((Object) null);
        }
        if (keystore instanceof KeyStore) {
    Severity: Minor
    Found in src/main/java/javapns/communication/KeystoreManager.java - About 45 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 wrapKeystoreException has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      static KeystoreException wrapKeystoreException(final Exception e) {
        if (e != null) {
          final String msg = e.toString();
          if (msg.contains("javax.crypto.BadPaddingException")) {
            return new InvalidKeystorePasswordException();
    Severity: Minor
    Found in src/main/java/javapns/communication/KeystoreManager.java - About 45 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 streamKeystore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      static InputStream streamKeystore(final Object keystore) throws InvalidKeystoreReferenceException {
        validateKeystoreParameter(keystore);
        try {
          if (keystore instanceof InputStream) {
            return (InputStream) keystore;
    Severity: Minor
    Found in src/main/java/javapns/communication/KeystoreManager.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;
    Severity: Major
    Found in src/main/java/javapns/communication/KeystoreManager.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return new WrappedKeystore((KeyStore) keystore);
      Severity: Major
      Found in src/main/java/javapns/communication/KeystoreManager.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return (InputStream) keystore;
        Severity: Major
        Found in src/main/java/javapns/communication/KeystoreManager.java - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status