出现错误 - 线程 "AWT-EventQueue-0" java.lang.IllegalArgumentException 中出现异常:文本不能为 null 或为空

Getting error - Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: text cannot be null or empty

正在尝试使用文本区域将字符串发送到 IBM Watson。

可以通过硬编码字符串来做到这一点。我希望能够在 JTextArea 中输入我自己的文本。

像这样在 actionPerformed 方法中移动 String text = textArea.getText();

public void actionPerformed(ActionEvent e) {
            String text = textArea.getText();
            Profile profile = service.getProfile(text).execute();  
            System.out.println(profile);


                }