JSword
  1. JSword
  2. JS-233

JSword does not correctly identify Red letter text modules

    Details

    • Type: Bug Bug
    • Status: Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      http://www.crosswire.org/wiki/DevTools:conf_Files specifies that the feature is only present in a GlobalOptionFilter

      The filter option is called OSISRedLetterWords but JSword has it coded as <prefix>RedLetterText

      This requires a change

        Activity

        Hide
        DM Smith added a comment -

        I'm not seeing this. In ConfigEntryType it is listed as OSISRedLetterWords.

        Show
        DM Smith added a comment - I'm not seeing this. In ConfigEntryType it is listed as OSISRedLetterWords.
        Hide
        Chris Burrell added a comment -

        In org.crosswire.jsword.book.FeatureType it is listed as RedLetterText

        Diff of the change is below (also in pull request - I don't seem to just be able to publish that one commit however... )

        — a/src/main/java/org/crosswire/jsword/book/FeatureType.java
        +++ b/src/main/java/org/crosswire/jsword/book/FeatureType.java
        @@ -79,7 +79,7 @@ public enum FeatureType {
        /**

        • The book marks the Word's of Christ
          */
        • WORDS_OF_CHRIST ("RedLetterText"),
          + WORDS_OF_CHRIST ("RedLetterWords"),

        /**

        • The book contains Morphology info
        Show
        Chris Burrell added a comment - In org.crosswire.jsword.book.FeatureType it is listed as RedLetterText Diff of the change is below (also in pull request - I don't seem to just be able to publish that one commit however... ) — a/src/main/java/org/crosswire/jsword/book/FeatureType.java +++ b/src/main/java/org/crosswire/jsword/book/FeatureType.java @@ -79,7 +79,7 @@ public enum FeatureType { /** The book marks the Word's of Christ */ WORDS_OF_CHRIST ("RedLetterText"), + WORDS_OF_CHRIST ("RedLetterWords"), /** The book contains Morphology info
        Hide
        Chris Burrell added a comment -

        The code that enacts the behaviour is here:

        @Override
        public boolean hasFeature(FeatureType feature) {
        if (cet.match(ConfigEntryType.FEATURE, feature.toString()))

        { return true; }
        // Many "features" are GlobalOptionFilters, which in the Sword C++ API
        // indicate a class to use for filtering.
        // These mostly have the source type prepended to the feature
        StringBuilder buffer = new StringBuilder((String) getProperty(ConfigEntryType.SOURCE_TYPE));
        buffer.append(feature);
        if (cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString())) { return true; }

        // But some do not
        return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, feature.toString());
        }

        feature.toString() is used,

        • first as a direct look up in the FEATURES enum ,
        • then it is appended by its source type (our case), i.e. OSISRedLetterText/Words against the GlobalOptionFilter
        • then it is looked up against the GlobalOptionFilter without its source type

        There was a simple mismatch between the name of the feature type and the name in the ConfigEntry

        Show
        Chris Burrell added a comment - The code that enacts the behaviour is here: @Override public boolean hasFeature(FeatureType feature) { if (cet.match(ConfigEntryType.FEATURE, feature.toString())) { return true; } // Many "features" are GlobalOptionFilters, which in the Sword C++ API // indicate a class to use for filtering. // These mostly have the source type prepended to the feature StringBuilder buffer = new StringBuilder((String) getProperty(ConfigEntryType.SOURCE_TYPE)); buffer.append(feature); if (cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString())) { return true; } // But some do not return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, feature.toString()); } feature.toString() is used, first as a direct look up in the FEATURES enum , then it is appended by its source type (our case), i.e. OSISRedLetterText/Words against the GlobalOptionFilter then it is looked up against the GlobalOptionFilter without its source type There was a simple mismatch between the name of the feature type and the name in the ConfigEntry
        Hide
        Chris Burrell added a comment -

        This has been pulled in and can be resolved: https://github.com/crosswire/jsword/pull/12

        Show
        Chris Burrell added a comment - This has been pulled in and can be resolved: https://github.com/crosswire/jsword/pull/12
        Hide
        Chris Burrell added a comment -

        Now in the main build.

        Show
        Chris Burrell added a comment - Now in the main build.

          People

          • Assignee:
            DM Smith
            Reporter:
            Chris Burrell
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: