0
votes

I am trying to convert the hex value (coming as part of content of the flowfile) 2c0f19d10da4e92896faf7a92ce26f94d2fe91acdc2a69730731613f7c094a36 using fromRadix() EL in UpdateRecord processor. Below is the code I have used

${field.value:isEmpty():not():ifElse('${field.value:fromRadix(16)}','${literal("")}')}

But am getting error, "will route to failure: For input String "2c0f19d10da4e92896faf7a92ce26f94d2fe91acdc2a69730731613f7c094a36"

I tried it through Groovy with the below code, it is working fine.

def data1 = '2c0f19d10da4e92896faf7a92ce26f94d2fe91acdc2a69730731613f7c094a36'
BigInteger x = new BigInteger(data1,16)
println "original output: " + x

Output is coming as
original output: 19928446223359820201840237302010524452213876686816802601399388669528806869558

Would like to know what is wrong with my UpdateRecord processor code using fromRadix(16)

1
That hex-string looks like some kind of encoded data, and is probably not really something you should treat as an actual number. - Some programmer dude
To know what is wrong you have to show full error. If you can't see it on screen then look into log file. - daggett

1 Answers

0
votes

I ran into something very similar, it seems like the NiFi expression language throws an error when the input value (hex in this case) is a big string. Instead of this "2c0f19d10da4e92896faf7a92ce26f94d2fe91acdc2a69730731613f7c094a36" try running it for "2c0f19d10da" (subtring of your input) and it works.