Assigning a TextComponent object differently based on try catch

I’m trying to take a String kd and either assign it to a TextComponent object, or if the string can be parsed into a Double value then assign it to a TextComponent using a DecimalFormat object. I …