hackedteam/core-blackberry

View on GitHub
InjectionFramework/src/blackberry/utils/Utils.java

Summary

Maintainability
F
1 wk
Test Coverage

File Utils.java has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//#preprocess
/* *************************************************
 * Copyright (c) 2010 - 2010
 * HT srl,   All rights reserved.
 * Project      : RCS, RCSBlackBerry_lib
Severity: Minor
Found in InjectionFramework/src/blackberry/utils/Utils.java - About 6 hrs to fix

    Utils has 45 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public final class Utils {
    
        /** The debug instance. */
        //#ifdef DEBUG
        private static Debug debug = new Debug("Utils", DebugLevel.INFORMATION);
    Severity: Minor
    Found in InjectionFramework/src/blackberry/utils/Utils.java - About 6 hrs to fix

      Method Tokenize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public static Vector Tokenize(final String fullCommand,
                  final String separators) {
              int pos = 0;
              final Vector vector = new Vector();
      
      
      Severity: Minor
      Found in InjectionFramework/src/blackberry/utils/Utils.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 Tokenize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static Vector Tokenize(final String fullCommand,
                  final String separators) {
              int pos = 0;
              final Vector vector = new Vector();
      
      
      Severity: Minor
      Found in InjectionFramework/src/blackberry/utils/Utils.java - About 1 hr to fix

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

            public static String byteArrayToHex(final byte[] data, final int offset,
                    final int length) {
                final StringBuffer buf = new StringBuffer();
                for (int i = offset; i < offset + length; i++) {
                    int halfbyte = (data[i] >>> 4) & 0x0F;
        Severity: Minor
        Found in InjectionFramework/src/blackberry/utils/Utils.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 equals has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static boolean equals(final byte[] first, final int offsetFirst,
                    final byte[] second, final int offsetSecond, int len) {
        Severity: Minor
        Found in InjectionFramework/src/blackberry/utils/Utils.java - About 35 mins to fix

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

              public static void copy(final byte[] dest, final int offsetDest,
                      final byte[] src, final int offsetSrc, final int len) {
          Severity: Minor
          Found in InjectionFramework/src/blackberry/utils/Utils.java - About 35 mins to fix

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

                public static Vector Tokenize(final String fullCommand,
                        final String separators) {
                    int pos = 0;
                    final Vector vector = new Vector();
            
            
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 3 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 721..755

            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 221.

            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

                public static byte[] hexStringToByteArray(final String wchar) {
                    //#ifdef DBC
                    Check.requires(wchar.length() % 2 == 0, "Odd input");
                    //#endif
                    final byte[] ret = new byte[wchar.length() / 2];
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 547..569

            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 168.

            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 3 locations. Consider refactoring.
            Open

                public static String byteArrayToHex(final byte[] data, final int offset,
                        final int length) {
                    final StringBuffer buf = new StringBuffer();
                    for (int i = offset; i < offset + length; i++) {
                        int halfbyte = (data[i] >>> 4) & 0x0F;
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 2 other locations - About 2 hrs to fix
            BBMInjectDemo/src/com/rim/samples/device/bbminjectdemo/Utils.java on lines 23..39
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 104..120

            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 164.

            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

                public static byte[] hexStringToByteArray(final String wchar, int offset,
                        int len) {
            
                    final byte[] ret = new byte[len / 2];
            
            
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 516..538

            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 160.

            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

                public static byte[] hexToByteArray(final String data, final int offset,
                        final int length) {
            
                    //#ifdef DBC
                    Check.requires(length % 2 == 0, "HexToByteArray parity");
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 122..146

            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 158.

            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

                public static boolean equals(final byte[] first, final int offsetFirst,
                        final byte[] second, final int offsetSecond, int len) {
            
                    //#ifdef DBC
                    Check.requires(first != null, "first null");
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 303..332

            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 158.

            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

                public static int crc(final byte[] buffer, final int start, final int len) {
                    // CRC
                    int confHash;
                    long tempHash = 0;
            
            
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 367..395

            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 156.

            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

                public static String unspace(String string) {
                    //#ifdef DBC
                    Check.requires(string != null, "Unspace: null string"); //$NON-NLS-1$
                    //#endif
                    if (string == null) {
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 2 hrs to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 886..909

            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 144.

            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

                public static String Unspace(String string) {
                    //#ifdef DBC
                    Check.requires(string != null, "Unspace: null string");
                    //#endif
            
            
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 775..795

            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 122.

            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

                public static int getIndex(final char[] buffer, final String message) {
                    final char[] token = new char[message.length()];
            
                    message.getChars(0, message.length(), token, 0);
            
            
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 477..492

            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 101.

            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

                public static void copy(final byte[] dest, final int offsetDest,
                        final byte[] src, final int offsetSrc, final int len) {
                    //#ifdef DBC
                    Check.requires(dest.length >= offsetDest + len, "wrong dest len");
                    Check.requires(src.length >= offsetSrc + len, "wrong src len");
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 253..263

            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 92.

            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

                public static Vector splitString(String original, final String separators) {
                    final Vector nodes = new Vector();
                    // Parse nodes into vector
                    int index = original.indexOf(separators);
                    while (index >= 0) {
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 684..697

            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 91.

            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 4 locations. Consider refactoring.
            Open

                public static int byteArrayToInt(final byte[] buffer, final int offset) {
            
                    //#ifdef DBC
                    Check.requires(buffer.length >= offset + 4, "short buffer");
                    //#endif
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 3 other locations - About 1 hr to fix
            InjectionFramework/src/blackberry/utils/Utils.java on lines 189..208
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 157..176
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 187..206

            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 83.

            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 4 locations. Consider refactoring.
            Open

                public static long byteArrayToLong(final byte[] buffer, final int offset) {
            
                    //#ifdef DBC
                    Check.requires(buffer.length >= offset + 8, "short buffer");
                    //#endif
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 3 other locations - About 1 hr to fix
            InjectionFramework/src/blackberry/utils/Utils.java on lines 159..178
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 157..176
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 187..206

            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 83.

            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

                public static boolean isZip(byte[] core) {
            
                    if (core.length >= 4) {
                        // zip files start with PK followed by 0x03 and 0x04
                        if (core[0] == 0x50 && core[1] == 0x4B && core[2] == 0x03
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 825..836

            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 74.

            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

                public static int getIndex(final byte[] buffer, final byte[] token) {
                    int pos = -1;
            
                    for (int i = 0; i < buffer.length; i++) {
                        if (Arrays.equals(buffer, i, token, 0, token.length)) {
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 455..466

            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 71.

            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

                public static int hex(final char c) {
                    final int ret = (char) ((c) <= '9' ? (c) - '0'
                            : (c) <= 'F' ? (c) - 'A' + 0xA : (c) - 'a' + 0xA);
                    return ret;
                }
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 1 hr to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 510..514

            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 70.

            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 4 locations. Consider refactoring.
            Open

                public static byte[] charArrayToByteArray(final char[] message) {
                    final byte[] payload = new byte[message.length];
            
                    for (int i = 0; i < message.length; i++) {
                        payload[i] = (byte) (message[i] & 0xFF);
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 3 other locations - About 1 hr to fix
            InjectionFramework/src/blackberry/utils/Utils.java on lines 73..81
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 71..79
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 215..223

            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 68.

            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 4 locations. Consider refactoring.
            Open

                public static char[] byteArrayToCharArray(final byte[] message) {
                    final char[] payload = new char[message.length];
            
                    for (int i = 0; i < message.length; i++) {
                        payload[i] = (char) (message[i] & 0xFF);
            Severity: Major
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 3 other locations - About 1 hr to fix
            InjectionFramework/src/blackberry/utils/Utils.java on lines 217..225
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 71..79
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 215..223

            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 68.

            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

                public static String chomp(String sd, String c) {
                    if (sd == null) {
                        return null;
                    }
                    if (sd.length() == 0) {
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 55 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 811..823

            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 67.

            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

                public static byte[] longToByteArray(final long value) {
                    final byte[] result = new byte[8];
                    final DataBuffer databuffer = new DataBuffer(result, 0, 8, false);
                    databuffer.writeLong(value);
                    //#ifdef DBC
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 55 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 638..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 66.

            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

                public static byte[] padByteArray(final byte[] byteAddress, final int len) {
                    final byte[] padAddress = new byte[len];
                    Utils.copy(padAddress, byteAddress, Math.min(len, byteAddress.length));
            
                    //#ifdef DBC
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 55 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 710..719

            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 63.

            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

                public static String joinString(final Vector nodes) {
                    final StringBuffer sb = new StringBuffer();
                    final int nsize = nodes.size();
                    for (int i = 0; i < nsize; i++) {
                        sb.append((String) nodes.elementAt(i));
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 50 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 622..629

            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 62.

            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

                public static String firstWord(String string) {
                    string = string.trim();
                    int firstSpace = string.indexOf(" ");
                    if (firstSpace == -1) {
                        return string;
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 45 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 838..846

            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 56.

            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

                public static byte[] concat(final byte[] first, final int lenFirst,
                        final byte[] second, final int lenSecond) {
            
                    final byte[] sum = new byte[lenFirst + lenSecond];
                    copy(sum, 0, first, 0, lenFirst);
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 45 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 279..286

            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 55.

            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

                public static boolean equals(final byte[] first, final byte[] second) {
            
                    final int l1 = first.length;
                    final int l2 = second.length;
                    if (l1 != l2) {
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 45 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 334..343

            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 53.

            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

                public static int hex(int value) {
                    try {
                        return Integer.parseInt(Integer.toHexString(value));
                    } catch (NumberFormatException e) {
                        //#ifdef DEBUG
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 35 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 41..51

            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

                public static byte[] intToByteArray(final int value) {
                    final byte[] result = new byte[4];
                    final DataBuffer databuffer = new DataBuffer(result, 0, 4, false);
                    databuffer.writeInt(value);
                    return result;
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 35 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 597..602

            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

                public static char ascii(final int c) {
                    return (char) ((c) <= 9 ? (c) + '0' : (c) + 'A' - 0xA);
                }
            Severity: Minor
            Found in InjectionFramework/src/blackberry/utils/Utils.java and 1 other location - About 30 mins to fix
            RCSBlackBerry/src/blackberry/utils/Utils.java on lines 60..62

            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 40.

            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