* @param task the task that was performed
* @return an entry containing the computed results
* @throws AnalysisException if the results could not be recorded
*/
private HtmlEntry recordResolveHtmlTaskResults(ResolveHtmlTask task) throws AnalysisException {
Source source = task.getSource();
AnalysisException thrownException = task.getException();
HtmlEntry htmlEntry = null;
synchronized (cacheLock) {
SourceEntry sourceEntry = cache.get(source);
if (sourceEntry == null) {
throw new ObsoleteSourceAnalysisException(source);
} else if (!(sourceEntry instanceof HtmlEntry)) {
// This shouldn't be possible because we should never have performed the task if the source
// didn't represent an HTML file, but check to be safe.
throw new AnalysisException(
"Internal error: attempting to resolve non-HTML file as an HTML file: "
+ source.getFullName());
}
htmlEntry = (HtmlEntry) sourceEntry;
long sourceTime = getModificationStamp(source);
long resultTime = task.getModificationTime();
if (sourceTime == resultTime) {
if (htmlEntry.getModificationTime() != sourceTime) {
// The source has changed without the context being notified. Simulate notification.
sourceChanged(source);
htmlEntry = getReadableHtmlEntry(source);
if (htmlEntry == null) {
throw new AnalysisException("An HTML file became a non-HTML file: "
+ source.getFullName());
}
}
HtmlEntryImpl htmlCopy = htmlEntry.getWritableCopy();
if (thrownException == null) {
htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED);