Project

General

Profile

Bug #2084

Error messages containing PVL keyword names may not contain the correct name

Added by Jean Backer over 3 years ago. Updated 15 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
API
Target version:
Impact:

Minimal - A unit test was added.

Software Version:
Test Reviewer:

Description

PvlKeyword::operator[] has an error message that passes the m_name variable (of type char*) into a toString() method.
There is no implementation for toString(char*) so this call is being interpreted as toString(bool) and always returning the string "Yes" as the keyword name. Since the compiler sees the char* as equivalent to bool, implementing an overloaded toString(char*) method may cause a conflict.

This use of the toString(bool) method causes a confusing error message for the user when the index passed into PvlKeyword::operator[] goes out of bounds. As a temporary fix, I have changed the error message to use the QString(char*) constructor instead of toString().

History

#1 Updated by Jean Backer over 3 years ago

  • Description updated (diff)

#2 Updated by Tammy Becker over 3 years ago

  • Status changed from New to Acknowledged

This issue results in incorrect error messages to the user. Applications will be added to this post.

#3 Updated by Stuart Sides over 3 years ago

  • Subject changed from We do not have a method to convert char* to a QString (in IString) to Error messages containing PVL keyword names may not contain the correct name

The conversion from a char* to a string is using the toString(bool). This produces a "Yes" when it should produce the keyword name. Add a member to iString to with the correct signuture for char*

#4 Updated by Stuart Sides over 3 years ago

  • Target version set to 3.4.7 (2014-08-27 Aug)

#7 Updated by Stuart Sides over 3 years ago

  • Target version changed from 3.4.7 (2014-08-27 Aug) to 159

#13 Updated by Stuart Sides about 3 years ago

  • Target version deleted (159)

#17 Updated by Kristin Berry over 2 years ago

  • Target version set to 3.4.11 (FY16 R1 2015-10-28 Oct)

#18 Updated by Stuart Sides 2 months ago

  • Target version deleted (3.4.11 (FY16 R1 2015-10-28 Oct))

#19 Updated by Stuart Sides 18 days ago

  • Status changed from Acknowledged to Assigned
  • Assignee set to Adam Goins
  • Target version set to 3.5.2 (2017-01-31 Jan)

#20 Updated by Adam Goins 15 days ago

  • Status changed from Assigned to In Progress

#21 Updated by Adam Goins 15 days ago

  • Status changed from In Progress to Resolved
  • Impact updated (diff)

Jeannie's quickfix to wrap the m_name (of type char*) in a QString constructor does make the Pvl error message display the correct keyword.
Seeing how we don't use IString anymore and have migrated to QString, would that make Jeannie's initial quickfix a viable fix for this ticket?

The documentation for PvlKeyword::operator[] reflected the return being an IString still, it was changed to reflect a QString appropriately.

I've added a unitTest in PvlKeyword to check the IndexOutOfBoundsException and display the error message shown, and it does correctly display the keyword name in the error message.
This output was written to PvlKeyword.truth (as the only new truthdata is an additional line of output that displayed the correct error message with the correct keyword name).

These changes can be found in the work area under /work/project/isis/latest/m02084.

Also available in: Atom PDF