Java - HtmlUnit - Unable to save HTML to file (in some cases)

Posted by Walter White on Stack Overflow See other posts from Stack Overflow or by Walter White
Published on 2010-04-22T15:18:52Z Indexed on 2010/04/28 22:37 UTC
Read the original article Hit count: 736

Filed under:
|
|

Hi all,

I am having intermittent issues saving the response HTML in HtmlUnit.

Caused by: java.io.IOException: Unable to save file:C:\ccview\PP50773_4.0_walter\TSC_hca\Applications\HCA_J2EE\HCA\target\HtmlUnitTests\single\1\com\pnc\tsc\hca\ui\test\SiteCrawler\crawlSiteAsProvider\10.SiteCrawler.crawl.html
    at com.pnc.tsc.hca.ui.util.GetUtil.save(GetUtil.java:128)
    at com.pnc.tsc.hca.ui.util.GetUtil.add(GetUtil.java:75)
    at com.pnc.tsc.hca.ui.util.GetUtil.click(GetUtil.java:49)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:87)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:61)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:63)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:63)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:63)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawl(SiteCrawler.java:54)
    at com.pnc.tsc.hca.ui.test.SiteCrawler.crawlSiteAsProvider(SiteCrawler.java:50)
    ... 15 more
Caused by: java.lang.RuntimeException: java.io.IOException: The system cannot find the path specified
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.getAttributesFor(XmlSerializer.java:165)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.printOpeningTag(XmlSerializer.java:126)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:83)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:93)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.printXml(XmlSerializer.java:93)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.asXml(XmlSerializer.java:73)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.save(XmlSerializer.java:55)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.save(HtmlPage.java:2259)
    at com.pnc.tsc.hca.ui.util.GetUtil.save(GetUtil.java:126)
    ... 24 more
Caused by: java.io.IOException: The system cannot find the path specified
    at java.io.WinNTFileSystem.createFileExclusively(Native Method)
    at java.io.File.createNewFile(File.java:883)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.createFile(XmlSerializer.java:216)
    at com.gargoylesoftware.htmlunit.html.XmlSerializer.getAttributesFor(XmlSerializer.java:160)
    ... 32 more

Now, the parent directory exists and some other files have already been written to the directory. Looking at the filename, I don't see anything that would stand out as a red flag indicating the filename is bad.

What can I do to correct this error?

Thanks,

Walter

© Stack Overflow or respective owner

Related posts about java

Related posts about htmlunit