线程“AWT-EventQueue-0”中的异常java.lang.NumberFormatException:

时间:2017-04-14 19:43:47

标签: java swing numberformatexception

User: arn:aws:sts::XXXXXXXXXXX:assumed-role/lambda_basic_dynamo/MyApp is not authorized to perform: dynamodb:GetItem on resource: arn:aws:dynamodb:us-east-1:XXXXXXXXX:table/McCannHealth"

错误是:

public void chooseInterface() {

    int TEMP = Integer.parseInt(SelectInterface.getText());

    if (TEMP > -1 && TEMP < counter) {
        index = 0;
        Enable();
    } else {
        // JOptionPane.showMessageDialog(null, Outside of
        // Range.#interface=0+
        // (counter-1)+".");
        System.out.print("dfdfg");
    }
    SelectInterface.setText("");
}

代码中有什么问题?如何解决这个错误?

1 个答案:

答案 0 :(得分:1)

检查

的空(&#34;&#34;)值
  

SelectInterface.getText()

这将给出NumberFormatException。此外,您可以先检查空值并替换为&#34; 0&#34;。