Since Strings are objects, you are changing a reference and the methods for this currently don’t compile on Spark so they are commented out. I think @mdma has a plan to fix this in the future.
Concatenation does a copy and works every time:
tmp = ""; //optional: use to replace the value
tmp = tmp + message.substring(commaPosition + 1, message.length());