Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1102

JsLibraray.java has a bug

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1-BETA1
    • Component/s: Java
    • Labels:
      None

      Description

      I downloaded the latest shindig. I tried to create a sample feature called sample-0.1 which has two files namely feature.xml and sample.js.
      I when I tried to use that feature in a gadget, I found that the javascript for that feature is not getting injected into the gadget.

      I found the that the bug is in JsLibrary.java. It has a create() method which is responsible for getting the javasript library from the
      required resource/location. If the feature does not have a *.opt.js file, then the javascript content returned was null. This was because one if statement
      was missing in the method. Please find below the modified create() method.

      public static JsLibrary create(Type type, String content, String feature,
      HttpFetcher fetcher) throws GadgetException {
      String optimizedContent = null;
      String debugContent;
      switch (type) {
      case FILE:
      case RESOURCE:
      StringBuffer opt = new StringBuffer();
      StringBuffer dbg = new StringBuffer();
      loadOptimizedAndDebugData(content, type, opt, dbg);
      optimizedContent = opt.toString();
      debugContent = dbg.toString();

      /*

      • the foolowing conditional statements are to be added to check wheter optimizedContent =null
        */

      if(optimizedContent == null)

      { optimizedContent = debugContent; }
      else if(optimizedContent.equalsIgnoreCase("null")) { // this is because null was returned as a String optimizedContent = debugContent; }
      else if(optimizedContent.length() == 0) { optimizedContent = debugContent; }

      break;
      case URL:
      if (fetcher == null)

      { debugContent = optimizedContent = content; }

      else

      { type = Type.FILE; debugContent = optimizedContent = loadDataFromUrl(content, fetcher); }

      break;
      default:
      debugContent = content;
      optimizedContent = content;
      break;
      }
      return new JsLibrary(feature, type, optimizedContent, debugContent);
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vinuret Vinu Neelambaran
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified