Created attachment 26 [details] Screenshot of Number Format exception occurs when reading TDP data from EXCEL file Environment: 1: Tool: Eclipse IDE for Java Developers [Version: 2019-06 (4.12.0),Build id: 20190614-1200] 2: OS: Mac OS [Version: 10.15.1, 19B88] Problem: When I output the data retrieved from EXCEL file. It shows: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "140.0" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at backend.SpecList.findList(SpecList.java:51) at gui.DIYTab$1.actionPerformed(DIYTab.java:72) After investigation, I found that the developer use "Integer.parseInt()" to convert the TDP data of CPU and VideoCard component from string to Integer. Although it shows a integer when open the EXCEL normally, I found the format of the data cell is "Double". Therefore, it is wrong to use Integer.parseInt(). Step to reproduction: 1: Open PCPicker.java in gui package 2: Select price of different component. 3: Click "Calculate" button I suggest to add exception handler for NumberFormatException, and use Double.parseDouble() to convert the TDP data from String to double.
I found the problem you stated. Although the display format in the excel file for CPU and Video card's TDP field are integer, the excel data loading function provided by poi.XSSFSheet will add a decimal point when it changes the integer data to String. Therefore, if we parse the string to a number value for calculation, we need to parse them to double type instead of integer type. I will follow your suggestion to change the parsing function from Integer.parseint() to Double.parseDouble().
The change is applied. Please test again.
It is glad to hear you reply and solution. Hope it will be fixed shortly. As it really affecting user experience and interrupt normal operation. (In reply to chiwmak2-c from comment #1) > I found the problem you stated. Although the display format in the excel > file for CPU and Video card's TDP field are integer, the excel data loading > function provided by poi.XSSFSheet will add a decimal point when it changes > the integer data to String. Therefore, if we parse the string to a number > value for calculation, we need to parse them to double type instead of > integer type. > I will follow your suggestion to change the parsing function from > Integer.parseint() to Double.parseDouble().