Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not generate HTML output (XPathException) [4.0.0 beta 4] #1025

Closed
grrosminet opened this issue Oct 17, 2019 · 11 comments · Fixed by #1112
Closed

Could not generate HTML output (XPathException) [4.0.0 beta 4] #1025

grrosminet opened this issue Oct 17, 2019 · 11 comments · Fixed by #1112
Assignees
Labels

Comments

@grrosminet
Copy link

Hi,

I tried 4.0.0-beta-4 with same parameters I'm using for 3.1.12 and got this error at the end of analysis :

The following errors occurred during analysis:
Could not generate HTML output
net.sf.saxon.trans.XPathException: A sequence of more than one item is not allowed as the @select attribute of xsl:sort (@classname="infass.util.base.data.IRecord", @classname="infass.util.importation.mapper.MapperRecord", @cl
assname="infass.util.base.data.FlatIRecord", ...)
At net.sf.saxon.expr.Expression.typeError(Expression.java:1464)
At net.sf.saxon.expr.SingletonAtomizer.evaluateItem(SingletonAtomizer.java:221)
At net.sf.saxon.expr.SingletonAtomizer.evaluateItem(SingletonAtomizer.java:31)
At net.sf.saxon.expr.sort.SortExpression.evaluateSortKey(SortExpression.java:394)
At net.sf.saxon.expr.sort.SortedIterator.buildArray(SortedIterator.java:215)
At net.sf.saxon.expr.sort.SortedIterator.doSort(SortedIterator.java:231)
At net.sf.saxon.expr.sort.SortedIterator.next(SortedIterator.java:148)
At net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:73)
At net.sf.saxon.trans.Mode.applyTemplates(Mode.java:455)
At net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:300)
At net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:255)
At net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
At net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
At net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
At net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:243)
At net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
At net.sf.saxon.expr.LetExpression.process(LetExpression.java:608)
At net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:484)
At net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:128)
At net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:484)
At net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
At net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
At net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:721)
At net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
At net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
At net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
At net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:352)
At net.sf.saxon.trans.Mode.applyTemplates(Mode.java:532)
At net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:747)
At net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:347)
At net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:349)
At net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:71)
At edu.umd.cs.findbugs.HTMLBugReporter.finish(HTMLBugReporter.java:73)
At edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.java:89)
At edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.java:89)
At edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.java:89)
At edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.java:89)
At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1165)
At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
At edu.umd.cs.findbugs.LaunchAppropriateUI.launch(LaunchAppropriateUI.java:106)
At edu.umd.cs.findbugs.LaunchAppropriateUI.main(LaunchAppropriateUI.java:198)

@welcome
Copy link

welcome bot commented Oct 17, 2019

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

@craftmaster2190
Copy link

+1

@Octogonapus
Copy link

Also getting this on beta 5. XML report works, though.

@mkienenb
Copy link
Contributor

mkienenb commented Mar 10, 2020

spotbugs-4.0.1-SNAPSHOT
commit cc4d647 (origin/master, origin/HEAD, master)
Author: Kengo TODA skypencil@gmail.com
Date: Sun Feb 23 09:58:33 2020 +0800

java version "1.8.0_60"

For me this is caused by NM_CONFUSING bug types.
The XML contains

  <BugInstance type="NM_CONFUSING" priority="3" rank="19" abbrev="Nm" category="BAD_PRACTICE">
    <Class classname="com.xyz.applications.epay.cayenne._EbppDAOCayenne">
      <SourceLine classname="com.xyz.applications.epay.cayenne._EbppDAOCayenne" start="62" end="858" sourcefile="_EbppDAOCayenne.java" sourcepath="com/xyz/applications/epay/cayenne/_EbppDAOCayenne.java"/>
    </Class>
    <Method classname="com.xyz.applications.epay.cayenne._EbppDAOCayenne" name="getACHProcessingQueueList" signature="()Ljava/util/List;" isStatic="false">
      <SourceLine classname="com.xyz.applications.epay.cayenne._EbppDAOCayenne" start="67" end="67" startBytecode="0" endBytecode="48" sourcefile="_EbppDAOCayenne.java" sourcepath="com/xyz/applications/epay/cayenne/_EbppDAOCayenne.java"/>
    </Method>
    <Class classname="com.xyz.cayenne.ebpp.entity.generated._Account">
      <SourceLine classname="com.xyz.cayenne.ebpp.entity.generated._Account" start="26" end="246" sourcefile="_Account.java" sourcepath="com/xyz/cayenne/ebpp/entity/generated/_Account.java"/>
    </Class>
    <Method classname="com.xyz.cayenne.ebpp.entity.generated._Account" name="getAchProcessingQueueList" signature="()Ljava/util/List;" isStatic="false">
      <SourceLine classname="com.xyz.cayenne.ebpp.entity.generated._Account" start="131" end="131" startBytecode="0" endBytecode="51" sourcefile="_Account.java" sourcepath="com/xyz/cayenne/ebpp/entity/generated/_Account.java"/>
    </Method>
  </BugInstance>

