Change decode function to use try/catch instead of ordinal comparison to avoid extra branch with hotspot.