Ticket #7535 (closed: fixed)
Slice viewer crashes when passed a workspace with a text axis
Reported by: | Samuel Jackson | Owned by: | Owen Arnold |
---|---|---|---|
Priority: | major | Milestone: | Release 3.0 |
Component: | GUI | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Jay Rainey |
Description
Slice viewer falls back on the top level error catcher when passed a workspace with a text axis. The attached file can be used to reproduce this bug.
Attachments
Change History
Changed 7 years ago by Samuel Jackson
- Attachment DerivsTest_1.nxs added
comment:2 Changed 7 years ago by Owen Arnold
- Status changed from new to inprogress
refs #7535. TextAxis to return min and max without throwing
This is the route cause of the issue with the SliceViewer described by this ticket. If the Text axis stores first and last entries that are not numeric, then a boost lexical cast exception is generated upon getMin and getMax. The fix is to treat this methods as though they have throw() modifiers. Firstly, attempt to cast the first and last values, but if this fails, then fall-back to default numeric values. Unit tests added to verify this new behaviour. Also introduced fix in MatrixWorkspace, MWDimension, whereby, the getMin, getMax were not calling the equivalent methods on the wrapped Axis type.
Changeset: 1ff327000a834e11a3c0f5793e17512c211deb12
comment:3 Changed 7 years ago by Owen Arnold
Tester, here are some things to test:
- Follow the instructions in the ticket description. You should find that the SliceViewer opens without error. The Y-Axis ranges is 0-1.
- Code review, and check that the new unit tests are passing.
- Try the following code, which demonstrates the fix made to the TextAxis
Load('DerivsTest_1.nxs') mtd.importAll() axis = DerivsTest_1.getAxis(1) print axis.extractValues() # Note that these are non-numeric entries, so should default to 0, and 1 as min/max print axis.getMax() # Should be 1 (default/fall-back) print axis.getMin() # Should be 0 (default/fall-back) # Now change the min and max values to be numeric. axis.setLabel(0, '1') axis.setLabel(2, '2') # These should be reflected in the values obtained. print axis.getMax() print axis.getMin()
comment:4 Changed 7 years ago by Owen Arnold
- Status changed from inprogress to verify
- Resolution set to fixed
comment:5 Changed 7 years ago by Jay Rainey
- Status changed from verify to verifying
- Tester set to Jay Rainey
comment:6 Changed 7 years ago by Jay Rainey
Testing
- Slice viewer no longer crashes when passed a workspace with a text axis.
- All tests pass.
- Tested on Ubuntu 12.04.
Code review
- Well written test.
- Well written explanation of problem in git commit comment.
File which will cause a crash when opened with slice viewer