It looks to me like the html transform doesn't know how to handle errors for bug types which span multiple classes, such as NM_CONFUSING where the error is that two classes have methods that differ by capitalization.

Once I exclude NM_CONFUSING, html reports work again.

	<Match>
		<Or>
			<Method name="getAchProcessingQueueList" />
			<Method name="getACHProcessingQueueList" />
		</Or>
		<Bug code="NM" pattern="NM_CONFUSING" />
	</Match>

Unfortunately, I don't remember enough about xml transforms to fix it.
See also spotbugs/discuss#90

@udittmer
Copy link

udittmer commented Mar 11, 2020

For me it's DE_MIGHT_IGNORE. The XML report works fine.

  <BugInstance type="DE_MIGHT_IGNORE" priority="3" rank="19" abbrev="DE" category="BAD_PRACTICE">
    <Class classname="x.y.z.LifecycleListener">
      <SourceLine classname="x.y.z.LifecycleListener" start="23" end="142" sourcefile="LifecycleListener.java" sourcepath="x/y/z/LifecycleListener.java"/>
    </Class>
    <Method classname="x.y.z.LifecycleListener" name="contextDestroyed" signature="(Ljavax/servlet/ServletContextEvent;)V" isStatic="false">
      <SourceLine classname="x.y.z.LifecycleListener" start="86" end="118" startBytecode="0" endBytecode="767" sourcefile="LifecycleListener.java" sourcepath="x/y/z/LifecycleListener.java"/>
    </Method>
    <Class classname="java.lang.Exception" role="CLASS_EXCEPTION">
      <SourceLine classname="java.lang.Exception" start="54" end="123" sourcefile="Exception.java" sourcepath="java/lang/Exception.java"/>
    </Class>
    <SourceLine classname="x.y.z.LifecycleListener" start="105" end="105" startBytecode="192" endBytecode="192" sourcefile="LifecycleListener.java" sourcepath="x/y/z/LifecycleListener.java"/>
    <SourceLine classname="x.y.z.LifecycleListener" start="105" end="105" startBytecode="192" endBytecode="192" sourcefile="LifecycleListener.java" sourcepath="x/y/z/LifecycleListener.java"/>
  </BugInstance>
 

@mkienenb
Copy link
Contributor

Yes, DE_MIGHT_IGNORE is another example of multiple class tags for a single bug report.

@mkienenb
Copy link
Contributor

If anyone would like to test this fix (or use as a workaround until the next release), you can make a modified copy of default.xsl from your current distribution or download it from the PR here.

https://raw.githubusercontent.com/spotbugs/spotbugs/2c5a4aaaca1f50603e859ccab48c63bd303c708f/spotbugs/src/xsl/default.xsl

The only change is to use "Class[1]" instead of "Class".

With an ant task, you can specify this alternate xls file using the stylesheet attribute:

	        output="html"
	    	stylesheet="[PATH TO YOUR]/default.xsl"

@udittmer
Copy link

That stylesheet works like a charm. Thanks so much for the quick fix!

@udittmer
Copy link

This did not make it into 4.0.1, it seems?

@kevindorff
Copy link

I'm migrating from Findbugs to Spotbugs using the Gradle plugin. I was hoping to use 4.0.1 but immediately hit this bug. Using plugin:3.0.0 + tool:3.1.12 which seems to work.

@iloveeclipse
Copy link
Member

Yep, fancy.xsl is also affected:

Type error evaluating (fn:key(...)) in xsl:variable/@select on line 583 column 197 of fancy.xsl:
  XPTY0004: A sequence of more than one item is not allowed as the first argument of
  fn:generate-id() (<BugInstance>, <BugInstance>) 
at template list-by-category-and-code on line 581 of fancy.xsl:
     invoked by xsl:call-template at file:///opt/spotbugs/4.0.1/bin/../src/xsl/fancy.xsl#574
at template categories on line 550 of fancy.xsl:
     invoked by xsl:call-template at file:///opt/spotbugs/4.0.1/bin/../src/xsl/fancy.xsl#543
at template list-by-category on line 537 of fancy.xsl:
     invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:///opt/spotbugs/4.0.1/bin/../src/xsl/fancy.xsl#541
at template list-by-category on line 537 of fancy.xsl:
     invoked by xsl:call-template at file:///opt/spotbugs/4.0.1/bin/../src/xsl/fancy.xsl#343
  In template rule with match="/" on line 41 of fancy.xsl
Exception in thread "main" ; SystemID: file:///opt/spotbugs/4.0.1/bin/../src/xsl/fancy.xsl; Line#: 583; Column#: 97
net.sf.saxon.trans.XPathException: A sequence of more than one item is not allowed as the first argument of fn:generate-id() (<BugInstance>, <BugInstance>) 
	at net.sf.saxon.expr.Expression.typeError(Expression.java:1464)
	at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:293)
	at net.sf.saxon.expr.IdentityComparison.getNode(IdentityComparison.java:219)
	at net.sf.saxon.expr.IdentityComparison.effectiveBooleanValue(IdentityComparison.java:199)
	at net.sf.saxon.expr.AndExpression.effectiveBooleanValue(AndExpression.java:145)
	at net.sf.saxon.expr.FilterIterator$NonNumeric.matches(FilterIterator.java:190)
	at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:76)
	at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:62)
	at net.sf.saxon.expr.MappingIterator.next(MappingIterator.java:56)
	at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:73)
	at net.sf.saxon.expr.sort.SortedIterator.buildArray(SortedIterator.java:202)
	at net.sf.saxon.expr.sort.SortedIterator.doSort(SortedIterator.java:231)
	at net.sf.saxon.expr.sort.SortedIterator.next(SortedIterator.java:148)
	at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:73)
	at net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:127)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:484)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:243)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
	at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:411)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:243)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:484)
	at net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:128)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:484)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:243)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353)
	at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:411)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:735)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:132)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:299)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:721)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:352)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:532)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:747)
	at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:347)
	at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:349)
	at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:71)
	at edu.umd.cs.findbugs.HTMLBugReporter.finish(HTMLBugReporter.java:73)
	at edu.umd.cs.findbugs.PrintingBugReporter.xslt(PrintingBugReporter.java:238)
	at edu.umd.cs.findbugs.PrintingBugReporter.main(PrintingBugReporter.java:157)

I have patch for both. I know there are two pPR's hanging, let create another one...

iloveeclipse added a commit that referenced this issue Mar 30, 2020
See issue #1025: we had troubles to transorm if BugInstance contained
multiple Class elements. This commit  fixes fancy.xsl.
iloveeclipse pushed a commit that referenced this issue Mar 30, 2020
See issue #1025: we had troubles to transorm if BugInstance contained
multiple Class elements. This commit  fixes default.xsl.
@iloveeclipse iloveeclipse self-assigned this Mar 30, 2020
@iloveeclipse iloveeclipse linked a pull request Mar 30, 2020 that will close this issue
1 task
iloveeclipse added a commit that referenced this issue Mar 31, 2020
See issue #1025: we had troubles to transorm if BugInstance contained
multiple Class elements. This commit  fixes fancy.xsl.
iloveeclipse pushed a commit that referenced this issue Mar 31, 2020
See issue #1025: we had troubles to transorm if BugInstance contained
multiple Class elements. This commit  fixes default.xsl.
KengoTODA pushed a commit that referenced this issue Sep 24, 2020
See issue #1025: we had troubles to transorm if BugInstance contained multiple Class elements. This commit  fixes plain.xsl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants