'CredentialProviderFactory - conf.getPassword from jceks file breaks if the password contains a $

I am trying to extract the password from jceks file in hdfs.

import org.apache.hadoop.security.alias.CredentialProviderFactory


val conf =
new org.apache.hadoop.conf.Configuration ()
val alias = "aliasnm"

val jceksPath="jceks://hdfs/path/rfddtsdtest.jceks"

conf.set (Credential Provider Factory.CREDENTIAL_PROVIDER_PATH, jceksPath)
//getPassword Returns Array [Char]
val password = conf.getPassword (aliasnm).mkString

When the password in the jceks file does not contain a $ , the returned value is as expected.However , If the password contains a $ , like for Example, abc$def , the returned value is abc.

Can anyone let me know why is this happening.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source