You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2023/09/06 13:46:00 UTC

[jira] [Comment Edited] (DAFFODIL-2834) Fix NumberformatException message in hexCharToValue

    [ https://issues.apache.org/jira/browse/DAFFODIL-2834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17762395#comment-17762395 ] 

Dave Thompson edited comment on DAFFODIL-2834 at 9/6/23 1:45 PM:
-----------------------------------------------------------------

Verified the specified commit (commit a7ca576b0ab299559386270b4a66bc03a38fb252) is included in the latest pull from the daffodil repository.

Verified, via review, changes identified in the commit comment were implemented. 

Verified the affected daffodil subproject sbt test suites executed successfully.

However, found that test testHex2BytesValid has duplicate tests. Has 2 tests "assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))". First instance should check uppercase "A"

  @Test def testHex2BytesValid(): Unit = {

    assertArrayEquals(Array(0).map(_.toByte), Misc.hex2Bytes("00"))

    assertArrayEquals(Array(9).map(_.toByte), Misc.hex2Bytes("09"))

    assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))     Should check Misc.hex2Bytes("0A")

    assertArrayEquals(Array(15).map(_.toByte), Misc.hex2Bytes("0F"))

    assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))

    assertArrayEquals(Array(15).map(_.toByte), Misc.hex2Bytes("0f"))

    assertArrayEquals(Array(171).map(_.toByte), Misc.hex2Bytes("Ab"))

  }

 


was (Author: dfthompson):
Verified the specified commit (commit a7ca576b0ab299559386270b4a66bc03a38fb252) is included in the latest pull from the daffodil repository.

Verified, via review, changes identified in the commit comment were implemented. 

Verified the affected daffodil subproject sbt test suites executed successfully.

However, found that test testHex2BytesValid has duplicate tests. Has 2 tests "assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))". First instance should check uppercase "A"

  @Test def testHex2BytesValid(): Unit = {
    assertArrayEquals(Array(0).map(_.toByte), Misc.hex2Bytes("00"))
    assertArrayEquals(Array(9).map(_.toByte), Misc.hex2Bytes("09"))
    assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))     Should check Misc.hex2Bytes("0A")
    assertArrayEquals(Array(15).map(_.toByte), Misc.hex2Bytes("0F"))
    assertArrayEquals(Array(10).map(_.toByte), Misc.hex2Bytes("0a"))
    assertArrayEquals(Array(15).map(_.toByte), Misc.hex2Bytes("0f"))
    assertArrayEquals(Array(171).map(_.toByte), Misc.hex2Bytes("Ab"))
  }

 

> Fix NumberformatException message in hexCharToValue
> ---------------------------------------------------
>
>                 Key: DAFFODIL-2834
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2834
>             Project: Daffodil
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 3.5.0
>            Reporter: Peter Katlic
>            Assignee: Peter Katlic
>            Priority: Trivial
>             Fix For: 3.5.1
>
>
> The Misc.hex2Bytes function makes use of the hexCharToValue function, which limits character values to the numbers 0-9, capital A-F, and lowercase a-f. However, the NumberFormatException thrown for values outside of this range has the message "Hex character must be 0-9, a-z, or A-Z, but was ". This should be "Hex character must be 0-9, a-f, or A-F, but was ".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)