Laura Laura - 4 years ago 115
Java Question

Number Format Error in Java

I would appreciate any help I can get in terms of this topic. In this code:

else if (SQL_error.getErrorCode() == 04088)
{
JOptionPane.showMessageDialog(null, "Error during execution of trigger. Contact administrator. The data logic is faulty. Please recheck logic.", "Error Message", JOptionPane.ERROR_MESSAGE);
//System.out.println("The data logic is faulty. Please recheck logic.");
}


I keep on getting an error message when I hover over 04088. It says: "Number format error." Does anyone have any experience with this issue? I only find string to number conversions.

Answer Source

I got the answer. Octals are used for representing file permissions on Unix systems. This is one of the reasons why Java uses octal numbers (apart from getting it derived from C). Now, back to the question, 04088 is an octal number. In order to be able to use it (even hard-coding it in Java did not help), you have to transform it into a floating point number. Therefore, when you use 04088, you have to put it as 04088F.

                        else if (SQL_error.getErrorCode() == 04088F) 
                    {
                        System.out.println("" + (String.valueOf(SQL_error.getErrorCode() == 04088F)));
                        JOptionPane.showMessageDialog(null, "Error during execution of trigger. Contact administrator. The data logic is faulty. Please recheck logic.", "Error Message", JOptionPane.ERROR_MESSAGE);
                        //System.out.println("The data logic is faulty. Please recheck logic.");
                    }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download