我在我的代碼中遇到IllegalMonitorStateException,我不知道爲什麼我收到它以及如何修復它。我當前的代碼是和錯誤是發生在try塊:如何解決IllegalMonitorStateException
public static String scrapeWebsite() throws IOException {
final WebClient webClient = new WebClient();
final HtmlPage page = webClient.getPage(s);
final HtmlForm form = page.getForms().get(0);
final HtmlSubmitInput button = form.getInputByValue(">");
final HtmlPage page2 = button.click();
try {
page2.wait(1);
}
catch(InterruptedException e)
{
System.out.println("error");
}
String originalHtml = page2.refresh().getWebResponse().getContentAsString();
return originalHtml;
}
}
堆棧跟蹤請。 –