svgsalamander
  1. svgsalamander
  2. SVGSALAMANDER-9

Exception thrown when get style returns true for attribute with none value

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Hi There,

      On loading the attached svg I got multiple MalformedURL exceptions complaining about urls ending in "none".
      I trace this to the following code in Shapeelement:

      Marker markerStart = null;
      if (getStyle(styleAttrib.setName("marker-start")))

      { URI uri = styleAttrib.getURIValue(getXMLBase()); markerStart = (Marker) diagram.getUniverse().getElement(uri); }

      which I modified to this to work around:

      Marker markerStart = null;
      if (getStyle(styleAttrib.setName("marker-start"))) {
      if (!styleAttrib.getStringValue().equals("none"))

      { //<<<<<<<<<<<< ADDED URI uri = styleAttrib.getURIValue(getXMLBase()); markerStart = (Marker) diagram.getUniverse().getElement(uri); }

      //<<<<<<<<<<<< ADDED
      }

      I then wondered if getStyle should be returning true for attributes with value "none"?

      I then wondered whether the following change was required to SVGElement.getStyle()...

      public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException
      {
      String styName = attrib.getName();

      //Check for local inline styles
      StyleAttribute styAttr = (StyleAttribute)inlineStyles.get(styName);

      attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue());

      //Evalutate coresponding track, if one exists
      TrackBase track = trackManager.getTrack(styName, AnimationElement.AT_CSS);
      if (track != null)

      { track.getValue(attrib, diagram.getUniverse().getCurTime()); return true; }

      //Return if we've found a non animated style
      if (styAttr != null) return (!styAttr.getStringValue().equalsIgnoreCase("none")); <<<< instead of just returning true

      Cheers,

      Jason

        Activity

        Hide
        kitfox added a comment -

        Bug fix has been added.

        Show
        kitfox added a comment - Bug fix has been added.

          People

          • Assignee:
            Unassigned
            Reporter:
            wjase
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: