Skip to content

Contents of StringBuilder variable is updated by never used. #149

@dbmalkovsky

Description

@dbmalkovsky

This commit c0b3b52 added this block of code to org.crosswire.jsword.book.sword.RawLDBackend starting around line 442:

            if (keytitle.charAt(1) == '0') {
                char type = keytitle.charAt(0);
                // NASB has trailing letters!
                int pos = keytitle.length() - 1;
                char lastLetter = keytitle.charAt(pos);
                boolean hasTrailingLetter = Character.isLetter(lastLetter);
                if (hasTrailingLetter) {
                    keytitle = keytitle.substring(0, pos);
                    // And it might be preceded by a !
                    pos--;
                    if (pos > 0 && keytitle.charAt(pos) == '!') {
                        keytitle = keytitle.substring(0, pos);
                    }
                }
                // Get the number after the G or H
                int strongsNumber = Integer.parseInt(keytitle.substring(1));
                // The convention is that a Strong's dictionary with both Greek
                // and Hebrew have G or H prefix
                StringBuilder buf = new StringBuilder();
                buf.append(type);
                buf.append(strongsNumber);

                // The NAS lexicon has some entries that end in A-Z, but it is
                // not preceded by a !
                if (hasTrailingLetter && "naslex".equalsIgnoreCase(bmd.getInitials())) {
                    buf.append(lastLetter);
                }
            }

The code creates a StrinbBuilder variable, buf, which is manipulated and then not used as the if block just ends. This doesn't seem correct and I am not sure as to what is really needed here to correct the code. Any one have any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions