1

Platform: Windows 7 x64

JDK version: 7.0.25 x64 or 7.0.45 x64

JDK installation path:

C:\Java\jdk725 or default c:\Program Files\Java\jdk1.7.0_25\

Spring Framework Release: 3.2.4 or 3.2.5

UAC: enabled or disabled

gradlew build (after gradlew):

:referenceHtmlMulti FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':referenceHtmlMulti'.

Failed to compile stylesheet. 59 errors detected.

Try:
Run with --info or --debug option to get more log output.

Exception is:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':referen
ceHtmlMulti'.

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecute(ExecuteActionsTaskExecuter.java:46)
..
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: javax.xml.transform.TransformerConfigurationException: Failed to comp
ile stylesheet. 59 errors detected.
at com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:136)
at com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryI
mpl.java:127)
at com.icl.saxon.TransformerFactoryImpl.newTransformer(TransformerFactor
yImpl.java:79)
..
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:61)
... 70 more

BUILD FAILED

My question is: why did my build fail?

4

1 回答 1

0

The problem happens when :referenceHtmlMulti task is executing. If we look in groovy class we will see that XSLT transformation is used to create docbook-reference. Despite the fact, that Saxon is used (TransformerFactoryImpl is selected) the choosen SAXParserFactory is org.apache.xerces.jaxp.SAXParserFactoryImpl (I wonder why not to use com.icl.saxon.aelfred.SAXParserFactoryImpl). IF we look what implementation of xerces is used by gradle we will see xercesImpl-2.9.1.jar, which is old enough. Now let's find class URI in xerces sources. It represents a Uniform Resource Identifier (URI). On line 1134 we can find

else if (!isURICharacter(testChar)) {
    throw new MalformedURIException(
    "Opaque part contains invalid character: " + testChar);
}

Now let's look how this function works:

private static boolean isURICharacter (char p_char) {
    return (p_char <= '~' && (fgLookupTable[p_char] & MASK_URI_CHARACTER) != 0);
}

We can see that function will return true if char comparision will return true also. But that means rather close limits of chars (from code 0 - 126 (~)). But what about non US-ASCII character set?

Let's read RFC 2396 about non us-ascii characters (that can exist in your windows path, representing your local language or can be found in account name, under which gradle unpacks itself and works): other catagory - The Unicode characters that are not in the US-ASCII character set, are not control characters (according to the Character.isISOControl method), and are not space characters (according to the Character.isSpaceChar method) (Deviation from RFC 2396, which is limited to US-ASCII). The set of all legal URI characters consists of the unreserved, reserved, escaped, and other characters.

So. URI identification fails. And that is the place where build code fails.

There are 2 solutions:

  1. To make your account name or path consist only of US-ASCII characters.
  2. To patch URI class (for example, by rewriting function isURICharacter)
于 2013-12-09T14:19:54.857 回答