Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 129188

Summary: InlineFlow.setBorder not accepting null argument
Product: [Tools] GEF Reporter: Andrew Eisenberg <ade>
Component: GEF-Legacy Draw2dAssignee: Pratik Shah <ppshah>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: ppshah
Version: 3.1.1   
Target Milestone: 3.4.0 (Ganymede) M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Andrew Eisenberg CLA 2006-02-23 12:14:52 EST
The comment for the method InlineFlow.setBorder says that passing in a null value for the new border is valid.  However the code for that method is:

public void setBorder(Border border) {
  if (border instanceof FlowBorder)
    super.setBorder(border);
  else
    throw new RuntimeException("Border must be an instance of FlowBorder");
}

This code throws an error when passed a null argument.

Is this a bug?  I would really like to remove a border of a TextFlow, but I can't do this as it currently stands.

thanks,
--a
Comment 1 Steven R. Shaw CLA 2006-03-31 15:45:17 EST
sounds like a bug to me...

Depends on what assumptions in the code of InlineFlow depend on FlowBorder existing.

public void setBorder(Border border) {
  if (border == null || border instanceof FlowBorder)
    super.setBorder(border);
  else
    throw new RuntimeException("Border must be an instance of FlowBorder");
}
Comment 2 Steven R. Shaw CLA 2006-04-03 11:31:10 EDT
There are assumptions in the paint routine on the border being a FlowBorder.  If you need to change this assumption, then I suggest you create a subclass of InlineFlow to allow for a null border.  Both paintBorder and setBorder are protected and public methods respectively.
Comment 3 Pratik Shah CLA 2007-12-07 22:49:10 EST
Reopening.  You should be able to set the border to null.
Comment 4 Pratik Shah CLA 2008-01-08 13:23:57 EST
Committed the fix in comment 1.  Marking as fixed.