I was working an issue where password is getting stored in java process memory since the password is stored in a String (hence getting stored in string pool). I made code changes to use char[]. Now the issue is, my application is consuming another service via POST CALL and while setting:
conn.setRequestProperty(key, headers.get(key));
I must convert the char[] to string and thereby creating an entry in string pool. So is there a way to handle this issue, i.e., no matter what the password should not get stored in process memory or in the worst case, any ways to minimize its living duration in the string pool.